Displaying 4 results from an estimated 4 matches for "pfoa".
Did you mean:
pfa
2018 Apr 19
4
create multiple categorical variables in a data frame using a loop
Hi All,
I want to create a categorical variable, cat.pfoa, in the file of pfas.pheno (a data frame) based on log2pfoa values. I can do it using the following code.
pfas.pheno <-within(pfas.pheno, {cat.pfoa<-NA
cat.pfoa[pfas.pheno$log2pfoa <=quantile(pfas.pheno$log2pfoa,0.25, na.rm =T)]<-0
cat.pfoa[pfas.pheno$log2pfoa >=quantile(pfas.ph...
2018 Apr 19
0
create multiple categorical variables in a data frame using a loop
> On Apr 19, 2018, at 11:20 AM, Ding, Yuan Chun <ycding at coh.org> wrote:
>
> Hi All,
>
> I want to create a categorical variable, cat.pfoa, in the file of pfas.pheno (a data frame) based on log2pfoa values. I can do it using the following code.
>
> pfas.pheno <-within(pfas.pheno, {cat.pfoa<-NA
> cat.pfoa[pfas.pheno$log2pfoa <=quantile(pfas.pheno$log2pfoa,0.25, na.rm =T)]<-0
> cat.pfoa[pfas.pheno$log2pfoa >...
2018 Apr 20
1
create multiple categorical variables in a data frame using a loop
> On Apr 19, 2018, at 1:22 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
>
>> On Apr 19, 2018, at 11:20 AM, Ding, Yuan Chun <ycding at coh.org> wrote:
>>
>> Hi All,
>>
>> I want to create a categorical variable, cat.pfoa, in the file of pfas.pheno (a data frame) based on log2pfoa values. I can do it using the following code.
>>
>> pfas.pheno <-within(pfas.pheno, {cat.pfoa<-NA
>> cat.pfoa[pfas.pheno$log2pfoa <=quantile(pfas.pheno$log2pfoa,0.25, na.rm =T)]<-0
>> cat.pfoa[pfas.phen...
2018 Apr 19
0
create multiple categorical variables in a data frame using a loop
...e could be
pfas.pheno[[cat.var]] <- NA
pfas.pheno[[cat.var]][pfas.pheno[,i] <= quantile(pfas.pheno[,i],0.25,
na.rm =T)] <- 0
etc.
Untested.
Hope this helps,
Rui Barradas
On 4/19/2018 7:20 PM, Ding, Yuan Chun wrote:
> Hi All,
>
> I want to create a categorical variable, cat.pfoa, in the file of pfas.pheno (a data frame) based on log2pfoa values. I can do it using the following code.
>
> pfas.pheno <-within(pfas.pheno, {cat.pfoa<-NA
> cat.pfoa[pfas.pheno$log2pfoa <=quantile(pfas.pheno$log2pfoa,0.25, na.rm =T)]<-0
> cat.pfoa[pfas.pheno$log2pfoa...