[R] matrix -> delete last row -> list

Michael Sumner mdsumner at gmail.com
Sat Jul 4 13:12:13 CEST 2015


Well 'list' in R is pretty naturally the same as R's 'atomic vector' in
scads of languages. In R the term needs special care since it's still a
'vector'.

'Degenerate dimension' is probably a helpful phrase for understanding what
is happening here.

Cheers, Mike

On Saturday, July 4, 2015, Rolf Turner <r.turner at auckland.ac.nz> wrote:
> On 04/07/15 03:43, Sarah Goslee wrote:
>>
>> Hi,
>>
>> On Fri, Jul 3, 2015 at 10:33 AM, Zander, Joscha <joscha.zander at roche.com>
>> wrote:
>>>
>>> Good day R-community,
>>>
>>> i just wondered if it is a bug or a feature...
>>>
>>> When i have a matrix "mat" with one column and i delete the last row
with
>>>
>>> mat <- mat[-nrow(mat),] the result is a list.
>>
>> I have no idea how you're getting a list from a matrix (see below).
Perhaps
>> you mean a data frame?
>
> <SNIP>
>
> No.  The Zander person just means a vector.  Psigh.
>
> Note to the Zander person:  It is important in R programming to get your
concepts straight.  It is also important in communicating with others to
get your terminology straight.
>
> cheers,
>
> Rolf Turner
>
> --
> Technical Editor ANZJS
> Department of Statistics
> University of Auckland
> Phone: +64-9-373-7599 ext. 88276
>
> ______________________________________________
> R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Michael Sumner
Software and Database Engineer
Australian Antarctic Division
Hobart, Australia
e-mail: mdsumner at gmail.com

	[[alternative HTML version deleted]]



More information about the R-help mailing list