- Atomic Vector (1 dimension)
- Matrix (2 dimension)
- Array (n dimension)
- List (1 dimension)
- Data frame (2 dimension)
- Factor
student.names <- c( "ram" ,"krishna", "kumar", "ganesh")
student.weights <- c (60.6, 70.5, 80.4, 68.5)
student.physicsmarks <- (50L, 60L, 70L, 80L) #Suffix L is needed to make it a integer vector instead of numeric(decimal) vector
student.likesPhysics <- (F, FALSE, TRUE, T) # T /TRUE indicate true
str(stduent.names) # returns the structure of a vector
is.character(student.names)
is.numeric(student.marks)
creating a vector
vector("character",length=50)
student.marks >= 75
student.mars +
print (student.names[1])
Extracting sub lists
student.names[1:3]
as.numeric(student.marks) converts ints to floats
as.integer(student.weights) conversts floats to ints