[R] Subsetting a data.frame degenerates at one column?

Allen S. Rout asr at ufl.edu
Mon Feb 11 21:27:07 CET 2008


"jim holtman" <jholtman at gmail.com> writes:

> try:

> input[,targets, drop=FALSE]

> see:

> ?"["

> for an explanation.


Thanks, you who responded; this was exactly helpful, and a good
reference to the part of the FM I was missing.  To unpack (and
demonstrate some comprehension gained.. ;) the subsetting operations
on data frames, by default, use the most basic data type capable of
representing the answer.  

Either the drop=FALSE or the inputs[targets] solution give me the
result I had in mind.  I mildly prefer the [targets] statement from a
visual perspective.





- Allen S. Rout



More information about the R-help mailing list