Execute contents of editable text area [closed] - r

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
For a tutorial I am giving, I would like to show some R code in a Rmarkup document producing a plot, and then edit that code live and see the updated plot (for example changing points in the plot to lines).
Ik know I could use RShiny elements to do this, but I would really like to show the R code producing the plot. How can I do this?

The new versions of R Studio act like a notebook, in which the code chunks are evaluated and results displayed right below the chunk. Open a new R Markdown document, insert an R chunk, and Run Current Chunk.
```{r}
1+1
```

Related

Is it possible to visualize data with a large number of features (>50) in R [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a dataset with a large number of features. I need to understand my data before going further in the analysis. I have around 160 variables. After a little bit cleaning, I finished with only 60 features in my hand. I want to visualize my data hopefully to get a much more clear picture about it. How can I visualize data with 60 features in R?
You could just compile an html file with all the plots using rmarkdown.
The YAML header would be something like:
---
title: "HTML page with plots"
author: "YourAme"
date: "12/12/2018"
output: html_document
---
and then in the script you can create an R code block with the plots:
```{r}
plot(x1,y)
plot(x2,y)
plot(x60,y)
```
Finally, click the "knit" button.
Assuming your refined data set is in a data frame/matrix, you may look at the correlation matrix of all your input predictors:
res <- cor(your_data)
round(res, 2)
This would give at least a rough idea of what relationships might exist between the various predictors.
Note: I am assuming here that your actual ask centers around being able to see, at a glance, what your data set looks like, before you go and build some type of model.

How to print values from a dataframe at specific positions into a PDF? [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 4 years ago.
Improve this question
I have a PDF form which needs to be filled out with data in df, one file per row, in the manner explained in the picture.
How can I create a printable area that contains the PDF as background, and prints each column of df on a specific position, namely, its corresponding field?
Thanks!
First we need to store in a pdf with filename "My File". If you want a different filename each time just loop. The "par(mfrow=...) will tell R the dimensions of the plot i.e.
pdf(paste("My File",".pdf",sep=""))
par(mfrow=c(1,1))
Then we can choose a plot to print with vertical and horizontal lines; if our df has dimensions nrow by ncol:
p1<-p2<-0
plot(p1,p2,type="n",xlim=c(0.19,4.78),ylim=c(0.252,5.75))
abline(v=c(1:4),h=c(1:5))
text((1/2)*seq(1,9,by=2),rep((1/2)*seq(1,11,2),each=6),c("P","R","I","N","T"),cex=5)
Although I highly recommend you just use a package if possible such as in this short video: https://www.youtube.com/watch?v=GOQ_StD4sGA

R markdown add list of figures to table of content [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Is it possible to add the "list of figures" to my "table of content" in R Markdown?
My toc is working, but it shows only the chapters of the document but not the generated list of figures.
The list of figures is generated automatically by using \listoffigures in the code. But only the chapters which are added with # Chaptername are shown in the toc.

Getting Error when trying to knit in R Markdown using R Studio [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
I am getting this error when trying to knit HTML Document in R Studio using R Markdown:
Make sure your packages are up to date.
Tools -> Check for Package Updates...
I had this problem, and had a bunch of package updates waiting. This fixed it for me.

R Markdown could not find function [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 7 years ago.
Improve this question
Running Compile Notebook from RStudio.
I am getting:
Error: could not find function "SegNeigh"
"SegNeigh" being my own function, properly sourced; the script runs fine without R Markdown.
Any help appreciated.
In order for the rmarkdown doc to find the function, you either need to define SegNeigh in the same document or place it in another file and source that file explicitly

Resources