[R] altering prefix to multiple variables in different locations within a command file

Bob Green bgreen at dyson.brisnet.org.au
Mon Mar 12 21:54:05 CET 2007


Hello,

I am seeking advice regarding how I might add the prefix " kc$ " to 
variables in  a series of commands. The complication is that there is 
a large number of variables with different commands. Examples of the 
variables in typical commands follow.

It is simple to use search & replace for common variables such as 
"group" but I would appreciate advice about whether there is a  way 
to readily alter the remaining variables.

Bob Green


CrossTable(group,TOC2,chisq=TRUE,resid=TRUE, missing.include=FALSE)
fisher.test(group,TOC2)

tapply(TOC2,  group,  mean)
tapply( TOC2,  group, sd)

oneway.test ( TOC2 ~  group, var.equal=FALSE)
kruskal.test ( TOC2 ~  group)


broadcast  ==""
broadcast   [broadcast  ==""] <- "n"
CrossTable( group,broadcast   ,chisq=TRUE,resid=TRUE, missing.include=FALSE)
fisher.test(group,broadcast)

jealous [jealous=="y (not victim)"] = "n"
jealous==""
jealous [jealous==""] <- "n"
jealous==""
CrossTable(group,jealous ,chisq=TRUE,resid=TRUE, missing.include=FALSE)
fisher.test(group,jealous)



More information about the R-help mailing list