[R] Retaining attributes of columns of a data frame when subsetting.

Rolf Turner r@turner @end|ng |rom @uck|@nd@@c@nz
Sun Oct 20 04:13:32 CEST 2019


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,]
> should work.

Yes.  That idea does indeed look promising.  I'll check it out.
Thanks.

cheers,

Rolf

-- 
Honorary Research Fellow
Department of Statistics
University of Auckland
Phone: +64-9-373-7599 ext. 88276



More information about the R-help mailing list