I am having a heck of a time with factors injecting themselves in code where they are not preferred.
How do you remove all factors from a matrix? a vector? a data.frame?
Question update below
I thought the question would be general enough, but it is clearly not.
Factors creep in when using melt
so I am looking for a way to remove the factors after I have executed the melt command. As you see from the example code below, the factor approach (not sure what to call that) enters for column 3. I presume it is because this column is text. I need to remove this factor because I am retrieving data from a matrix so a factor of 3 is meaningless (in this scenario).
names(airquality) <- tolower(names(airquality))
data <- melt(airquality, id=c("month", "day"))
is.factor(data[,3])