Alex Levitchi wrote:
Hello I am very thankful for the reply from Jim Holtman and David Winsemius, especially for the understandable explanations. it really works. Now I get another problem I cannot figure out. That is the situation: I work in biology. I need to download several files according to an experiment, which can be find out in NCBI GEO, and store them. For this I use GEOquery package and getGEO function. Each experiment (named GSE) contains several Samples (GSM), which names I extract by names(GSMList()). So now I want to make association between the defined names, which represents lowercases names of GSM, having them from names(GSMList()) as class(names(GSMList(gse))) [1] "character" I wrote something like this lapply=(i=1:length(names(GSMList(gse))), lgsms[i]=getGEO(names(GSMList(gse))[i]))
Hi Alex,

please read the lapply documentation carefully, don't guess the correct syntax. But after looking at the docs of lapply, the examples aren't very clear. The correct syntax is somewhere along the lines of this:

geo_list = lapply(names(GSMList), function(name) {
        return(getGEO(name) )
 })

you can read this piece code aloud like, "for all names in GSMList do the function getGEO and return the results in a list".

cheers,
Paul
but "Error: unexpected ',' " or anything else if I try to make it directly by associating a name from the list to correspondent GEO file I get this lgsms[1]=getGEO(names(GSMList(gse))[1]) #lgsms - list of lowercases names from names(GSMList()) File stored at: /tmp/RtmpgnMuHv/GSM296650.soft # so it downloaded the file but didn't make the association with the name so I cannot use it. Error in lgsms[1] = getGEO(names(GSMList(gse))[1]) : incompatible types (from S4 to character) in subassignment type fix Generally, working with GEOquery should be done very careful, as previously I also have some problems regarding the characteristics of data extracted from it and the way to convert them in an affordable way. It is a pity, that authors don't give more explanations on it. So I suppose it is also here. Kind regards Alex Levitchi

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


--
Drs. Paul Hiemstra
Department of Physical Geography
Faculty of Geosciences
University of Utrecht
Heidelberglaan 2
P.O. Box 80.115
3508 TC Utrecht
Phone:  +3130 274 3113 Mon-Tue
Phone:  +3130 253 5773 Wed-Fri
http://intamap.geo.uu.nl/~paul

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to