I'm trying to run this code for a for loop:
ifelse(split[[1]]$timeframe == 'post',
split[[1]]$prcntgwk <- 1,
split[[1]]$prcntgwk <- 2)
It basically is creating a calculation unless the value of column timeframe is 'post', then it will store an NA since the calculation is not applicable
This is my output:
> ifelse(split[[1]]$timeframe == 'post',
+ split[[1]]$prcntgwk <- 1,
+ split[[1]]$prcntgwk <- 2)
[1] 2 2 2 2 2 2 2 1
But then when I retrieve the column I get this:
> split[[1]]$prcntgwk
[1] 2 2 2 2 2 2 2 2
Why aren't my values being stored properly??? This makes absolutely no sense at all.
Aucun commentaire:
Enregistrer un commentaire