Skip to content

Instantly share code, notes, and snippets.

@raphaelsaunier
Created March 1, 2012 08:25
Show Gist options
  • Save raphaelsaunier/1948304 to your computer and use it in GitHub Desktop.
Save raphaelsaunier/1948304 to your computer and use it in GitHub Desktop.
R version 2.14.2 (2012-02-29)
Copyright (C) 2012 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-apple-darwin9.8.0/i386 (32-bit)
R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.
Natural language support but running in an English locale
R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.
Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.
[R.app GUI 1.50 (6126) i386-apple-darwin9.8.0]
> contributors)=
Error: unexpected ')' in "contributors)"
> contributors()
> demo()
> sin(pi)
[1] 1.224647e-16
> abc <- 123
> abc
[1] 123
> abc > 100
[1] TRUE
> abc < 100
[1] FALSE
> c <- (2,5,6,7)
Error: unexpected ',' in "c <- (2,"
> c <- c(2,5,6,7)
> c
[1] 2 5 6 7
> 1:12
[1] 1 2 3 4 5 6 7 8 9 10 11 12
> rep(c(1:5),3)
[1] 1 2 3 4 5 1 2 3 4 5 1 2 3 4 5
> rnorm(40,5,2.3)
[1] 4.4030603 3.6362510 3.7554274 5.9980627 4.0489133 0.7453899 4.9117375 7.8398147 6.8436332
[10] 3.5973802 8.9125194 7.0943066 5.8906532 6.1678161 4.7258099 3.4910976 6.8851564 4.6877811
[19] 6.2929359 6.1329526 4.3631772 2.0000235 1.8827062 4.4736056 7.2301535 5.9145657 3.9426569
[28] 8.7387682 5.9903246 4.9135500 6.7747425 1.8428270 7.0990723 1.3453762 7.7526262 2.5071233
[37] 8.6247518 6.0899325 1.6435475 1.4390406
> mean(rnorm(40,5,2.3))
[1] 5.982898
> mean(c(1,2,3,5))
[1] 2.75
> sd(c(1,2,3,5))
[1] 1.707825
> seq(8,10,0.2)
[1] 8.0 8.2 8.4 8.6 8.8 9.0 9.2 9.4 9.6 9.8 10.0
> seq(8,10,-0.2)
Error in seq.default(8, 10, -0.2) : wrong sign in 'by' argument
> seq(10,8,-0.2)
[1] 10.0 9.8 9.6 9.4 9.2 9.0 8.8 8.6 8.4 8.2 8.0
> z _ seq(10,8,-0.2)
Error: unexpected input in "z _"
> z -> seq(10,8,-0.2)
Error: object 'z' not found
> z <- seq(10,8,-0.2)
> z
[1] 10.0 9.8 9.6 9.4 9.2 9.0 8.8 8.6 8.4 8.2 8.0
> length(z)
[1] 11
> prof(z)
Error: could not find function "prof"
> prod(z)
[1] 30536534445
> z<-1:10
> x>7
Error: object 'x' not found
> z>7
[1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE TRUE TRUE TRUE
>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment