1

I'm trying to use head() function to show the first 6 row of the data in my mrakdown, as it is intended to do. My problem is that when I run the function in the markdown, the output won't show below the chunk while other functions are all working normally. The function also runs normally in the console and in the output file of markdown. The function tail() shows the same phenomenon

It shows nothing in the markdown:
image

But runs normally in the console:
image

I recently tried to update my Rstudio version to 1.2.1355, facing the problem that I can't scroll in the pane, so I returned to the version 1.1.463. The problem happened afterward. My R is running under version 3.5.3, hope these info may help. My system is Windows 10 Home, version 1803

Update: I've created a code sample to make it clearer, hopefully

C1 <- c(1,2,3,4,5,6)
C2 <- c(7,8,9,10,11,12)
dta <- data.frame(C1,C2)
show(dta)
head(dta)
mean(C1)

It runs in the markdown like this, while running normally in the console:
image

Seems that the functions those should've returned the object itself are not working

Martin Brisiak
  • 3,872
  • 12
  • 37
  • 51
計柏毅
  • 11
  • 1
  • 4

3 Answers3

0

If is not an issue in your Global Options configuration, then perhaps you should install R and Rstudio again. But try firstly installing RMkardown and Knitr libraries.

Another option is present data as a table

Orlando Sabogal
  • 1,470
  • 7
  • 20
0

OK I'm not sure if you still need the answer, but for other people that are still out there confused (like me a few hours ago): If your head() works in console but not in rmarkdown inline, you need to check if you used any non-ASCII characters in your .Rmd file name. Judging by your username, you might have made the same mistake as I did by using chinese characters in the .Rmd file name. I got the idea from this post: Rnotebook not showing code output for data frames.

Esther
  • 1
0

For people who is facing the same problem. I could solve it by going to: Options of Rmarkdown - Output options - Mark the option "Include table of contents".