search for: reclasses

Displaying 10 results from an estimated 10 matches for "reclasses".

Did you mean: regclasses
2009 Dec 04
2
Class attributes
Dear R forum, I want to replace all the elements in a data frame (dd) which match the character "x" with "0". What's the most elegant way of doing this (there must be an easy way which I've missed)? I settled on the following loop: >for(i in 5:12){ # These are the column of dd I am interested in >dd[which(dd[,i]=="x"),i]<-0 >} The
2023 Apr 28
2
range() for Date and POSIXct could respect `finite = TRUE`
...; "2019-01-09" #> [6] "2019-01-10" "2019-01-11" "2019-01-12" "2019-01-13" "2019-01-14" ``` It seems like one option is to create a `range.Date()` method that unclasses, forwards the arguments on to a second call to `range()`, and then reclasses? ``` range.Date <- function(x, ..., na.rm = FALSE, finite = FALSE) { .Date(range(unclass(x), na.rm = na.rm, finite = finite), oldClass(x)) } ``` This is similar to how `rep.Date()` works. Thanks, Davis Vaughan
2004 Mar 15
2
R equiv to proc gremove in maps package
Is there an R equivalent to SAS's proc gremove? You would use this procedure to combine the units on an existing map, for example to build a map of Metropolitan Statistical Areas (MSAs) from the [US] counties dataset where the internal boundries surround the MSAs (which are groups of counties) rather than the individual counties. I can imagine the mechanism would be to find and erase the
2023 Apr 28
1
range() for Date and POSIXct could respect `finite = TRUE`
...#> [6] "2019-01-10" "2019-01-11" "2019-01-12" "2019-01-13" "2019-01-14" > ``` > > It seems like one option is to create a `range.Date()` method that > unclasses, forwards the arguments on to a second call to `range()`, > and then reclasses? > > ``` > range.Date <- function(x, ..., na.rm = FALSE, finite = FALSE) { > .Date(range(unclass(x), na.rm = na.rm, finite = finite), oldClass(x)) > } > ``` > > This is similar to how `rep.Date()` works. > > Thanks, > Davis Vaughan > > ___________________...
2019 Mar 26
0
Discrepancy between is.list() and is(x, "list")
Hi Abs, Lets try to remain civil even when disagreeing about major design philosophies, ok? On Tue, Mar 26, 2019 at 2:08 PM Abs Spurdle <spurdle.a at gmail.com> wrote: > If I can merge this thread with the one I started yesterday... > > > "If the object does not have a class attribute, it has an implicit > class..." > > which I take to mean that if an object
2023 May 19
1
range() for Date and POSIXct could respect `finite = TRUE`
...; >> >> >> > >> >> >> > It seems like one option is to create a `range.Date()` > >> >> >> > method that unclasses, forwards the arguments on to a > >> >> >> > second call to `range()`, and then reclasses? > >> >> >> > >> >> >> > ``` range.Date <- function(x, ..., na.rm = FALSE, finite = > >> >> >> > FALSE) { .Date(range(unclass(x), na.rm = na.rm, finite = > >> >> >> > finite), oldClass(x)...
2019 Mar 26
4
Discrepancy between is.list() and is(x, "list")
If I can merge this thread with the one I started yesterday... > "If the object does not have a class attribute, it has an implicit class..." > which I take to mean that if an object does have a class attribute it does not also have an implicit class. > I think this is reasonable behavior. Consider the "Date" class, which stores values as "numeric": >
2009 Mar 10
4
puzzled by math on date-time objects
Hi, I don't understand the following. When I create a small artificial set of date information in class POSIXct, I can calculate the mean and the median: a = as.POSIXct(Sys.time()) a = a + 60*0:10; a [1] "2009-03-10 11:30:16 EDT" "2009-03-10 11:31:16 EDT" "2009-03-10 11:32:16 EDT" [4] "2009-03-10 11:33:16 EDT" "2009-03-10 11:34:16
2011 Feb 08
4
manipulating the Date & Time classes
Hello, This is mostly to developers, but in case I missed something in my literature search, I am sending this to the broader audience. - Are there any plans in the works to make "time" classes a bit more friendly to the rest of the "R" world? I am not suggesting to allow for fancy functions to manipulate times, per se, or to figure out how to properly
2011 Feb 08
4
manipulating the Date & Time classes
Hello, This is mostly to developers, but in case I missed something in my literature search, I am sending this to the broader audience. - Are there any plans in the works to make "time" classes a bit more friendly to the rest of the "R" world? I am not suggesting to allow for fancy functions to manipulate times, per se, or to figure out how to properly