While printing in console or saving a (big) data (came as an output in R) using sink() some of the last rows are getting omitted

1.3k views Asked by At

I have an array Y_obs of dimension (200X353x5) which came as an output in R (I mostly use Rstudio in Ubuntu 13.10.).

The problem: print(Y_obs) does not display the whole array in console. It is showing the following:

 [22,]      0      0      0      0      0      0
 [23,]      0      0      0      0      0      0
 [24,]      0      0      0      0      0      0
 [25,]      0      0      0      0      0      0
 [26,]      0      0      0      0      0      0
 [27,]      0      0      0      0      0      0
 [28,]      0      0      0      0      0      0

 [ reached getOption("max.print") -- omitted 172 row(s) and 4 matrix slice(s) ]

Then I went to sink my array Y_obs by using the following commands:

sink('CR.csv')
Y_obs
sink()

Then also it is showing the same output as the console after saving the incomplete data in the .csv file omitting the last 172 rows and 4 matrix slices.

When I tried the same in R terminal the it showed:

 [81,]      0      0      0      0      0      0
 [82,]      0      0      0      0      0      0
 [83,]      0      0      0      0      0      0

 [ reached getOption("max.print") -- omitted 117 row(s) and 3 matrix slice(s) ]

My question is: How to save the full array Y_obs in a specified .csv file ?

1

There are 1 answers

2
IRTFM On BEST ANSWER
?options   # the help page for the options function should appear.
bigger = options()$max.print + 200  # or add something larger
options("max.print" = bigger) # apparently RStudio sets max.print very low. 
print(Y_obs)     # the default on the typical R installation is around 10K