Inserting plots inside code chunks in R Markdowns - r

I'm trying to add a plot to my R Markdown report, however, when I try to knit what I have yet written I found myself with a disastrous error. I have changed a lot of arguments and parameters in order to show the plot on my Markdown.
This is the error I get
I'd like you to help me fix this error so that I can show all the plots I need.

Make sure you've spelled hours correctly. The error suggests you don't have a variable hours in your dataset. Perhaps it ought to be capitalized?

Related

Rmarkdownon Kaggle: Can you spot what's going on?

it's been a few days that im trying to run my Rmd on Kaggle, but it simply doesn't work.
The main reason (I guess) is that, somehow the console is reading the code as an R code, but im sure that I'm using Rmarkdown.
Therefore, the console reads a Text line as a code line, giving me the code error below:
Also, i tried to copy and edit other's people markdown, but i keep getting the same error line.
You can check my code here: https://www.kaggle.com/badluckmath/kernel4c85aae59c/edit/run/39891200
He's working perfectly on my Rstudio.
I'm looking for a huge help here, please!
I've been stuck with this for a week!
If i press the buttom to run code, it will simply give me this error message.
For that, i still don't know the solution. But since this is a premade Rmarkdown and i knew that it works, i simple used the Save (Commit) options and at the end, it worked.

what means this error in R, when previously it did not

I am working a R project, data is BRFSS2013. I have some data and plots, but now where I just working in others line, show a error in a line where previously it bring me information.
When delete this code, it start to show error, for example, in the code for doing the plot. What it happened, if I did not working in that line.
This previously to show that error.
file:///C:/Users/olga%20carvajal/Desktop/Adriana/Introduction_To_Probability_and_Data_with_R/intro_data_prob_project.html
Thank you.
Adriana

I can't get my plot to knit to PDF without getting an error message

For some reason I keep getting an error that cancels everything when I try to knit. It keeps telling me that the error is in the line with plot() and I don't know what to do. It's having trouble finding my dataset but I don't know how to fix it.
Plot(movement_data$Dose,movement_data$Move,xlab="Dose",ylab="Move",main="Embryo movment vs dose of CBD")
library(gplots)
plotmeans(Move~Dose,data=movement_data,mean.labels=TRUE,connect=FALSE)

Trying to display regression outputs in Rmarkdown in Latex

Hi all!
I'm currently working on a paper for my university. The task is to run some regressions on a dataset and compile all results in an rmarkdown file. It should be noted that this is my first time working with R, so if the following question is really stupid, I apologize in advance. ;-)
My problem relates to the display of the regression outputs in Rmarkdown. I want to have them in Latex but somehow it won't work.
I tried to replicate this code https://www.r-statistics.com/tag/stargazer/ but when I enter it I get the following output (this happens both in the console and in Rmarkdown):
When I manually enter Latex in the Rmarkdown document with the $ notation, for instance to include formulas, it works just fine so I'm a bit puzzled.
I feel like I'm missing something very obvious but I can't quite put my finger on it. In any event, any help would be greatly appreciated!

knitr - multiple plots within a for loop with grid.arrange

I am new to knitr so I am trying to modify the example given at http://yihui.name/knitr/demo/externalization/ to be used with my own r-script. Everything seems to work ok except for a piece of code where the following lines are performed:
for (j in seq(1,length(kkkk)-1))
{
q1=qplot(x[seq(kkkk[j],kkkk[j+1]),1],x[seq(kkkk[j],kkkk[j+1]),2])
q2=qplot(x[seq(kkkk[j],kkkk[j+1]),1],x[seq(kkkk[j],kkkk[j+1]),6])
q3=qplot(x[seq(kkkk[j],kkkk[j+1]),1],x[seq(kkkk[j],kkkk[j+1]),9])
grid.arrange(q1,q2,q3,ncol=1)
}
Those lines will create a series of figures and I would like very much to see them in the final report. Unfortunately nothing shows up. I read the other threads on a similar subject and one of the suggestions was to use print. Unfortunately that also did not force the figures to show up (I have used print(grid.arrange ...) which returns NULL).
Any suggestions?
Many thanks.

Resources