Re: [R] Confusing behaviour in data.table: unexpectedly changing variable

2013-09-25 Thread Jonathan Dushoff
Thanks for your help, and sorry for mis-posting. JD On Wed, Sep 25, 2013 at 3:18 AM, Matthew Dowle mdo...@mdowle.plus.com wrote: Very sorry to hear this bit you. If you need a copy of names before changing them by reference : oldnames - copy(names(DT)) This will be documented and

[R] Confusing behaviour in data.table: unexpectedly changing variable

2013-09-24 Thread Jonathan Dushoff
I got bitten badly when a variable I created for the purpose of recording an old set of names changed when I didn't think I was going near it. I'm not sure if this is a desired behaviour, or documented, or warned about. I read the data.table intro and the FAQ, and also ?setnames. Ben Bolker

[R] Selecting the non-attribute part of an object

2012-11-15 Thread Jonathan Dushoff
I have two matrices, generated by R functions that I don't understand. I want to confirm that they're the same, but I know that they have different attributes. If I want to compare the dimnames, I can say identical(attr(tm, dimnames), attr(tmm, dimnames)) [1] FALSE or even:

Re: [R] Selecting the non-attribute part of an object

2012-11-15 Thread Jonathan Dushoff
,check.attributes=FALSE) gives TRUE!!! I.e. sometimes attributes really are vital characteristics. cheers, Rolf Turner On 16/11/12 08:52, Jonathan Dushoff wrote: I have two matrices, generated by R functions that I don't understand. I want to confirm that they're the same, but I know

[R] Subsetting without partial matches

2009-01-31 Thread Jonathan Dushoff
David: Thank you for your very valuable response. In fact, I was trying to _avoid_ partial matching, not accomplish it. Subset is a _much_ better way of doing what I was trying to do. Humorously, however, your code also reproduces the mistake that brought me here, AFAICT. I think my code

[R] Subsetting without partial matches

2009-01-30 Thread Jonathan Dushoff
I have a list of observations of individuals. I would like to make a list of individuals, with a data frame of observations for each individual. The following code usually works, but not always -- # Make a list of empty data