Thanx guys,
practical and effective solutions.
Gianandrea
glaporta wrote:
Hi,
sqldf is a fantastic package, but when the SELECT procedure runs unused
levels remain in the output. I tried with the drop function, but without
success. Do you have any suggestions?
Thanx, Gianandrea
Hi,
sqldf is a fantastic package, but when the SELECT procedure runs unused
levels remain in the output. I tried with the drop function, but without
success. Do you have any suggestions?
Thanx, Gianandrea
data(iris)
require(sqldf)
base-sqldf(select * from iris where Species 'setosa')
str(base)
If you want to suppress the unused level of Species, you can use factor() :
table(base$Species)
table(factor(base$Species))
2008/8/28 glaporta [EMAIL PROTECTED]
Hi,
sqldf is a fantastic package, but when the SELECT procedure runs unused
levels remain in the output. I tried with the drop
Here are two approaches:
1. rename the column to circumvent the column classing heuristic. In
the following
Species will be a 3-level factor and Species2 will be a 2-level factor
sqldf(select *, Species as Species2 from iris where Species 'setosa')
2. use method = raw. This code below
4 matches
Mail list logo