When I run the following line by line in R it works fine, but with knitr
the options(digits=3)
gets ignored.
Why? Any solutions?
<<cor>>=
#mock up data set.
x <- c(rnorm(100))
y <- c(rnorm(100))
z <- c(rnorm(100))
df <- as.data.frame(cbind(x,y,z))
df$x<- as.numeric(df$x)
df$y<- as.numeric(df$y)
df$z<- as.numeric(df$z)
options(digits=3)
cor(df, use = 'na.or.complete', method = c("spearman"))
@
Thank you for any help or pointers!