-oO
Da: Bert Gunter
Inviato: giovedì 15 dicembre 2022 18:31
A: Gerrit Eichner; Stefano Sofia
Cc: r-help@r-project.org
Oggetto: Re: [R] Get data from a list of data frames
Well, just for giggles, Gerrit's sol
.
>
> From: R-help on behalf of
> r-help-requ...@r-project.org
> Date: Friday, 16December, 2022 at 05:00
> To: r-help@r-project.org
> Subject: [EXTERNAL] R-help Digest, Vol 238, Issue 16
>
> Message: 1
> Date: Thu, 15 Dec 2022 13:52:35 +0000
> From: Stefano Sofia
Sofia
To: "r-help@R-project.org"
Subject: [R] Get data from a list of data frames
Message-ID:
Content-Type: text/plain; charset="utf-8"
Dear R-list users,
I have a list of n data frames built as follows:
Station1 <- data.frame(sensor = c("thermometer",
Well, just for giggles, Gerrit's solution can be easily vectorized (i.e. no
apply()-type stuff needed) IFF the structure of all the data frames are
identical so that rbind() works:
d <-do.call('rbind',Total[select.stat]) ## one data frame to combine them
all ;-)
d[d$sensor == 'thermometer','code']
Hello, Stefano,
maybe the following example contains what you want to achieve:
Station1 <- data.frame(sensor = c("thermometer", "raingauge",
"snowgauge", "anemometer"),
code = c(2583, 1478, 3178, NA))
Station2 <- data.frame(sensor = c("thermometer", "raingauge",
"snowga
Dear R-list users,
I have a list of n data frames built as follows:
Station1 <- data.frame(sensor = c("thermometer", "raingauge", "snowgauge",
"anemometer"), code = c(2583, 1478, 3178, NA))
Station2 <- data.frame(sensor = c("thermometer", "raingauge", "snowgauge",
"anemometer"), code = c(2584,
6 matches
Mail list logo