r

an anonymous user · September 23, 2022
#to create vector


assign("vec",c(12,32,23,32,2))
a<-1:2
c<-c()
for(i in 1:length(vec)){
    c[i]<-vec[i]
}


sum(vec)
mean(vec)
prod(vec)
sort(vec)
sort(vec,decreasing=TRUE)

is.element(12,vec)
sum(vec==32)
tail(vec,n=2)
vec=1:100

n<-vec[seq(1,length(vec),5)]
setdiff
Output
(Run the program to view its output)

Comments

Please sign up or log in to contribute to the discussion.