[R] Vector of Numbers Not Output to Screen

Dario Strbenac dstr7320 at uni.sydney.edu.au
Thu Jul 17 08:00:19 CEST 2014


Hello,

I have a block of code that has two head calls at the end, but only the second is shown on screen. If I manually execute the statement which is not showing, it works. I thought that if statements are not functions. It is behaving as one.

> if(1 < 2)
+ {
+   x<-rnorm(100)
+   y <- rpois(10, 5)
+   head(x)
+   head(y)
+ }
[1] 4 4 5 4 8 3
> 
> head(x)
[1] -1.89083874  0.42442102  0.96114276  0.48004716  1.94358108 -0.02654324

> sessionInfo()
R version 3.1.1 (2014-07-10)
Platform: i386-w64-mingw32/i386 (32-bit)

locale:
[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          
[5] LC_TIME=English_United States.1252    

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

--------------------------------------
Dario Strbenac
PhD Student
University of Sydney
Camperdown NSW 2050
Australia


More information about the R-help mailing list