Google News
logo
R - Interview Questions
What is a data frame in R?
The data frame is a list of vectors of equal length. It can consist of any vector with a particular type and can combine it into one. So, a data frame can have a vector of logical and another of numeric. The only condition is that all the vectors should have the same length.
#This is how the data frame is created
> student_profile <- data.frame(
Name <-c(“Ray”, “Green”, “Justin”)
Age <- c(22,23,24)
Class <- c(6,7,8)
)
print(stuent_profile)
The above code will create three columns with the columns name as name, age, and class.
Advertisement