Untitled
i <- 1 while(i<6) { print(i) i <- i + 1 if(i == 4) { break } } i <- 1 while(i<6) { print(i) i <- i + 1 if(i==3) { next } } for(t in 1:10){ print(t) } for (x in 1:2) { for (y in 1:3) { print(x*y) } } sum <- function(){ print("hello") } sum() third <- c(1,2,3,-4,5,-6) third second <-c("Sam","David","Nathan","Peter") second first <-c(TRUE,TRUE,FALSE,TRUE,FALSE) first lamp <- c(1,5,2,8,9,7) sort(lamp, decreasing=FALSE) lamp[c(1,4)] matrice<-matrix(1:10,nrow=2,ncol=5,byrow=TRUE) matrice cells<-c(1:20) rnames<-c("R1","R2") cnames<-c("C1","C2","C3","C4","C5") matrice<-matrix(cells,nrow=2,ncol=5,byrow=TRUE,dimnames=list(rnames,cnames)) matrice matrice[2,4] matrice[1,c(2,4,5)] myarray<-array(1:18,c(3,2,3)) myarray
Leave a Comment