[R] Fwd: Extracting a particular column from list

2020-01-17 Thread Eric Berger
[Putting back onto r-help] You could try sapply() and lapply(). > e <- sapply( 1:length(u), function(i) u[[i]][1] ) > e # [1] "1" "a"(note that the integer 1 became a character string "1") > f <- lapply( 1:length(u), function(i) u[[i]][1] ) > f [[1]] [1] 1 [[2]] [1] "a" In this case sapply

Re: [R] Reporting missing dates

2020-01-17 Thread Jim Lemon
Hi Jeff, As I'm sure you realize, that only tells you whether a date is within the range that you have specified. Do you only want to find dates within a certain range: new_date<-as.Date("2020-01-10") new_date < min(d) | new_date > max(d) or maybe whether the text string specifying the date is

Re: [R] Extracting a particular column from list

2020-01-17 Thread Mark Leeds
I nominate the last sentence of Rolf's comment as a fortune. On Thu, Jan 16, 2020 at 3:48 PM Rolf Turner wrote: > > On 17/01/20 1:55 am, Rui Barradas wrote: > > > Hello, > > > > What column and what list? > > Please post a reproducible example, see the link at the bottom of this > > mail and [

Re: [R] Strange behaviour of R?

2020-01-17 Thread Sigbert Klinke
Hi, You probably have a function defined in your global environment that is named FUN and acts like mean. You are right. Thanks Sigbert -- https://hu.berlin/sk https://hu.berlin/mmstat3 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and m

Re: [R] Strange behaviour of R?

2020-01-17 Thread Duncan Murdoch
On 17/01/2020 2:33 a.m., Sigbert Klinke wrote: Hi, I wrote a function like test <- function(FUN, args) { print(FUN) FUN(args) } When I call it lieke this test(mean, 1:10) test(NULL, 1:10) then the second call still uses mean, although I set FUN to NULL. Is that ok? You probably hav

Re: [R] Strange behaviour of R?

2020-01-17 Thread Martin Maechler
> Sigbert Klinke > on Fri, 17 Jan 2020 09:21:59 +0100 writes: > Hi, > Am 17.01.20 um 08:42 schrieb Rainer M Krug: >> Not for me - macOS, R 3.6.2 > Sorry, I forgot to add: Ubuntu 18.04.3 LTS, R 3.6.2 Sorry but that's very hard to believe, i.e., that such fundamental R

Re: [R] citing old(er) versions of packages

2020-01-17 Thread Ivan Calandra
Dear Marc, Thank you, exactly what I needed! Best, Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567 Neuwied, Germany +49 (0) 2631 9772-243 https://www.r

Re: [R] Strange behaviour of R?

2020-01-17 Thread K. Elo
Hi, cannot reproduce, either, on my Linuxmint 19.3 + R 3.6.2. Here the outputs: --- snip --- > test(mean, 1:10) [1] 5.5 > test(NULL, 1:10) NULL Error in FUN(args) : could not find function "FUN" > test(mean, list(x=1:10, na.rm=TRUE)) [1] NA Warning message: In mean.default(args) : argument is n

Re: [R] Strange behaviour of R?

2020-01-17 Thread Sigbert Klinke
Hi, Am 17.01.20 um 08:42 schrieb Rainer M Krug: > Not for me - macOS, R 3.6.2 Sorry, I forgot to add: Ubuntu 18.04.3 LTS, R 3.6.2 Best Sigbert -- https://hu.berlin/sk https://hu.berlin/mmstat3 __ R-help@r-project.org mailing list -- To UNSUBSCRIBE a

Re: [R] Extracting a particular column from list

2020-01-17 Thread Jim Lemon
Good one. When I saw this thread beginning to lengthen, I thought: "Ask an unanswerable question and you get philosophy." Jim On Fri, Jan 17, 2020 at 6:10 PM Rui Barradas wrote: > > Hello, > > Inline. > > > Às 22:03 de 16/01/20, Mark Leeds escreveu: > > I nominate the last sentence of Rolf's co