Re: [R] reorganize data

2013-02-12 Thread arun
ime:21:39:05  Lat:N62.37.18 Long:E018.07.32 #3 Date:10.09.19 Time:21:39:05  Lat:N62.37.18 Long:E018.07.32 # val #1 -0010 |   28|   28 #2  0010-0020|  302|  302 #3  0020-0030|   42|   42 A.K. - Original Message - From: Niklas Larson To: r-help@r-project.org C

Re: [R] reorganize data

2013-02-12 Thread arun
2   2   2 #5 Date:10.09.19 Time:21:39:05  Lat:N62.37.18 Long:E018.07.32   1   1 #6 Date:10.09.19 Time:21:39:05  Lat:N62.37.18 Long:E018.07.32   1   1 A.K. - Original Message - From: Niklas Larson To: r-help@r-project.org Cc: Sent: Tuesday, February 12, 201

Re: [R] reorganize data

2013-02-12 Thread David Winsemius
On Feb 12, 2013, at 2:56 AM, Niklas Larson wrote: > Hi R users, > Wonder if somebody could give me help on how to reshape this type of data: > #Adding a bit of code to read this into R: Lines <- readLines(textConnection("Date:10.09.19 Time:21:39:05 Lat:N62.37.18 Long:E018.07.32 -0010 | 2

[R] reorganize data

2013-02-12 Thread Niklas Larson
Hi R users, Wonder if somebody could give me help on how to reshape this type of data: --- Date:10.09.19 Time:21:39:05 Lat:N62.37.18 Long:E018.07.32 -0010 | 28| 28 0010-0020

Re: [R] Reorganize data fram

2011-07-15 Thread Dennis Murphy
Hi: On Fri, Jul 15, 2011 at 6:04 AM, anglor wrote: > Hi, thanks for your reply. > > I didn't get cast() to work and didn't know how to find information about it > either. Hadley Wickham's home page http://had.co.nz/ has a link (last one under the heading 'R Packages') to the reshape package pag

Re: [R] Reorganize data fram

2011-07-15 Thread anglor
Thank you! I used this one and it worked really great. /Angelica -- View this message in context: http://r.789695.n4.nabble.com/Reorganize-data-fram-tp3662123p3669782.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project

Re: [R] Reorganize data fram

2011-07-15 Thread anglor
Hi, thanks for your reply. I didn't get cast() to work and didn't know how to find information about it either. I used reshape but then I had to subset only those columns (actually I have 28 columns of other data) Could cast or reshape work also with more columns? Angelica -- View this messag

Re: [R] Reorganize data fram

2011-07-12 Thread Dennis Murphy
Hi: Try the cast() function in the reshape package. Using d as the name of your data frame, library(reshape) cast(d, Date ~ Category, value = 'Temperature') Date A B C 1 2007102 16 17 18 HTH, Dennis On Tue, Jul 12, 2011 at 5:42 AM, anglor wrote: > Hi, > > I have a data frame of about

Re: [R] Reorganize data fram

2011-07-12 Thread David Winsemius
On Jul 12, 2011, at 8:42 AM, anglor wrote: Hi, I have a data frame of about 700 000 rows which look something like this: DateTemperature Category 2007102 16 A 2007102 17 B 2007102 18 C but need it to be: Date T

[R] Reorganize data fram

2011-07-12 Thread anglor
Hi, I have a data frame of about 700 000 rows which look something like this: DateTemperature Category 2007102 16 A 2007102 17 B 2007102 18 C but need it to be: Date TemperatureA TemperatureB TemperatureC 2007102

Re: [R] Reorganize data frame

2011-03-16 Thread Scott Chamberlain
require(reshape2) dcast(stock.returns, Date ~ Ticker) The numbers were changed from their original values, but if you originally created the values Return as.numeric they should stay the same On Wednesday, March 16, 2011 at 9:37 AM, chris99 wrote: Hi group, > > I am trying to convert the organi

Re: [R] Reorganize data frame

2011-03-16 Thread Henrique Dallazuanna
Try this: xtabs(Return ~ Date + Ticker, stock.returns) On Wed, Mar 16, 2011 at 11:37 AM, chris99 wrote: > Hi group, > > I am trying to convert the organization of a data frame so I can do some > correlations between stocks, > > I have something like this: > > stock.returns <- > data.frame(rbind(

Re: [R] Reorganize data frame

2011-03-16 Thread Phil Spector
Here's one way: ans = reshape(stock.returns,idvar='Date', +varying=list(names(stock.returns)[-1]), +direction='long', +times=names(stock.returns)[-1], +v.names='Return',timevar='Ticker') rownames(ans) = NULL ans Date Ticke

[R] Reorganize data frame

2011-03-16 Thread chris99
Hi group, I am trying to convert the organization of a data frame so I can do some correlations between stocks, I have something like this: stock.returns <- data.frame(rbind(c("MSFT","20110301",0.05),c("MSFT","20110302",0.01),c("GOOG","20110301",-0.01),c("GOOG","20110302",0.04))) colnames(stock.