[R] table and colnames
Gabor Grothendieck
ggrothendieck at gmail.com
Thu Sep 4 18:32:01 CEST 2008
See http://gsubfn.googlecode.com for more on the gsubfn package.
Below we use strapply to pick out every string of digits and decimal points
converting each to numeric returning a list of pairs and rbinding that list
into a matrix.
> x <- c("[10.839,10.841]", "(10.841,10.843]", "(10.843,10.846]", "(10.846,10.848]", "(10.848,10.85]")
> library(gsubfn)
> strapply(x, "[0-9.]+", as.numeric, simplify = rbind)
[,1] [,2]
[1,] 10.839 10.841
[2,] 10.841 10.843
[3,] 10.843 10.846
[4,] 10.846 10.848
[5,] 10.848 10.850
On Thu, Sep 4, 2008 at 9:20 AM, Trubisz, Joseph
<jtrubisz at modernconsumer.com> wrote:
> I have a table statement that returns the following:
>
>
>
> [10.839,10.841] (10.841,10.843] (10.843,10.846] (10.846,10.848]
> (10.848,10.85]
>
> 0 0 0 0
> 1
>
> (10.85,10.852] (10.852,10.854] (10.854,10.857] (10.857,10.859]
> (10.859,10.861]
>
> 0 0 0 0
> 0
>
>
>
> What I want to do is get the upper bound value into a vector for each of
> the 10-buckets.
>
> (e.g. v<-c(10.841,10.843...)
>
> I'm totally clueless on how to proceed.
>
> Any help appreciated.
>
>
>
> TIA,
>
> Joe
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>
More information about the R-help
mailing list