list - How to get count of items in this data structure when label missing in R? -


i want count of significant items 60, can see when str(res.r) see following fields not have name refer. normally, data made data.frame(v1, v2), res.r$v1 here cannot. tried unsuccessfully res.r$1.

#  ..$ : chr [1:60] "cyl" "disp" "hp" "wt" ... #  ..$ : chr [1:2] "row" "col" 

minimal example

referring lista[[1]] works simplest example

lista <- c( list(seq(1,5)), list(seq(1,7)) )  str(lista)  str(lista[[1]]) #list of 2 # $ : int [1:5] 1 2 3 4 5 # $ : int [1:7] 1 2 3 4 5 6 7 # int [1:5] 1 2 3 4 5 

code

referring res.r[[1]] not work here expected

library("corrplot") library("psych") library("gplots")  m.cor <- cor(mtcars) p.mat <- psych::corr.test(m.cor, adjust = "none", ci = f) alpha <- .0000005 plt.r <- corrplot(m.cor,                 method = "color",                 type = "upper",                 tl.col = 'black',                 diag = true,                 p.mat = p.mat[["r"]],                 sig.level = alpha,                  main = "r",                  mar=c(0,0,1,0), # stackoverflow.com/a/14754408/…                 )  # http://stackoverflow.com/a/40523080/54964 res.r <- which(p.mat[["r"]] < alpha, arr.ind = true) str(res.r)  # todo here - how count of significant item num 

output

#attaching package: ‘gplots’  #the following object masked ‘package:stats’:  #    lowess  # int [1:60, 1:2] 2 3 4 6 11 1 5 7 8 9 ... # - attr(*, "dimnames")=list of 2 #  ..$ : chr [1:60] "cyl" "disp" "hp" "wt" ... #  ..$ : chr [1:2] "row" "col" 

expected output: num of significant items, here 60

r: 3.3.1
os: debian 8.5

the data structure matrix, not list of lists although looks that.

str(nrow(res.r))  str(ncol(res.r)) 

output

attaching package: ‘gplots’  following object masked ‘package:stats’:      lowess   int [1:60, 1:2] 2 3 4 6 11 1 5 7 8 9 ...  - attr(*, "dimnames")=list of 2   ..$ : chr [1:60] "cyl" "disp" "hp" "wt" ...   ..$ : chr [1:2] "row" "col"  int 2  int 3  int 60  int 2 

Comments

Popular posts from this blog

php - How to display all orders for a single product showing the most recent first? Woocommerce -

asp.net - How to correctly use QUERY_STRING in ISAPI rewrite? -

angularjs - How restrict admin panel using in backend laravel and admin panel on angular? -