2

When I knit the following code chunk in Rmarkdown it will print out the results as well. I just want to run and show the code. In other code chunks in the same .Rmd file this knitr syntax works...

```{r import, results = "hide"}

gs_ls()

df <- gs_title("worlds-view-of-America")

confInPres <- df %>% gs_read(ws = "Sheet1", range = cell_rows(1:38))

colnames(confInPres) <- paste("year", colnames(confInPres), sep = "_")

colnames(confInPres)[1] <- "Country"

confInTrump <- select(confInPres, Country, year_2017)

favUS <- df %>% gs_read(ws = "Sheet2", range = cell_rows(1:38))
```
Tdebeus
  • 1,519
  • 5
  • 21
  • 43

1 Answers1

4

Take a look here.

If you want to show the code, use echo=TRUE.

Florian
  • 24,425
  • 4
  • 49
  • 80
  • 1
    When I add these ````{r import, message=FALSE, warning=FALSE}` everything seems to work except for the `gs_ls()` call. – Tdebeus Jul 25 '17 at 09:53
  • what do you expect it to do? It `Lists spreadsheets that the user would see in the Google Sheets home screen`, but you are not printing anything, because you set `results=hide.` If you want it to print its results, you should set `results="asis"` and do something like print(gs_ls()). Hope this helps! Please consider accepting my answer if it does. – Florian Jul 25 '17 at 10:06