I have list x and y; x unlists and gives me what I want... However, y does not I think it is because its a list from the biostrings package creating problems for me. I cannot include everything as this is biological data but I have tried to include some code and data to understand my problem.
Example of x ~ normal nested list
x1 = list(c(218,215, 212, 207, 189, 178, 163, 160, 154, 146, 140, 136, 112, 110, 89, 70, 68, 66, 62, 56, 52, 47, 34, 27, 9))
x2 = list(c(3, 1))
x<- list(c(x1,x2)
lapply(rapply(x, enquote, how="unlist"), eval)
[[1]]
[1] 218 215 212 207 189 178 163 160 154 146 140 136 112 110 89 70 68 66 62 56 52 47 34
[24] 27 9
[[2]]
[1] 3 1
unlisting works perfectly for x~
unlist(x)
[1] 218 215 212 207 189 178 163 160 154 146 140 136 112 110 89 70 68 66 62 56 52 47 34
[24] 27 9 3 1
I cannot provide all of the code to show an example of y, as its biological data and 300 lines of code. Basically, it is based on cross-referencing a GRAnge objects. I am finding overlaps with my data and a reference genome.
List Y
y = CPGi_Pos2[1:2]
> y
$`1`
[1] 172 167 163 157 153 151 149 79 73
$`2`
[1] 418 404 403 392 391 389 388 371 370 352 351 349 348 339 338 332
class(y)
[1] "list"
unlist(y)
11 12 13 14 15 16 17 18 19 21 22 23 24 25 26 27 28 29 210 211 212 213 214 215
172 167 163 157 153 151 149 79 73 418 404 403 392 391 389 388 371 370 352 351 349 348 339 338
216
332
str(x)
List of 13833
$ 1 : int [1:9] 172 167 163 157 153 151 149 79 73
$ 2 : int [1:16] 418 404 403 392 391 389 388 371 370 352 ...
I need to remove the names attached to list y as seen below. I want to unlist y and have it look like x
> str(x)
int [1:1009322] 218 215 212 207 189 178 163 160 154 146 ...
> str(y)
Named int [1:745078] 172 167 163 157 153 151 149 79 73 418 ...
- attr(*, "names")= chr [1:745078] "11" "12" "13" "14" ...