Practice 1
Practice 1
WARNING: You're using a non-UTF8 locale, therefore only ASCII characters will work.
Please read R for Mac OS X FAQ (see Help) section 9 and adjust your system
preferences accordingly.
[Workspace restored from /Users/atharvnadkarni/.RData]
[History restored from /Users/atharvnadkarni/.Rapp.history]
> 5+s
Error: object 's' not found
> 5+5
[1] 10
> x <- 1
> peint(x)
Error in peint(x) : could not find function "peint"
> print(x)
[1] 1
> x
[1] 1
> msg <- 'hi jessy'
> msg
[1] "hi jessy"
> x! <- 1:11
Error: unexpected '!' in "x!"
> x <- 1:11
> x
[1] 1 2 3 4 5 6 7 8 9 10 11
> x <- 1:10
> x
[1] 1 2 3 4 5 6 7 8 9 10
> x <- c(0.5, 0.6)
> x
[1] 0.5 0.6
> x <- c(TRUE, FALSE)
> x
[1] TRUE FALSE
> x <- c(TRUE,FALSE)
> X
Error: object 'X' not found
> x
[1] TRUE FALSE
> x <- c(1, 2, TRUE, FAlSE)
Error: object 'FAlSE' not found
> x <- c(1, 2, TRUE, FALSE)
> X
Error: object 'X' not found
> x
[1] 1 2 1 0
> x = c(1, 2, 'JESSY', 'DARSH')
> x
[1] "1" "2" "JESSY" "DARSH"
> x=0:6
> class(x)
[1] "integer"
> x
[1] 0 1 2 3 4 5 6
> as.numeric(x)
[1] 0 1 2 3 4 5 6
> as.logical(x)
[1] FALSE TRUE TRUE TRUE TRUE TRUE TRUE
> x <- -2:4
> x
[1] -2 -1 0 1 2 3 4
> as.logical(x)
[1] TRUE TRUE FALSE TRUE TRUE TRUE TRUE
> m <- matrix(1:6, nrow=2, ncol=3)
> m
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
> x <- matrix(1:9, nrow=3, ncol = 3)
> x
[,1] [,2] [,3]
[1,] 1 4 7
[2,] 2 5 8
[3,] 3 6 9
> x <- matrix(1:9, nrow=9, ncol = 1)
> x
[,1]
[1,] 1
[2,] 2
[3,] 3
[4,] 4
[5,] 5
[6,] 6
[7,] 7
[8,] 8
[9,] 9
> x <- matrix(2, 4, 6, 8, 1, 3, 5, 7, 9, 0, nrow=2, ncol=5)
Error in matrix(2, 4, 6, 8, 1, 3, 5, 7, 9, 0, nrow = 2, ncol = 5) :
unused arguments (8, 1, 3, 5, 7, 9, 0)
> x <- matrix(1:9, 9, 1)
> x
[,1]
[1,] 1
[2,] 2
[3,] 3
[4,] 4
[5,] 5
[6,] 6
[7,] 7
[8,] 8
[9,] 9
> x <- [2, 4, 6, 8, 1, 3, 5, 7, 9, 0]
Error: unexpected '[' in "x <- ["
> x <- 2, 4, 6, 8, 1, 3, 5, 7, 9, 0
Error: unexpected ',' in "x <- 2,"
> x <- vector("list", length = 5)
> x
[[1]]
NULL
[[2]]
NULL
[[3]]
NULL
[[4]]
NULL
[[5]]
NULL