To learn R, I tried importing data (about spam) contained in a plain text file.
I used the table function, and then tried to convert the corresponding object to a data frame, using two answers to this question.
Here is the code.
file <- "./spam.data.txt"
spamd <- read.table(file, sep = "" , header = F, stringsAsFactors= F)
spamd <- as.data.frame(spamd)
typeof(spamd) # list
spamd <- read.table(file, sep = "" , header = F, stringsAsFactors= F)
spamd <- as.data.frame.matrix(spamd)
typeof(spamd) # list
Why is it that in both case, typeof()
returns list
? Why not dataframe?
Thanks