Re: [R] the opposite of pluck() in purrr

2021-11-18 Thread Avi Gross via R-help
As noted, this is not the place to ask about dplyr but the answer you may want is perhaps straight R. If you have a list called weekdays and you know you o not want to take the fifth, then indexing with -5 removes it: > weekdays <- list("Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat") > weekdays[

Re: [R] the opposite of pluck() in purrr

2021-11-18 Thread Rolf Turner
On Thu, 18 Nov 2021 16:40:14 -0500 "Christopher W. Ryan via R-help" wrote: > I've just learned about pluck() and chuck() in the purrr package. Very > cool! As I understand it, they both will return one element of a > list, either by name or by [[]] index, or even "first" or "last" > > I was

Re: [R] the opposite of pluck() in purrr

2021-11-18 Thread Bert Gunter
tidyverse is an RStudio ecosystem of packages -- it is not part of R's "standard" package distro, so as the posting guide linked below says: "For questions about functions in standard packages distributed with R (see the FAQ Add-on packages in R

[R] the opposite of pluck() in purrr

2021-11-18 Thread Christopher W. Ryan via R-help
I've just learned about pluck() and chuck() in the purrr package. Very cool! As I understand it, they both will return one element of a list, either by name or by [[]] index, or even "first" or "last" I was hoping to find a way to return all *but* one specified element of a list. Speaking loosel

Re: [R] Merge column with characters

2021-11-18 Thread Jim Lemon
Hi RosalinaZakaria, Talk about using a sledgehammer to crack a nut. In your example the two objects are character vectors. How about: dt_comb1gd <-paste0(dtpaigd,dtpmgd) Jim On Fri, Nov 19, 2021 at 2:15 AM ROSLINAZAIRIMAH BINTI ZAKARIA . wrote: > > Dear all, > > I try to merge two columns consi

Re: [R] Merge column with characters

2021-11-18 Thread Rui Barradas
Hello, Use an index giving the "" positions. i <- nchar(dtpmgd) == 0L dtpmgd[i] <- dtpaigd[i] Or, in one line, dtpmgd[nchar(dtpmgd) == 0L] <- dtpaigd[nchar(dtpmgd) == 0L] Hope this helps, Rui Barradas Às 07:02 de 18/11/21, ROSLINAZAIRIMAH BINTI ZAKARIA . escreveu: Dear all, I try t

Re: [R] Help with strange RGui behavior? Will not consistently run source.

2021-11-18 Thread Stephen Hartley
I haven't been able to get remote desktop working, I suspect it's disabled for security reasons. Any other thoughts/suggestions? On Thu, Nov 18, 2021 at 2:22 AM Mark Fowler wrote: > Hi, > > > > This issue bears some similarity to a problem I’ve been experiencing over > the last few days. R 4.0.

Re: [R] Help with strange RGui behavior? Will not consistently run source.

2021-11-18 Thread Eric Berger
HI Stephen, The reason I suggested the test was that I had a real flakey and annoying GUI problem a couple of years ago. It had to do with selection by mouse etc. The IT group could not reproduce the problem (when they connected remotely) and I realized that when I worked from home I also avoided t

Re: [R] Help with strange RGui behavior? Will not consistently run source.

2021-11-18 Thread Stephen Hartley
I have not tried that. I'm not certain if I have the permissions for remote desktop, but I will find out and give it a shot if possible. On Wed, Nov 17, 2021, 12:04 PM Eric Berger wrote: > Hi Stephen, > Does the problem still occur if you connect remotely to your computer from > a different comp

Re: [R] Merge column with characters

2021-11-18 Thread Micha Silver
On 18/11/2021 09:02, ROSLINAZAIRIMAH BINTI ZAKARIA . wrote: Dear all, I try to merge two columns consisting of characters using the 'coalesce' function from dplyr package. However, two data still have not merged, data no. 124 1nd 143. Any help is very much appreciated. I provide the data as fo

Re: [R] How to create a proper S4 class?

2021-11-18 Thread Martin Morgan
From my example, as(employees, "People") more general coercion is possible; see the documentation ?setAs. From your problem description I would have opted for the solution that you now have, with two slots rather than inheritance. Inheritance has a kind of weird contract when using another

[R] Merge column with characters

2021-11-18 Thread ROSLINAZAIRIMAH BINTI ZAKARIA .
Dear all, I try to merge two columns consisting of characters using the 'coalesce' function from dplyr package. However, two data still have not merged, data no. 124 1nd 143. Any help is very much appreciated. I provide the data as follows. > dput(dtpaigd) c("C+", "B+", "C+", "B+", "C+", "A-", "A

Re: [R] vectorization of loops in R

2021-11-18 Thread PIKAL Petr
Hi above tapply and aggregate, split *apply could be used) sapply(with(df, split(z, y)), mean) Cheers Petr > -Original Message- > From: R-help On Behalf Of Luigi Marongiu > Sent: Wednesday, November 17, 2021 2:21 PM > To: r-help > Subject: [R] vectorization of loops in R > > Hello, >