From 77fd14cfc9952964a1504c0ff503c23a642a9096 Mon Sep 17 00:00:00 2001 From: hgeng1 <31422146+hgeng1@users.noreply.github.com> Date: Mon, 28 Aug 2017 22:48:39 -0400 Subject: [PATCH 1/3] generate a and sin(a) --- file1.txt | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/file1.txt b/file1.txt index 4d9ba1f..0b28f07 100644 --- a/file1.txt +++ b/file1.txt @@ -2,5 +2,6 @@ print("hello world"); input("Tell me what date it is"); - +a=c(-50,50) +SIN=sin(a) From 4bf11096e622a0abf4201657bc25d9640dbcb89b Mon Sep 17 00:00:00 2001 From: hgeng1 <31422146+hgeng1@users.noreply.github.com> Date: Mon, 28 Aug 2017 22:50:54 -0400 Subject: [PATCH 2/3] generate cos(a) --- file1.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/file1.txt b/file1.txt index 0b28f07..c64acd9 100644 --- a/file1.txt +++ b/file1.txt @@ -4,4 +4,4 @@ input("Tell me what date it is"); a=c(-50,50) SIN=sin(a) - +COS=cos(a) From 7d248b720601e3d45e7f61733011423da59a8962 Mon Sep 17 00:00:00 2001 From: hgeng1 <31422146+hgeng1@users.noreply.github.com> Date: Mon, 28 Aug 2017 22:53:57 -0400 Subject: [PATCH 3/3] try to add a new file --- graphs.R | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 graphs.R diff --git a/graphs.R b/graphs.R new file mode 100644 index 0000000..d9f123d --- /dev/null +++ b/graphs.R @@ -0,0 +1,35 @@ +#Start with +setwd("E:/ECON615/example") +#No.1 +a=c(-50:50) +Sin=sin(a) +Cos=cos(a) + +#two lines in one graph part1 +plot(a,Sin,type="l", col="blue") +curve(cos,xlab="a",col="red",add=T) +#two lines in one graph part 2 +plot(a,Sin,type="l", col="blue") +lines(a,Cos,xlab="a",col="red") +#two lines in one graph part 3 +plot(a,Sin,type="l", col="blue") +par(new=T) +plot(a,Cos,type="l", col="Red") + +#put several graphes in one page +par(mfrow=(c(3,1))) + +plot(a,Sin,type="l", col="blue",main="graphes",sub="plot with curve") +curve(cos,xlab="a",col="red",add=T) + +plot(a,Sin,type="l", col="blue",sub="plot with line") +lines(a,Cos,xlab="a",col="red") + +plot(a,Sin,type="l", col="blue",sub="plot with plot") +par(new=T) +plot(a,Cos,type="l", col="Red") + +dev.off() + +#histogtram +hist(Sin)