Re: [R] Reshaping data from long to wide without a "timevar"

2012-03-21 Thread Paul Miller
Hello All, Tried some more Internet searches and came to the conclusion that one probably does need to create a "timevar" before reshaping from long to wide. Below is some code that creates the "timevar" and transposes the data. connection <- textConnection(" 005 1 Gemcitabine 005 2 Erlotinib

Re: [R] Reshaping data from long to wide without a "timevar"

2012-03-20 Thread Paul Miller
Erlotinib, Paclitaxel" instead of "Gemcitabine, Paclitaxel, Erlotinib". That's what I mean when I say I want the columns in alphabetical order. Thanks, Paul --- On Tue, 3/20/12, R. Michael Weylandt wrote: > From: R. Michael Weylandt > Subject: Re: [R] Reshaping data

Re: [R] Reshaping data from long to wide without a "timevar"

2012-03-20 Thread R. Michael Weylandt
If I understand you right, library(reshape2) dcast(melt(TestData, id.var = "Subject", measure.var = "Drug"), Subject ~ value) Michael On Tue, Mar 20, 2012 at 9:50 AM, Paul Miller wrote: > Hello All, > > I was wondering if it's possible to reshape data from long to wide in R > without using a "