New to org/babel, so forgive me if this doesn't make sense. I have some code (in R) that produces a table. I also specify (in R) the number of digits that I want with options(digits = 2). When I run the code to produce the table in R, everything works well. However, when I do C-c C-c on the source block, it inserts results with many digits. Why is this and how can I fix it?

#+BEGIN_SRC R :exports results :colnames yes
  options(digits = 2)
  thedata <- data.frame(
    a = runif(100),
    b = runif(100))


  thedata %>%
    summarize(meana = mean(a), meanb = mean(b))

  • I can't replicate your results with many digits. Can you include options("scipen") within the R code block and confirm the value ? Your R session is temporary. What happens if you add :session *R* options to #+BEGIN_SRC R , to include .Rprofile settings from your directory ? – RUserPassingBy Nov 26 '15 at 0:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.