Re: [R] scale subset of data

2009-07-31 Thread Noah Silverman
That works perfectly.

Thanks!

-N

On 7/31/09 2:04 PM, Steve Lianoglou wrote:
> 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
>

[[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.


Re: [R] scale subset of data

2009-07-31 Thread Steve Lianoglou

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

__
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] scale subset of data

2009-07-31 Thread Noah Silverman
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?

Thanks,

-N


[[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.