Re: [R] List of occuring values

2017-09-21 Thread Jim Lemon
Hi Ferri, Do you mean getting something like the vector of original values back? boodat<-sample(LETTERS[1:4],100,TRUE) bootab<-table(boodat) untab<-function(x) { lenx<-length(x) newx<-NULL for(i in 1:lenx) newx<-c(newx,rep(names(x)[i],x[i])) return(newx) } untab(bootab) Jim On Thu, Sep 21,

Re: [R] List of occuring values

2017-09-21 Thread William Dunlap via R-help
Note that this data.frame(table(...)) makes a column for each argument to table(...), plus a column for the frequencies so you can easily deal with multiway tabulations. > rawData <- data.frame( + sizes = c("Small", "Large", "Large", "Large"), + colors = c("Red", "Blue", "Blue", "Red"), +

Re: [R] List of occuring values

2017-09-21 Thread William Dunlap via R-help
unique(x) will give you the distinct values in x. table(x) will give you the distrinct values and their frequencies as an array with dimnames. data.frame(table(x)) will give you a 2-column data.frame with the distinct values and their frequencies. > values <- c("Small", "Large", "Large",

Re: [R] List of occuring values

2017-09-21 Thread David L Carlson
y Texas A University College Station, TX 77843-4352 -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Ferri Leberl Sent: Thursday, September 21, 2017 8:01 AM To: r-help@r-project.org Subject: [R] List of occuring values Dear all, ftable produces a list of

[R] List of occuring values

2017-09-21 Thread Ferri Leberl
Dear all, ftable produces a list of the frequencies of all occuring values. But how about the occuring values? How can I retrieve a list of occuring values? How can I retrieve a table with both the list of occuring values and their respective frequencies? Thank you in advance, Yours, Ferri