[R] converting help files with Sd2Rd

Uwe Ligges ligges at statistik.uni-dortmund.de
Sat Jan 21 19:03:48 CET 2006


Fredrik Lundgren wrote:

> Dear list,
> 
> I would like to convert several .d files to several .Rd files
> in cmd.exe (Win XP home):
> 
> R CMD Sd2Rd *.d
> prints all files to the screen, I want the individual files saved to 
> disk
> 
> R CMD Sd2Rd *.d > foo.Rd
> puts them into one file, I want the individual files
> 
> R CMD Sd2Rd *.d > *.Rd
> complains:
> Wrong syntax for file name, directory name eller volyme etiquette.
> 
> R CMD Sd2Rd foo.d > foo.Rd
> works OK
> 
> 
> How can I transform several .d files to several  .Rd files with one 
> command?


Beside shell programming, you can also use R ...

## Start R and type:
setwd(path_to_.d_files)
f <- list.files(pattern="\\.d$")
fo <- paste(sapply(strsplit(f, "\\."), "[", 1), ".Rd", sep="")
for(i in seq(along=f))
   shell(paste("R CMD Sd2Rd", f[i], ">", fo[i]))
q("no")


Uwe Ligges




> Best wishes Fredrik
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html




More information about the R-help mailing list