Question

I have a very big list file.dput() function for two of them is as below :

> dput(mydata).....  
      `NA` = c("SHC2", "GRB2", "HRAS", "KRAS", "NRAS", "SHC3", 
            "MAPK1", "MAPK3", "MAP2K1", "MAP2K2", "RAF1", "SHC1", "SOS1", 
            "YWHAB", "CDK1"), `NA` = c("NUP50", "NUPL2", "PSIP1", "NUP35", 
            "NUP205", "NUP210", "NUP188", "NUP62", "SLC25A4", "SLC25A5", 
            "SLC25A6", "HMGA1", "NUP43", "KPNA1", "NUP88", "NUP54", "NUP133", 
            "NUP107", "RANBP2", "LOC645870", "TPR", "NUP37", "NUP85", 
            "NUP214", "AAAS", "SEH1L", "RAE1", "BANF1", "NUP155", "NUP93", 
            "NUPL1", "POM121", "NUP153"), ....

I'm also have a file including names, but I can't assign it, names(mydata)<-list("a", "b")# clears former data and replaces with "a" and "b" names(mydata)<-c("a", "b")

I have tried using names(mydata) but it dosen't do what I need. I think "N" should be the name which I dont know how to access it. right? If yes what should I do? Regards**

Was it helpful?

Solution

I'm not sure what you are trying to do. If you want to name the elements of a list with the names from another file, here's how to do it:

x <- list (1,2,3,4,5)
y <- LETTERS [1:5]
names (x) <- y

OTHER TIPS

Thanks The problem was: I was using [[ ]] to recruit names but [] should be used for names:

x <- list (1,2,3,4,5)
y <- LETTERS [1:5]
names (x) <- y

> x[[1]]
[1] 1

> x[1]
$A
[1] 1

> x[2]
$B
[1] 2
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top