Hello, I am trying to write a script to analyse R scripts, which contain only functions. Therefor, I want to test the R script if it contains onyl correct code. Is there a nicer and more efficent function than test <- try(source("someRscript")) if(class(test) == "try-error"){ print("Not executable") } ? Another question : Does a package exist to analyse functions? For example to get all defined function names, argument, nestings, etc... Does a package exists which creates a flowchart of a script which contains a sequel of functions? Thank you -- View this message in context: http://r.789695.n4.nabble.com/Script-analysing-tp4185492p4185492.html Sent from the R help mailing list archive at Nabble.com.
On 12/12/2011 10:39 AM, Alexander wrote:> Hello, > I am trying to write a script to analyse R scripts, which contain only > functions. Therefor, I want to test the R script if it contains onyl correct > code. Is there a nicer and more efficent function than > > test <- try(source("someRscript")) > if(class(test) == "try-error"){ > print("Not executable") > } > > ? > > Another question : Does a package exist to analyse functions? For example to > get all defined function names, argument, nestings, etc... > Does a package exists which creates a flowchart of a script which contains a > sequel of functions? > > Thank you > > -- > View this message in context: http://r.789695.n4.nabble.com/Script-analysing-tp4185492p4185492.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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.Hi, The codetools package comes to mind. cheers, Paul -- Paul Hiemstra, Ph.D. Global Climate Division Royal Netherlands Meteorological Institute (KNMI) Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39 P.O. Box 201 | 3730 AE | De Bilt tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770
On 12/12/2011 10:39 AM, Alexander wrote:> Hello, > I am trying to write a script to analyse R scripts, which contain only > functions. Therefor, I want to test the R script if it contains onyl correct > code. Is there a nicer and more efficent function than > > test <- try(source("someRscript")) > if(class(test) == "try-error"){ > print("Not executable") > } > > ? > > Another question : Does a package exist to analyse functions? For example to > get all defined function names, argument, nestings, etc... > Does a package exists which creates a flowchart of a script which contains a > sequel of functions? > > Thank you > > -- > View this message in context: http://r.789695.n4.nabble.com/Script-analysing-tp4185492p4185492.html > Sent from the R help mailing list archive at Nabble.com. > > ______________________________________________ > 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....which is one of the first hits on google when googling for "R analyse code". Paul -- Paul Hiemstra, Ph.D. Global Climate Division Royal Netherlands Meteorological Institute (KNMI) Wilhelminalaan 10 | 3732 GK | De Bilt | Kamer B 3.39 P.O. Box 201 | 3730 AE | De Bilt tel: +31 30 2206 494 http://intamap.geo.uu.nl/~paul http://nl.linkedin.com/pub/paul-hiemstra/20/30b/770