| Splus code | Explanation |
| lty_plot.pdf | Line Types (LTY=n) |
| lty_plot_1_R.pdf | Line Types (LTY=n) USING R |
| lty_plot_2_R.pdf | Line Types (LTY=n) USING R |
| plot_pch.pdf | Plot Symbol Types (PCH=n) FOR SPLUS |
| pch_plot_R.pdf | Plot Symbol Types (PCH=n) FOR R |
| run_time.txt | Measuring the running time for a process in Splus |
num1 <- 15; num2 <- 5; name <- paste(num1,"_",num2,sep="") |
Results in name being assigned to "15_5" (without the quotes). Without the sep="" option, name becomes "15 _ 15 ". |
| unix("\\rm -f file"); unix("date > d.txt") | Issue UNIX command from Splus prompt. Notice the "\\rm" to indicate "\rm" in reality. |
postscript("~/figure.ps",width = 6.5,
height=7.5, pointsize=8)
par(mfrow=c(2,2))
matrix <- read.table
("~/file1.txt", header = FALSE)
matrix2 <- read.table
("~/file2.txt", header = FALSE)
matrix3 <- read.table
("~/file3.txt", header = FALSE)
matrix4 <- read.table
("~/file4.txt", header = FALSE)
minime _ min(min(matrix$V2),
min(matrix2$V2),min(matrix3$V2),
min(matrix4$V2))
plot(matrix$V1,matrix$V2,
type="l", main="n1,n2,alpha,delta
= 75_25_01_10",
ylim=c(minime,0.01))
lines(matrix2$V1,matrix2$V2,
lty=4)
lines(matrix3$V1,matrix3$V2,
lty=3)
lines(matrix4$V1,matrix4$V2,
lty=2)
# 3 more plot statements
#LEGEND
xleg _ seq(0,40,,10)
yleg _ seq(0,40,,10)
plot(xleg, yleg, type="n",
axes=F, xlab="", ylab="")
legend(-5.0, 25.0,c(
"Unrestricted delta-Z",
"CI Restricted delta-Z"),
lty=c(1,2),cex=1.)
|
Postscript export, reading in from text file, overlaying plots, legend |
n _ 20
p_ 0.25
x _ 0:n
y _ dbinom(x,n,p)
z _ round(y, digits=4)
postscript("C:/images/322/binom_pmf.ps",
width = 11, height=8.5,
pointsize=8, horizontal=T,
onefile=T,append=T)
plot(x,y, type="h", xlab="",
ylab="Density Value",lwd=6,
cex.axis=1.4, cex.lab=1.2)
axis(1, at = c(x),
labels = c(
"0","1", "2","3","4","5","6",
"7","8","9","10","11", "12",
"13","14","15","16","17","18",
"19","20"),cex.axis=1.4)
title ("Density of the Binomial(20,0.25)
Distribution",cex.main=2)
dev.off()
|
Binomial PMF Plot Line width (lwd), font size control via (cex.?) |
Lock_function(name)
{
name <- as.character(substitute(name))
q <- paste("$HOME/.Data/", name, sep = "")
qq <- paste("chmod u-w", q)
unix(qq)
invisible()
}
|
To protect valuable self-written functions and frequently used constants e.g. velocity of light, permittivity of free space, or even j(=0+1i), etc. it is convenient to write-protect them by changing the mode in .Data. |
From Main Menu -> Packages -> Install Packages |
If a package is needed that is not part of the default installation, use the drop down menu to search for the package from a local CRAN mirror. If the package is downloaded as a ZIP file, then select "Install package(s) from local zip files..." |
locator(1) |
returns the (x,y) coordinate of the mouse location after clicking the left button on the graph window |