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, 23L
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 col
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"
explained in the documentation.
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 def
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")
col
> 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 every appearance of being a bug. If it is not a bug, can someone
tell m
... 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.
Che
> 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 for when I ask for "x[x[,2]==0,]". Thanks.
>> You
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 the second column is equal
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 frames)
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 wo
> 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 have,
> especially
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.
help("==")
and
help("[")
13 matches
Mail list logo