Dear RKWard developpers,

I try to reproduce your "Practical Example" in the RKWard documentation.

Everything works fine, but the js() function is not found, in the part where the JavaScript should be created:

..
Error in rk.paste.JS(echo("res <- t.test (x=", var.x, ", y=", var.y, ",
hypothesis=\"",  :
  could not find function "js"


I am using rkwarddevel 0.06-5 on Fedora 23 with R 3.2.2.

The same problem occurs on MASSyPup64 (https://peerj.com/articles/1401/, http://www.bioprocess.org/massypup), running R 3.2.x (R, rkward and all packages compiled from source).

Is there any dependency missing or could this be a problem with the R version?

Best Regards,

Robert

Attached the file I try to process.
require(rkwarddev)

local({
	variables <- rk.XML.varselector(id.name="vars")
	var.x <- rk.XML.varslot("compare", source=variables, types="number", required=TRUE)
	var.y <- rk.XML.varslot("against", source=variables, types="number", required=TRUE)
	test.hypothesis <- rk.XML.radio("using test hypothesis",
		options=list(
			"Two-sided"=c(val="two.sided"),
			"First is greater"=c(val="greater"),
			"Second is greater"=c(val="less")
		)
	)
	check.paired <- rk.XML.cbox("Paired sample", value="1", un.value="0")
	basic.settings <- rk.XML.row(variables, rk.XML.col(var.x, var.y, test.hypothesis, check.paired))

	check.eqvar <- rk.XML.cbox("assume equal variances", value="1", un.value="0")
	conf.level <- rk.XML.spinbox("confidence level", min=0, max=1, initial=0.95)
	check.conf <- rk.XML.cbox("print confidence interval", val="1", chk=TRUE)
	conf.frame <- rk.XML.frame(conf.level, check.conf, rk.XML.stretch(), label="Confidence Interval")

	full.dialog <- rk.XML.dialog(
		label="Two Variable t-Test",
		rk.XML.tabbook(tabs=list("Basic settings"=basic.settings, "Options"=list(check.eqvar, conf.frame)))
	)

	full.wizard <- rk.XML.wizard(
			label="Two Variable t-Test",
			rk.XML.page(
				rk.XML.text("As a first step, select the two variables you want to compare against
					each other. And specify, which one you theorize to be greater. Select two-sided,
					if your theory does not tell you, which variable is greater."),
				rk.XML.copy(basic.settings)),
			rk.XML.page(
				rk.XML.text("Below are some advanced options. It's generally safe not to assume the
					variables have equal variances. An appropriate correction will be applied then.
					Chosing \"assume equal variances\" may increase test-strength, however."),
				rk.XML.copy(check.eqvar),
				rk.XML.text("Sometimes it's helpful to get an estimate of the confidence interval of
					the difference in means. Below you can specify whether one should be shown, and
					which confidence-level should be applied (95% corresponds to a 5% level of
					significance)."),
				rk.XML.copy(conf.frame)))

	JS.calc <- rk.paste.JS(
		echo("res <- t.test (x=", var.x, ", y=", var.y, ", hypothesis=\"", test.hypothesis, "\""),
		js(
			if(check.paired){
			echo(", paired=TRUE")
			},
			if(id("!", check.paired, "  && ", check.eqvar)){
			echo(", var.equal=TRUE")
			},
			if(conf.level != "0.95"){
			echo(", conf.level=", conf.level)
			},
			linebreaks=TRUE
		),
		echo(")\n"), level=2)

	JS.print <- rk.paste.JS(echo("rk.print (res)\n"), level=2)

	plugin.dir <<- rk.plugin.skeleton("t-Test",
		xml=list(
			dialog=full.dialog,
			wizard=full.wizard),
		js=list(
			results.header="\"Two Variable t-Test\"",
			calculate=JS.calc,
			printout=JS.print),
		pluginmap=list(
			name="Two Variable t-Test",
			hierarchy=list("analysis", "means", "t-Test")),
		load=TRUE,
		edit=TRUE,
		show=TRUE,
		overwrite=TRUE)
})

Reply via email to