Question

Using R, I converted a frequency table (created using the table() function) to a data-frame. My data frame now looks as follows:

            words       frequency
1           'home'      1
2           'paper'     5
3           'letter'    6

Now I want to convert this data frame back into a table() object.

How?

Was it helpful?

Solution

You can try this

my.data <- data.frame(words=c("home", "paper", "letter"),
                      frequency=c(1, 5, 6))
my.tbl <- xtabs(frequency ~ words, data=my.data)
is.table(my.tbl) # TRUE
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top