On 21/10/19 11:07 AM, Rui Barradas wrote:
Hello,
Sorry, you're right, in the method it's x, X is the test dataframe.
Repost:
`[.myclass` <- function(x, i, j, drop = if (missing(i)) TRUE else
length(cols) == 1){
SaveAt <- lapply(x, attributes)
x <- NextMethod()
lX <- lapply(names(x
Hello,
Sorry, you're right, in the method it's x, X is the test dataframe.
Repost:
`[.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]]) <
On 21/10/19 1:15 AM, Rui Barradas wrote:
Hello,
Richard's idea is good but shouldn't it be `[.myclass` instead?
Yes, I kind of thought that, and cobbled together something on that
basis that seemed to work. However my code was rather a hodge-podge. I
kept having to work around errors th
Hello,
Richard's idea is good but shouldn't it be `[.myclass` instead?
`[.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]]
On 20/10/19 3:00 PM, Richard M. Heiberger wrote:
Look at
methods(as.data.frame)
Define your specialized columns to have a newly defined class, say "myclass".
Then write as.data.frame.myclass
It will be similar to the function you already have in the lapply statement.
Now your statement
X <- X[ok,
Look at
methods(as.data.frame)
Define your specialized columns to have a newly defined class, say "myclass".
Then write as.data.frame.myclass
It will be similar to the function you already have in the lapply statement.
Now your statement
X <- X[ok,]
should work.
Rich
On Sat, Oct 19, 2019 at 8:20
6 matches
Mail list logo