myplot: recording all R call as a myplot object, and then passing to...

Description Usage Arguments Examples

Description

myplot() use match.call to record R call.using \\ is more convenient, see examples.

Usage

1

Arguments

...

all R call to recording

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
## Not run: 
set.seed(1)
x=rnorm(100)
y=x*5+rnorm(100)


png(file="test1.png",units = "cm",width = 15, height = 15, units = "cm",res=300)
plot(x,y,pch=20)
lm=lm(y~x)
abline(lm,col="red")
points(x[1:5],y[1:5],col="blue",cex=1.5,pch=20)
dev.off()


pdf(file="test1.pdf")
plot(x,y,pch=20)
lm=lm(y~x)
abline(lm,col="red")
points(x[1:5],y[1:5],col="blue",cex=1.5,pch=20)
dev.off()

# myplot 1

p=myplot(set.seed(1),
         x=rnorm(100),
         y=x*5+rnorm(100),
         plot(x,y,pch=20),
         lm=lm(y~x),
         abline(lm,col="red"),
         points(x[1:5],y[1:5],col="blue",cex=1.5,pch=20))
plotsave(p)
plotsave(p,file="test2.png",width = 15, height = 15, units = "cm")
plotsave(p,file="test2.pdf",width = 150, height = 150, units = "mm")


# myplot 2

#using {}  more convenient

rm(list=ls())
set.seed(1)
x=rnorm(100)
y=x*5+rnorm(100)

p=myplot({
  plot(x,y,pch=20)
  lm=lm(y~x)
  abline(lm,col="red")
  points(x[1:5],y[1:5],col="blue",cex=1.5,pch=20)
})

plotsave(p)
plotsave(p,file="test3.png",width = 15, height = 15, units = "cm")
plotsave(p,file="test3.pdf",width = 150, height = 150, units = "mm")


## End(Not run)

kumine/myplot documentation built on May 12, 2019, 3:14 p.m.