[R] scale subset of data

Steve Lianoglou mailinglist.honeypot at gmail.com
Fri Jul 31 23:04:12 CEST 2009


Hi,

On Jul 31, 2009, at 4:13 PM, Noah Silverman wrote:

> Hi,
>
> This should be an easy one, but I have some trouble formatting the  
> data
> right
>
> I'm trying to replace the column of a subset of a dataframe with the
> scaled data for that column of the subset
>
> subset(rawdata, code== "foo", select = a) <- scale( subset(rawdata,
> code== "foo", select = a) )
>
> It returns:   could not find function "subset<-"
>
> The scale command works individually and the subset command works
> individually.
>
> Can someone help me format this command line correctly?

How about:

rawdata[rawdata$code=='foo', 'a'] <- scale(rawdata[rawdata 
$code=='foo', 'a'])

-steve

--
Steve Lianoglou
Graduate Student: Computational Systems Biology
   |  Memorial Sloan-Kettering Cancer Center
   |  Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact




More information about the R-help mailing list