Hi,
I've run into a ridiculous problem I can't find any solutions for in the
archives or help pages:
data(barley)
cutYield - with(barley, by(yield, variety, cut, breaks = c(0, 30, 60, 90)))
As in this example, I'm using 'by' to return a factor for each level of
another factor. The problem is
Is this ok or is it what you are trying to avoid:
factor(unlist(lapply(cutYield, as.character)))
On 3/15/06, Sebastian Luque [EMAIL PROTECTED] wrote:
Hi,
I've run into a ridiculous problem I can't find any solutions for in the
archives or help pages:
data(barley)
cutYield -
Gabor Grothendieck [EMAIL PROTECTED] wrote:
Is this ok or is it what you are trying to avoid:
factor(unlist(lapply(cutYield, as.character)))
Thank you Gabor. The problem with that is what if some levels do not
appear in any member of cutYield? In that case, the factor created above
would
Since all components of cutYield have the same levels, one
could do this to ensure that all levels are represented:
factor(unlist(lapply(cutYield, as.character)), levels = levels(cutYield[[1]]))
On 3/15/06, Sebastian Luque [EMAIL PROTECTED] wrote:
Gabor Grothendieck [EMAIL PROTECTED] wrote:
Sebastian Luque [EMAIL PROTECTED] wrote:
Gabor Grothendieck [EMAIL PROTECTED] wrote:
Is this ok or is it what you are trying to avoid:
factor(unlist(lapply(cutYield, as.character)))
Thank you Gabor. The problem with that is what if some levels do not
appear in any member of cutYield?
On 3/15/06, Sebastian Luque [EMAIL PROTECTED] wrote:
Sebastian Luque [EMAIL PROTECTED] wrote:
Gabor Grothendieck [EMAIL PROTECTED] wrote:
Is this ok or is it what you are trying to avoid:
factor(unlist(lapply(cutYield, as.character)))
Thank you Gabor. The problem with that is what if