[R] initiate elements in a dataframe with lists

Bogdan Tanasa t@n@@@ @ending from gm@il@com
Wed Jul 25 08:55:10 CEST 2018

Dear all,

assuming that I do have a dataframe like :

x <- data.frame(TYPE=c("DEL", "DEL", "DUP", "TRA", "INV", "TRA"),
CHRA=c("chr1", "chr1", "chr1", "chr1", "chr2", "chr2"),
POSA=c(10, 15, 120, 340, 100, 220),
CHRB=c("chr1", "chr1", "chr1", "chr2", "chr2", "chr1"),
POSB=c(30, 100, 300, 20, 200, 320)) ,

how could I initiate another 2 columns in x, where each element in these 2
columns is going to be a list (the list could be updated later). Thank you !

Shall I do,

for (i in 1:dim(x)[1]) { x$intersectA[i] <- list()}

for (i in 1:dim(x)[1]) { x$intersectB[i] <- list()}

nothing is happening. Thank you very much !

	[[alternative HTML version deleted]]

More information about the R-help mailing list