I have to turn in a stats assignment in R Markdown pdf format. I was able to successfully turn my answers into an R Markdown file but some lines of code didn't fit onto the page.
The type of line I have to break looks like the following:
```{r}
gayssmw1 <- subset(gay, study == 1 & wave == 1 & treatment == "Same-Sex Marriage Script by Gay Canvasser")
mean(gayssmw1$ssm)
gayssmstraightw1 <- subset(gay, study == 1 & wave == 1 & treatment == "Same-Sex Marriage Script by Straight Canvasser")
mean(gayssmstraightw1$ssm)
gayssmcontrolw1 <- subset(gay, study == 1 & wave == 1 & treatment == "No Contact")
mean(gayssmcontrolw1$ssm)
mean(gayssmcontrolw1$ssm) - mean(gayssmw1$ssm)
mean(gayssmcontrolw1$ssm) - mean(gayssmstraightw1$ssm)
```
I turned back to R Studio and started inserting line breaks where needed first with shift + enter and then tried something I found on the R Markdown Basics website, the double space.
Now the lines fit into the page, but all results that are concerned by this line break in code now are displayed as:
> gayssmw1 <- subset(gay, study == 1 & wave == 1 & treatment == "Same-Sex
Marriage Script by Gay Canvasser")
> mean(gayssmw1$ssm)
[1] NaN
etc.
What should I do ?