[R] Directory operations
Don MacQueen
macq at llnl.gov
Mon Jan 11 16:37:27 CET 2010
To initialize an list:
> foo <- list()
## and then extend it as in your code
> foo <- c(foo, list(x=1))
> foo
$x
[1] 1
> foo <- c(foo, list(y=1))
> foo
$x
[1] 1
$y
[1] 1
At 7:16 PM +0530 1/10/10, anupam sinha wrote:
>Hi Uwe,
> Thanks for your suggestion . Here's my code. I am confused as
>to how to initialize an empty list . Here I have used pairlist()
>
>
> *list.files()->org_xml_dirs
> for (i in org_xml_dirs)
>{
> setwd(file.path("/home/anupam/Research/Anupam_data/ORG_XML_FILES/",i))
> org_xml<-list.files()
> for(j in org_xml)
> {
> graph_list<-pairlist()
> graph<-parseKGML2Graph(j,genesOnly=TRUE)
> graph_list<-c(graph_list,list(graph))
> }
> org_met_net<-mergeKEGGgraphs(graph_list)
> met_org<-igraph.from.graphNEL(org_met_net,name=TRUE)
>
>write.graph(met_org,"/home/anupam/Research/Anupam_data/ORG_XML_FILES/i.metnet",format=c("NCOL"))
> }
>*
>This is giving an error:
>
>Error in UseMethod("xmlAttrs", node) :
> no applicable method for "xmlAttrs"
>
>I apologise for asking a Bioconductor list related question on this list.
>Can you figure out the problem ? Thanks in advance.
>
>
>Regards,
>
>Anupam
>
>
>On Sun, Jan 10, 2010 at 12:54 AM, Uwe Ligges <
>ligges at statistik.tu-dortmund.de> wrote:
>
>>
>>
>> On 09.01.2010 19:04, anupam sinha wrote:
>>
>>> Hi Jim,
>>> Thanks for your suggestion. I tried scripting but gives me an
>>> error. Can you tell me what am I doing wrong here ?
>>>
>>>
>>> *> list.files()->org_xml_dirs
>>>
>>
>> Please do turn that arrow around....
>>
>>
>> for (i in org_xml_dirs){
>>>>
>>> + setwd("/home/anupam/Research/Anupam_data/ORG_XML_FILES/i")}
>>>
>>
>>
>> There is no directory .../i
>> Your probably want:
>> setwd(file.path("/home/anupam/Research/Anupam_data/ORG_XML_FILES/", i))
>>
>> Uwe Ligges
> >
> >
> >
> >
> >> Error in setwd("/home/anupam/Research/Anupam_data/ORG_XML_FILES/i") :
> >> cannot change working directory
> >> *
> >>
> >>
> >> On Fri, Jan 8, 2010 at 11:37 PM, jim holtman<jholtman at gmail.com> wrote:
>>>
>>> ?list.files
>>>> ?file.info
>>>> ?setwd
>>>>
>>>> You can get a list of all the files in a directory (list.files) and then
>>>> do
>>>> a file.info to determine which ones are the directories you want to
>>>> search. A list.files on that directory will give you the list of file
>>>> names
>>>> that you can then process.
>>>>
>>>>
>>>>
>>>>
>>>> On Fri, Jan 8, 2010 at 12:41 PM, anupam sinha<anupam.contact at gmail.com
>>>> >wrote:
>>>>
>>>> Dear all,
>>>>> I have this directory structure :
>>>>>
>>>>> Dir1 Dir2 Dir3 Dir4 .........................
>>>>> A.xml D.xml G.xml
>>>>> B.xml E.xml H.xml
>>>>> C.xml F.xml I.xml
>>>>>
>>>>> Within each of these directories (Dir1, Dir2 etc) there are a num of xml
>>>>> files (A.xml, B.xml etc).
>>>>>
>>>>> What I want to do is to enter into the first directory read all the xml
>>>>> files do certain operations come out of the directory and do the same
>>>>> thing
>>>>> for another directory. Can anyone help me out ? Thanks in advance for
>>>>> any
>>>>> suggestions.
>>>>>
>>>>> Regards,
>>>>>
>>>>> Anupam Sinha
>>>>>
>>>>> [[alternative HTML version deleted]]
>>>>>
>>>>> ______________________________________________
>>>>> R-help at 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<
>>>>> http://*www.*r-project.org/posting-guide.html>
>>>>>
>>>>> and provide commented, minimal, self-contained, reproducible code.
>>>>>
>>>>>
>>>>
>>>>
>>>> --
>>>> Jim Holtman
>>>> Cincinnati, OH
>>>> +1 513 646 9390
>>>>
>>>> What is the problem that you are trying to solve?
>>>>
>>>>
>>>
>>>
>>>
>
>
>--
>Graduate Student,
>Laboratory of Computtational Biology,
>Centre For DNA Fingerprinting And Diagnostics,
>4-1-714 to 725/2, Tuljaguda complex
>Mozamzahi Road, Nampally,
>Hyderabad-500001
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help at 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.
--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062
More information about the R-help
mailing list