Dear all, I wrote a function test1 in test1.R. Right, I am writing another function test2 on test2.R and trying to use test1 function. How can I do? Is there any similar way like including test1.R in test2.R file? Thank You Very Much. Jia-Ming ===========================$BD%2HLC(B Jia-Ming Chang PhD Student Comparative Bioinformatics Group Bioinformatics and Genomics Programme Centre de Regulacio Genomica (CRG) Dr. Aiguader, 88 08003 Barcelona Spain E-Mail: chang.jiaming@crg.es chang.jiaming@gmail.com Web: http://www.iis.sinica.edu.tw/~jmchang/ TEL: +34 933 160 223 ext. 1223 CellPhone:+34 637 180 355 =========================== [[alternative HTML version deleted]]
Hi, I think you just have to call it with the correct arguments inside test2 function. So the arguments for test1 functions should be consider to be also arguments of test2 function. test2 <- function( test1arguments, test2arguments ){ ... value <- test1( test1arguments ) ... } Regards 2009/3/4 Chang Jia-Ming <chang.jiaming@crg.es>> Dear all, > > I wrote a function test1 in test1.R. > Right, I am writing another function test2 on test2.R and trying to use > test1 function. > How can I do? > Is there any similar way like including test1.R in test2.R file? > > Thank You Very Much. > > Jia-Ming > > ===========================> 張家銘 Jia-Ming Chang > PhD Student > Comparative Bioinformatics Group > Bioinformatics and Genomics Programme > > Centre de Regulacio Genomica (CRG) > Dr. Aiguader, 88 > 08003 Barcelona > Spain > > E-Mail: chang.jiaming@crg.es > chang.jiaming@gmail.com > Web: http://www.iis.sinica.edu.tw/~jmchang/<http://www.iis.sinica.edu.tw/%7Ejmchang/> > TEL: +34 933 160 223 ext. 1223 > CellPhone:+34 637 180 355 > ===========================> > [[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. >-- Patricia García [[alternative HTML version deleted]]
I usually use the ?source function. so at the top of your test2.R file, you would put a line like: source('C:\\test1.R') but with the correct path to where ever you have stored your test1.R file. Hope that helps a little, Tony On 4 Mar, 10:29, Chang Jia-Ming <chang.jiam... at crg.es> wrote:> Dear all, > > I wrote a function test1 in test1.R. > Right, I am writing another function test2 on test2.R and trying to use > test1 function. > How can I do? > Is there any similar way like including test1.R in test2.R file? > > Thank You Very Much. > > Jia-Ming > > ===========================> ??? Jia-Ming Chang > PhD Student > Comparative Bioinformatics Group > Bioinformatics and Genomics Programme > > Centre de Regulacio Genomica (CRG) > Dr. Aiguader, 88 > 08003 Barcelona > Spain > > E-Mail: chang.jiam... at crg.es > chang.jiam... at gmail.com > Web:http://www.iis.sinica.edu.tw/~jmchang/ > TEL: +34 933 160 223 ext. 1223 > CellPhone:+34 637 180 355 > ===========================> > [[alternative HTML version deleted]] > > ______________________________________________ > R-h... at r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code.
Hi, You can use the source() function to load functions from other files, like: source("test1.R") cheers, Paul Chang Jia-Ming wrote:> Dear all, > > I wrote a function test1 in test1.R. > Right, I am writing another function test2 on test2.R and trying to use > test1 function. > How can I do? > Is there any similar way like including test1.R in test2.R file? > > Thank You Very Much. > > Jia-Ming > > ===========================> $BD%2HLC(B Jia-Ming Chang > PhD Student > Comparative Bioinformatics Group > Bioinformatics and Genomics Programme > > Centre de Regulacio Genomica (CRG) > Dr. Aiguader, 88 > 08003 Barcelona > Spain > > E-Mail: chang.jiaming at crg.es > chang.jiaming at gmail.com > Web: http://www.iis.sinica.edu.tw/~jmchang/ > TEL: +34 933 160 223 ext. 1223 > CellPhone:+34 637 180 355 > ===========================> > [[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. >-- 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
Maybe Matching Threads
- the number of the arguments of function is not sure
- How to calculate the distance between two density functions
- party package: ctree - survival data - extracting statistics/predictors
- Función para devolver nombre del área de trabajo en uso
- Generating abnormal returns in R