You're not only removing a row of data, you are invoking the default
behavior of subset, which is to collapse the subsetted result to the
smallest possible type, which in this case is a vector. Vectors have
no rows, and thus no row names.
You need the drop=FALSE argument, as in
ENV <- ENV[-1, , drop=FALSE]
Sarah
On Fri, Feb 5, 2010 at 9:44 AM, Euan Reavie <euan.reavie at gmail.com>
wrote:> I find this odd because it doesn't appear to happen in larger datasets.
I
> have the following data set ENV with the first column set as row.names:
>
>> ENV
> ? ? ? ? TPlog
> 001S29H ?0.601
> 002S42H ?0.602
> 003S43S ?0.779
> 004S43S ?0.702
> 005S51H ?0.978
> 006S52P ?2.718
>
> If I apply > ENV <- ENV[-1,] ?# remove first row of data (right?)
> ...ENV comes back as:
>
> [1] 0.602 0.779 0.702 0.978 2.718
>
> So I am losing the row name info. I also notice that, if the first two
> values in the TPlog column are the same, both values are removed!
What's
> going on, and why does this same thing not happen in more complex datasets
> with more than one column of values?
>
> Many thanks - Euan.
--
Sarah Goslee
http://www.functionaldiversity.org