Hello,

maybe something like this?

range <- with(dat, paste0("[", min_price, ",", max_price, "]"))
dat2 <- with(dat, data.frame(product = product, VN = mean_price, range = range, price_band = price_band))

Unless it's a printing problem and you really want the range below VN.


Hope this helps,

Rui Barradas

Em 13-12-2012 11:24, Tammy Ma escreveu:
Really sorry for messing up.

I want to transform:

product min_price  max_price mean_price country   price_band
11                     34                     50                           40   
                      VN       0-300
22                    10                      30                            15  
                       VN               0-300

into

Into:

product       VN               price_band
   11                   40         0-300
                          [34,50]
   22                 15                     0-300
                         [10,30]

How Can I do this in r?


Kind regards,
Tammy




From: metal_lical...@live.com
To: metal_lical...@live.com
Subject: RE: [R] how to aggregate the dataset
Date: Thu, 13 Dec 2012 14:22:54 +0300





HI,


I want it looks like this:

Into:

product       VN               price_band
   11                   40         0-300
                          [34,50]
   22                 15                     0-300
                         [10,30]

From: metal_lical...@live.com
To: r-help@r-project.org
Date: Thu, 13 Dec 2012 13:42:35 +0300
Subject: [R] how to aggregate the dataset


HI,



Sorry for messing up..

I want to transform the following dataset:

product min_price  max_price mean_price country   price_band
11           34           50               40             VN         0-300
22           10           30               15             VN         0-300


Into:

product     VN               price_band
   11                 40         0-300
                      [34,50]
   22               15                     0-300
                      [10,30]


How can I do this in r? I have large dataset like this. I want to transform all 
into that one. Thanks a lot.


Kind regards,
Tammy



                                        
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.
                                                                                
        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to