Displaying 6 results from an estimated 6 matches for "saveat".
Did you mean:
caveat
2019 Nov 03
5
Puzzled about a new method for "[".
...ibutes of the
columns, including attributes that my code had created.
I thrashed around for quite a while, and then got some help from Rui
Barradas who showed me how to do it, in the following manner:
`[.myclass` <- function(x, i, j, drop = if (missing(i)) TRUE else
length(cols) == 1)[{
SaveAt <- lapply(x, attributes)
x <- NextMethod()
lX <- lapply(names(x),function(nm, x, Sat){
attributes(x[[nm]]) <- Sat[[nm]]
x[[nm]]}, x = x, Sat = SaveAt)
names(lX) <- names(x)
x <- as.data.frame(lX)
x
}
If I set class(X) <- c("myclass",cl...
2019 Nov 03
2
Puzzled about a new method for "[".
...d created.
>>
>> I thrashed around for quite a while, and then got some help from Rui
>> Barradas who showed me how to do it, in the following manner:
>>
>> `[.myclass` <- function(x, i, j, drop = if (missing(i)) TRUE else
>> length(cols) == 1)[{
>> ???? SaveAt <- lapply(x, attributes)
>> ???? x <- NextMethod()
>> ???? lX <- lapply(names(x),function(nm, x, Sat){
>> ?????? attributes(x[[nm]]) <- Sat[[nm]]
>> ?????? x[[nm]]}, x = x, Sat = SaveAt)
>> ???? names(lX) <- names(x)
>> ???? x <- as.data.frame(l...
2019 Nov 03
0
Puzzled about a new method for "[".
...attributes that my code had created.
>
> I thrashed around for quite a while, and then got some help from Rui
> Barradas who showed me how to do it, in the following manner:
>
> `[.myclass` <- function(x, i, j, drop = if (missing(i)) TRUE else
> length(cols) == 1)[{
> SaveAt <- lapply(x, attributes)
> x <- NextMethod()
> lX <- lapply(names(x),function(nm, x, Sat){
> attributes(x[[nm]]) <- Sat[[nm]]
> x[[nm]]}, x = x, Sat = SaveAt)
> names(lX) <- names(x)
> x <- as.data.frame(lX)
> x
> }
&g...
2019 Nov 04
0
Puzzled about a new method for "[".
...ng attributes that my code had created.
>
> I thrashed around for quite a while, and then got some help from Rui
> Barradas who showed me how to do it, in the following manner:
>
> `[.myclass` <- function(x, i, j, drop = if (missing(i)) TRUE else
> length(cols) == 1)[{
> SaveAt <- lapply(x, attributes)
> x <- NextMethod()
> lX <- lapply(names(x),function(nm, x, Sat){
> attributes(x[[nm]]) <- Sat[[nm]]
> x[[nm]]}, x = x, Sat = SaveAt)
> names(lX) <- names(x)
> x <- as.data.frame(lX)
> x
> }
>
>...
2019 Nov 04
0
Puzzled about a new method for "[".
...gt;> I thrashed around for quite a while, and then got some help from Rui
>>> Barradas who showed me how to do it, in the following manner:
>>>
>>> `[.myclass` <- function(x, i, j, drop = if (missing(i)) TRUE else
>>> length(cols) == 1)[{
>>> ???? SaveAt <- lapply(x, attributes)
>>> ???? x <- NextMethod()
>>> ???? lX <- lapply(names(x),function(nm, x, Sat){
>>> ?????? attributes(x[[nm]]) <- Sat[[nm]]
>>> ?????? x[[nm]]}, x = x, Sat = SaveAt)
>>> ???? names(lX) <- names(x)
>>>...
2019 Nov 04
3
Puzzled about a new method for "[".
On 5/11/19 3:41 AM, Hadley Wickham wrote:
> For what it's worth, I don't think this strategy can work in general,
> because a class might have attributes that depend on its data/contents
> (e.g. https://vctrs.r-lib.org/articles/s3-vector.html#cached-sum). I
> don't think these are particularly common in practice, but it's
> dangerous to assume that you can restore a