Re: [R] using eigen function in MAP and purr

2021-03-29 Thread John Fox
Dear V. K. Chetty, Perhaps I'm missing something but why wouldn't you just use a list of matrices, as in the following? -- snip - > set.seed(123) # for reproducibility > (Matrices <- lapply(1:3, function(i) matrix(sample(1:50, 4), 2, 2))) [[1]] [,1] [,2] [1,] 31 14

[R] using eigen function in MAP and purr

2021-03-29 Thread Veerappa Chetty
I want to use map and purr functions to compute eigen values for 3000 matrices. Each matrix has 2 rows and 2 columns. The following code does not work. test.dat<- tibble(ID=c(1,2),a=c(1,1),b=c(1,1),c=c(2,2),d=c(4,3)) test.out<-test.dat %>% nest(-ID) %>% mutate(fit = purrr::map(data,~ function(x)