Introduction – Installing and Basic commands. Experiment :1 Introduction to R and How to install R in PC. Experiment :2 Data types , different commands and built-in functions and databases.
apple<- c('red','green',"yellow")
print(apple)
print(class(apple))
sa<- c(1,2,3,4)
print(sa)
print(class(sa))
y<-seq(1,10,2)
print(y)
print(class(y))
list1<-list(c(2,5),21.3,sin)
print(list1)
print(class(list1))
M=matrix(c('a','a','b','c','b','a'),nrow=2,ncol=3,byrow=TRUE)
print(M)
print(class(M))
a<-array(c('green','yellow'),dim=c(3,3,2))
print(a)
app_col<-c('green','green','yellow','red','red','red','green')
fac_col<-factor(app_col)
print(fac_col)
print(nlevels(fac_col))
BMI <-data.frame(gender=c("Male","Male","Female"),height=c(152,171.5,165),weight=c(81,93,78),age=c(42,38,26))
print(BMI)
df=data.frame(
"Name"=c("Amiya","Raj","Asish"),"Language"=c("R","Python","Java"),"Age"=c(22,25,45))
print(df)
cat("Accessing First and Second row\n")
print(df[1:2,])
cat("Accessing First and Second Column\n")
print(df[,1:2])
Comments
Post a Comment