You are on page 1of 1
Section NOR 4. Basic R Clocture nox : notes 1) - 1.4 Basic R We look at some Type the R basic R script, tables, vectors and matrices in the statistical package Script in the Console (lower left) panel of R Studio. Exercise 1.3 (Basie R) 1 Caleutations and Notation +3 gives (choose one) / [1] 5/>5 x Tce gives [1] cca [1] 2.58856 / [1] 2.55557 ong Bes log. (7) =In7 = [1] 0 845098 / [1] 1.94591 / [1] 2.718282 ©8107) gives logie(7) = [1] 0.845098 / [1] 1.94591 / [1] 2.718282 ©xp(1) gives e! = [1] 9 845098 / [1] 1.94691 / [1] 2.718282 Sart(4) gives V4 = [1] 2/ (1) 6 / [1] 24 factorial(4) gives 4! = [1] 2/ [1] 6/ (1) 24 choose(4,2) gives C; worm = [1] 2/111 6 / (1) 24 abs(-6) gives | — 6] = [1] 2/1] 6/ (1) 24 0/0 gives [1] NaN (not a number) / [4] NA (not available) / [1] Int (co) 5/0 gives [1] NaN (not a number) / [1] NA (missing) / [1] Inf (00) tunif(5) gives 5 numbers / 5 random numbers between 0 and 1 x < 4 means e = 4 / © =5 /x is assigned 5 x gives (1] 2/ [1] 3/ [1] 4 > x < 0:5 means x is assigned 5 / x is assigned 0, 1, 2, 3, 4 and 5 > xgives [1] 5/[1]012345 > 2+3; 5%*5; 4/2 gives (choose one) vv YY On & v (a) (1) 5 (11 25 (b) 2. Vectors. > x < c(1,2,4,5) and x is a vector of m > y <- c("bid", "ye Scanned with CamScanner

You might also like