Re: [R] how to find "first" or "last" record after sort in R

2021-09-09 Thread Avi Gross via R-help
I am sure there are many good ways to do the task including taking the data.frame out into a list of data.frames and making the change to each by taking the nth row that matches nrow(it) and changing it and then recombining. What follows are several attempts leading up to one at the end I find i

Re: [R] how to find "first" or "last" record after sort in R

2021-09-09 Thread Bert Gunter
Sorry, that should be > id <- c(1,2,2,2,3,4,5,5) > last.index <- cumsum(rle(id)$lengths) > last.index [1] 1 4 5 6 8 of course. Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom Count

Re: [R] how to find "first" or "last" record after sort in R

2021-09-09 Thread Bert Gunter
Many ways to do this, of course, but if I understand correctly ?rle may be the simplest, because you already have the data sorted by ID. The following little example should give you the idea. It gets the index of the last row in each id,, which you can then use to assign NA's or whatever: > id <-

[R] how to find "first" or "last" record after sort in R

2021-09-09 Thread Kai Yang via R-help
Hello List, Please look at the sample data frame below: ID         date1              date2             date3 1    2015-10-08    2015-12-17    2015-07-23 2    2016-01-16    NA                 2015-10-08 3    2016-08-01    NA                 2017-01-10 3    2017-01-10    NA                 2016-01

Re: [R] Windows installation failed testing

2021-09-09 Thread Duncan Murdoch
On 09/09/2021 11:55 a.m., mario.corr...@croalliance.com wrote: Dear all Our IT has installed R on a Windows PC following the manual instruction. The installation was validated as in manual §3.3. "Testing an installation", by using the commands Sys.setenv(LC_COLLATE = "C", LANGUAGE = "en") libr

[R] Windows installation failed testing

2021-09-09 Thread mario.corrado
Dear all Our IT has installed R on a Windows PC following the manual instruction. The installation was validated as in manual §3.3. "Testing an installation", by using the commands Sys.setenv(LC_COLLATE = "C", LANGUAGE = "en") library("tools") testInstalledBasic("both") testInstalledPackages(sco