On Mon, Mar 14, 2011 at 9:06 PM, zhenjiang xu wrote:
> Hi,
>
> For example, the data.frame like:
>
> origdata.long <- read.table(header=T, con <- textConnection('
> subject sex condition measurement
> 1 M control 7.9
> 1 M first 12.3
> 1 M second
I just fix it afterward:
dta <- dta[,c("col1","col2","col3")]
---
Jeff Newmiller The . . Go Live...
DCN: Basics: ##.#. ##.#. Live Go...
Live: OO#.. Dead: OO#.. Playing
Research Engineer (Solar/Batteries O.O#. #.O#. wi
On Mar 14, 2011, at 10:24 PM, Henrique Dallazuanna wrote:
Try this:
reshape(origdata.long, direction = 'wide', timevar = 'condition',
idvar =
c('subject', 'sex'))
If you first set the order in the desired sequence:
origdata.long$condition <- factor(origdata.long$condition,
levels=c('fi
Try this:
reshape(origdata.long, direction = 'wide', timevar = 'condition', idvar =
c('subject', 'sex'))
On Mon, Mar 14, 2011 at 10:06 PM, zhenjiang xu wrote:
> Hi,
>
> For example, the data.frame like:
>
> origdata.long <- read.table(header=T, con <- textConnection('
> subject sex condition me
Hi:
This is straightforward with the reshape package:
library(reshape)
origdata.long$condition <- factor(origdata.long$condition,
levels = c('first', 'second', 'control'))
cast(origdata.long, subject + sex ~ condition)
Using measurement as value column. Use the value argument to cast to
ove
Hi,
For example, the data.frame like:
origdata.long <- read.table(header=T, con <- textConnection('
subject sex condition measurement
1 M control 7.9
1 M first12.3
1 Msecond10.7
2 F control 6.3
2 F first
6 matches
Mail list logo