Re: [R] Help needed with aggregate or other solution

2017-10-25 Thread Jeff Newmiller
Thanks for the dput... reproducible example of split-apply-combine ### dta <- structure(list(date = structure(c(1L, 2L, 3L, 4L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 5L, 6L, 7L, 8L, 9L, 10L, 11L, 12L, 13L, 14L, 15L, 16L, 17L, 18L, 19L, 20L, 21L, 22L,

[R] Help needed with aggregate or other solution

2017-10-25 Thread Thomas Adams
Hello all! I've been struggling with is for many hours today; I'm close to getting what I want, but not close enough... I have a dataframe consisting of two date-time columns followed by two numeric columns. what I need is the max value (in the first numeric column) based on the 2nd date-time

Re: [R] Problem Subsetting Rows that Have NA's

2017-10-25 Thread John
On Tue, 24 Oct 2017 15:05:01 -0400 BooBoo wrote: > This has every appearance of being a bug. If it is not a bug, can > someone tell me what I am asking for when I ask for "x[x[,2]==0,]". > Thanks. > As others have pointed out not a bug, but very "unintuitively"

Re: [R-es] [Grupo de Usuarios de R de Madrid]: Próxima reunión jueves 19-octubre...

2017-10-25 Thread Carlos Ortega
Buenas a todos, El material de la reunión de ayer (presentaciones y videos) ya están disponibles aquí: http://madrid.r-es.org/46-martes-24-de-octubre-2017/ Gracias, Carlos Ortega www.qualityexcellence.es El 18 de octubre de 2017, 12:45, Carlos Ortega escribió: >

Re: [R] How to save and restore a workspace

2017-10-25 Thread MacQueen, Don
Saving your workspace means that the variables you currently have defined in your session [ everything that shows up when you type ls() ] are saved to a file, by default named “.RData”. To restore the workspace, you use the “Load Workspace” command and navigate to the (same) .RData file. Its

Re: [R] Problem Subsetting Rows that Have NA's

2017-10-25 Thread peter dalgaard
It's not a bug, and the rationale has been hashed over since the beginning of time... It is a bit of an annoyance in some contexts and part of the rationale for the existence of subset(). If you need an explanation, start with elementary vector indexing: colors <- c("red", "green", "blue")

Re: [R] Problem Subsetting Rows that Have NA's

2017-10-25 Thread David Winsemius
> On Oct 25, 2017, at 11:17 AM, David Winsemius wrote: > > >> On Oct 25, 2017, at 6:57 AM, BooBoo wrote: >> >> On 10/25/2017 4:38 AM, Ista Zahn wrote: >>> On Tue, Oct 24, 2017 at 3:05 PM, BooBoo wrote: This has

Re: [R] Problem Subsetting Rows that Have NA's

2017-10-25 Thread Bert Gunter
... Just to be clear: David's end summary "[" always returns a list. "[[" returns only one thing, but even that thing could be a list. Generally you want "[[" if you plan on testing for equality with a vector. applies to indexing on a **list**, of course, and not to vectors, matrices, etc.

Re: [R] Problem Subsetting Rows that Have NA's

2017-10-25 Thread David Winsemius
> On Oct 25, 2017, at 6:57 AM, BooBoo wrote: > > On 10/25/2017 4:38 AM, Ista Zahn wrote: >> On Tue, Oct 24, 2017 at 3:05 PM, BooBoo wrote: >>> This has every appearance of being a bug. If it is not a bug, can someone >>> tell me what I am asking

Re: [R] Problem Subsetting Rows that Have NA's

2017-10-25 Thread BooBoo
On 10/25/2017 4:38 AM, Ista Zahn wrote: On Tue, Oct 24, 2017 at 3:05 PM, BooBoo wrote: This has every appearance of being a bug. If it is not a bug, can someone tell me what I am asking for when I ask for "x[x[,2]==0,]". Thanks. You are asking for elements of x where

Re: [R] as.data.frame doesn't set col.names

2017-10-25 Thread Duncan Murdoch
On 25/10/2017 8:15 AM, Eric Berger wrote: Hi Peter, Thanks for contributing such a great answer. Can you please provide a pointer to the documentation where it explains why dd$B <- s and dd["B"] <- s have such different behavior? See Introduction to R, sections 6.1 (Lists) and 6.3 (Data

Re: [R] as.data.frame doesn't set col.names

2017-10-25 Thread Eric Berger
Hi Peter, Thanks for contributing such a great answer. Can you please provide a pointer to the documentation where it explains why dd$B <- s and dd["B"] <- s have such different behavior? (I am perfectly happy if you write the explanation but if it saves you time to point to some reference that

Re: [R] as.data.frame doesn't set col.names

2017-10-25 Thread Peter Dalgaard
> On 24 Oct 2017, at 22:45 , David L Carlson wrote: > > You left out all the most important bits of information. What is yo? Are you > trying to assign a data frame to a single column in another data frame? > Printing head(samples) tells us nothing about what data types you

Re: [R] Problem Subsetting Rows that Have NA's

2017-10-25 Thread Ista Zahn
On Tue, Oct 24, 2017 at 3:05 PM, BooBoo wrote: > This has every appearance of being a bug. If it is not a bug, can someone > tell me what I am asking for when I ask for "x[x[,2]==0,]". Thanks. You are asking for elements of x where the second column is equal to zero.