Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9269865
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T15:13:45+00:00 2026-06-18T15:13:45+00:00

I am currently experiencing some strange problems when processing a simple Markdown script under

  • 0

I am currently experiencing some strange problems when processing a simple Markdown script under RStudio. Summary() function gives an incorrect result, and I cannot figure what’s happening, because RStudio is not giving any error at all.

If I execute the following RMarkdown script (I have put the file with the data here)

```{r}
load('mydata.rda')
summary(mydata$b)
head(sort(mydata$b))
```
```{r}
sessionInfo()
```

I get the following result

load("mydata.rda")
summary(mydata$b)
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##       0    6000   10000   12000   16000   35000

head(sort(mydata$b))
## [1] -0.01 -0.01  0.00  0.00  0.00  0.00

sessionInfo()
## R version 2.15.1 (2012-06-22)
## Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
## 
## locale:
## [1] es_ES.UTF-8/es_ES.UTF-8/es_ES.UTF-8/C/es_ES.UTF-8/es_ES.UTF-8
## 
## attached base packages:
## [1] stats     graphics  grDevices utils     datasets  methods   base     
## 
## other attached packages:
## [1] knitr_1.0.5
## 
## loaded via a namespace (and not attached):
## [1] digest_0.5.2   evaluate_0.4.3 formatR_0.6    plyr_1.7.1    
## [5] stringr_0.6.1  tools_2.15.1

As you can see, the result is wrong, because the actual minimum value of the ‘b’ variable is negative, something the summary() execution seems to ignore. I have tried the same with a Knitr Rnw pdf script and it does exactly the same. However, when I run it through Sweave, the result is ok.

What is the summary function returning when it is called under knitr/RStudio? Is this a side effect of something I am missing or a bug?

Regards,
Gus

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T15:13:47+00:00Added an answer on June 18, 2026 at 3:13 pm

    Try adding the following to the top of your document:

    ```{r, echo=FALSE}
    options(digits = 7)
    ```
    

    To see what the difference is between an R session and a markdown -> HTML knitr session, type the following in your R console and include it in your markddown document and compare the output of each:

    options()
    

    options("digits") in a default R session is 7, but in the environment that the knitting of an HTML document from a markdown file (at least on my system) it is 4. Not sure where that is set though 😉

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm currently experiencing some problems with my server. I have a pool which is
I'm currently experiencing some problems with the jQuery cycle plugin while attempting to cycle
I'm currently experiencing some problems with the Graph API when inviting users to an
I'm currently working with jQuery 1.4.2 and jQuery UI 1.8.2. I'm experiencing some weird
I am currently experiencing with Websockets. By reviewing some active projects/implementations like einaros/ws (and
I am currently looking into socket programming in python and I am experiencing some
We just started using jCarousel with our application and we're experiencing some strange UI
I'm currently experiencing some scrolling issues in a few of my views. The performance
I'm currently experiencing a strange issue that my understanding of SQL server doesn't quite
I am building an application for the android Phone and am experiencing some strange

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.