Re: [R] Extract

2024-07-22 Thread CALUM POLWART
But have we lured you to the dark side with the tidyverse yet ;-) On Mon, 22 Jul 2024, 15:22 Bert Gunter, wrote: > Thanks. > > I found this to be quite informative and a nice example of how useful > R-Help can be as a resource for R users. > > Best, > Bert > > On Mon, Jul 22, 2024 at 4:50 AM G

Re: [R] Extract

2024-07-22 Thread Gabor Grothendieck
I had missed that one can pass fix.empty.names = TRUE to transform and if we do that then we can put an unnamed data.frame in transform like we can with mutate so making that change we have the following base R solution where there is an inner nested pipeline within the outer pipeline as with the d

Re: [R] Extract

2024-07-22 Thread Bert Gunter
Thanks. I found this to be quite informative and a nice example of how useful R-Help can be as a resource for R users. Best, Bert On Mon, Jul 22, 2024 at 4:50 AM Gabor Grothendieck wrote: > > Base R. Regarding code improvements: > > 1. Personally I find (\(...) ...)() notation hard to read (alt

Re: [R] Extract

2024-07-22 Thread avi.e.gross
Excellent message, Gabor. Many tools we use are quite flexible and I just want to mention dplyr does have ways to use something like mutate to rename a column, albeit rename(0 is more specifically designed to do the job. Here is an example of how mutate() can rename by making a new column and

Re: [R] Extract

2024-07-22 Thread Gabor Grothendieck
Base R. Regarding code improvements: 1. Personally I find (\(...) ...)() notation hard to read (although by placing (\(x), the body and )() on 3 separate lines it can be improved somewhat). Instead let us use a named function. The name of the function can also serve to self document the code. 2.