Displaying 4 results from an estimated 4 matches for "log2me_pfosa_acoh".
Did you mean:
log2et_pfosa_acoh
2018 Apr 20
1
create multiple categorical variables in a data frame using a loop
...er, I have additional 7 similar variables, so I wrote the following code, but it does not work.
>>
>> for (i in c("log2pfoa","log2pfos", "log2pfna", "log2pfdea", "log2pfuda", "log2pfhxs", "log2et_pfosa_acoh", "log2me_pfosa_acoh")) {
>> cat.var <- paste0("cat.",i)
>> pfas.pheno <- within(pfas.pheno, {eval(parse(text= cat.var))<-NA
>
> Nope. Cannot use R like a macro processor, at least not easily. R names are not the same as character vlaues. They "live in different realitie...
2018 Apr 19
4
create multiple categorical variables in a data frame using a loop
...]<-1
}
However, I have additional 7 similar variables, so I wrote the following code, but it does not work.
for (i in c("log2pfoa","log2pfos", "log2pfna", "log2pfdea", "log2pfuda", "log2pfhxs", "log2et_pfosa_acoh", "log2me_pfosa_acoh")) {
cat.var <- paste0("cat.",i)
pfas.pheno <- within(pfas.pheno, {eval(parse(text= cat.var))<-NA
eval(parse(text=cat.var))[pfas.pheno[,i] <= quantile(pfas.pheno[,i],0.25, na.rm =T)] <- 0
eval(parse(text=cat.var))[pfas.pheno[,i] >= quantile(pfas.pheno[,i],0.75, na....
2018 Apr 19
0
create multiple categorical variables in a data frame using a loop
...t; However, I have additional 7 similar variables, so I wrote the following code, but it does not work.
>
> for (i in c("log2pfoa","log2pfos", "log2pfna", "log2pfdea", "log2pfuda", "log2pfhxs", "log2et_pfosa_acoh", "log2me_pfosa_acoh")) {
> cat.var <- paste0("cat.",i)
> pfas.pheno <- within(pfas.pheno, {eval(parse(text= cat.var))<-NA
Nope. Cannot use R like a macro processor, at least not easily. R names are not the same as character vlaues. They "live in different realities". The `get`...
2018 Apr 19
0
create multiple categorical variables in a data frame using a loop
...t; However, I have additional 7 similar variables, so I wrote the following code, but it does not work.
>
> for (i in c("log2pfoa","log2pfos", "log2pfna", "log2pfdea", "log2pfuda", "log2pfhxs", "log2et_pfosa_acoh", "log2me_pfosa_acoh")) {
> cat.var <- paste0("cat.",i)
> pfas.pheno <- within(pfas.pheno, {eval(parse(text= cat.var))<-NA
> eval(parse(text=cat.var))[pfas.pheno[,i] <= quantile(pfas.pheno[,i],0.25, na.rm =T)] <- 0
> eval(parse(text=cat.var))[pfas.pheno[,i] >= quantile(pfas...