Convert all matrices in a list to data.frames in R

时间:2017-12-18 08:38:00

标签: r list dataframe matrix

I have the output of QOverload function in lme.

R

As you see, some elements of the output (library(nlme) fm2 <- lme(distance ~ age + Sex, data = Orthodont, random = ~ 1) str(fm2) ) are matrices e.g. fm2

I am looking for a function to accept an object and convert all submatrices into fm2$varFix.

1 个答案:

答案 0 :(得分:6)

也许是这样的:

System.Diagnostics.Debug.Print(Categories.Where(x => x.Id == value.Id).FirstOrDefault().Description);

Categories.Where(x => x.Id == value.Id).FirstOrDefault().Description = "Stackoverflow";

System.Diagnostics.Debug.Print(Categories.Where(x => x.Id == value.Id).FirstOrDefault().Description);

编辑:虽然这个答案已被接受,但我对解决方案不满意,因为它不会递归地转换列表中的矩阵,并且元素的属性会丢失。我相信以下解决方案可以解决这两个问题:

CreatedExpiryPolicy