I am trying to get these lists:
dim_29 <- list(c(114.49337, 20.29176, 390.74801, 592.75864))
dim_30 <- list(c(112.39257, 19.24136, 388.64721, 594.85944))
dim_31 <- list(c(112.39257, 19.24136, 402.30239, 589.60745))
dim_28 <- list(c(113.44297, 19.24136, 374.99204, 587.50665))
To do this:
> dim_28 <- unlist(dim_28)
> dim_28
[1] 113.44297 19.24136 374.99204 587.50665
> dim_28 <- paste(dim_28, sep = " ", collapse = ", ")
> dim_28
[1] "113.44297, 19.24136, 374.99204, 587.50665"
by using a loop or some other way to automate the process with all the lists. What loop would I have to write to accomplish this or should I be using a differnet function? Any help would be great, thanks!
lapply/apply/sapply
family of functions, or newer libraries likepurrr
. This is a duplicate. Also, if you have a regularly-named and -indexed set of vectors of the same length, why not just use a matrix, and index into its n'th row? Much more performant than lists.