dataframe - R: Creating and saving a table to a data frame -
this such simple sounding problem, , yet can't find solution problem. have created table previous data.frame in order organize data differently (see below)
section of dataframe1 below
score pred 0.966 noise 0.95 noise 0.964 noise 0.924 call 0.838 noise 0.982 call 0.934 noise
organizing data table using following:
dataframe1_sorted <- with(dataframe1, table(score, pred))
this creates table following: want have count of how many "call"s , how many "noise"s there in each score category.
score pred call noise 0 0 402 0 0.002 0 207 0 0.004 0 120 0 0.006 0 83 0 0.008 0 59 0 0.01 0 48 0
now, when try save table using df<-data.frame(dataframe1), changes columns, , headings "score, pred, freq". want save table dataframe is.
what can do?
try unclassing table:
df<-data.frame(unclass(dataframe1))
i think that's looking for.
Comments
Post a Comment