2

I'm using R v. 3.3.2 and RStudio v. 1.0.44 on Mac. I love using RMarkdown and the new'ish Notebook flavor of markdown. However, I've recently noticed a new behavior. Line breaks in my R code chunks, are not reflected in the HTML notebook file. For example, a code chunk that looks like this in my .Rmd file:

```{r}
# Creating id for each participant
class_survey$id <- rownames(class_survey)

# Reoder the columns in the data frame so that ID comes first
class_survey <- class_survey[c(44, 1:43)]

# Rename the variables
class_survey <- class_survey %>%
  rename(children = Q19_1, gender = Q26, color = Q27)
```

renders like this in the nb.html document:

# Creating id for each participant
class_survey$id <- rownames(class_survey)
# Reoder the columns in the data frame so that ID comes first
class_survey <- class_survey[c(44, 1:43)]
# Rename the variables using dplyr
# new name = old name
class_survey <- class_survey %>%
  rename(children = Q19_1, gender = Q26, color = Q27)

I went back to look at some of my "older" nb.html files and found that line breaks used to be preserved. Does anyone know why this behavior changed, and more importantly, if there is a way to change it back?

Brad Cannell
  • 3,020
  • 2
  • 23
  • 39

1 Answers1

3

If anyone comes across this issue (I'm still having it half a year after release) you can Knit to a HTML document and the line breaks in your code will magically show up. Not sure why all the link breaks are gone when using the "preview notebook" feature button in Rstudio (even if you open in new tab).

rstudio preview dropdown

C W
  • 961
  • 8
  • 9