Beispiel #1
0
func (r RDocument) KnitR() string {
	r.checkR()
	r.knit()
	base := strings.TrimSuffix(r.InputFile, filepath.Ext(r.InputFile))
	pureMarkdownFile := strings.Join([]string{base, "md"}, ".")
	utils.CheckExists(pureMarkdownFile)
	return pureMarkdownFile
}
Beispiel #2
0
func (opts RenderCmdOpts) main(args []string) {
	opts.processOpts()

	for _, file := range args {
		fmt.Println("Processing --", file)
		utils.CheckExists(file)
		render.RenderFile(file, opts.OutDir, opts.RpkgsDir, opts.Keep)
	}

	fmt.Println("All Done!")
}
Beispiel #3
0
func SetupRLIBSPath(rpkgsDir string) {
	if rpkgsDir != "" {
		utils.CheckExists(rpkgsDir)
		if err := os.Setenv("R_LIBS", rpkgsDir); err != nil {
			log.Fatalf(
				"Could not set R_LIBS: %s",
				err,
			)
		}
	}

	Rlibs := os.Getenv("R_LIBS")
	if Rlibs == "" {
		log.Fatalln(
			"Environment Variable 'R_LIBS' isn't set.  ",
			"Either set it, or use '--rlibs'",
		)
	}

	utils.CheckExists(Rlibs)
}