nrow() returns the number of observations (or rows or records). length() returns the number of columns. df <- data.frame (
val_1 = c('foo', 'bar', 'baz'),
val_1 = c( 1 , 2 , 3 )
)
nrow (df) # 3
length(df) # 2
df <- data.frame (
val_1 = c('foo', 'bar', 'baz'),
val_1 = c( 1 , 2 , 3 )
)
class (df) # data.frame
typeof(df) # list
mode (df) # list
read.csv() to read a CSV file into a data frame
read.csv(…, text = "") to assign data that is stored within an R source/script file
View() or DT::datatable() functions.