2
i am a starter in R, probably this is a very foolish question but please help.
x =c(rnorm(100))
y = c(rnorm(100)) ## for the graph
plot(x,col = "blue")
par(new=True) ## to superimpose the new graph on the previous
plot(y,col = "red")
why does this give an error as 

Error in par(new = True) : object 'True' not found

2 Answers2

1

If you want to add a plot on top of an existing plot, then use the lines function:

x <- c(rnorm(100))
y <- c(rnorm(100))
plot(x, col="blue")
lines(y, col = "red")
Tim Biegeleisen
  • 387,723
  • 20
  • 200
  • 263
0

"type true in all CAPS TRUE" par(new=True) ## wrong par(new=TRUE) ## Correct

  • Welcome to [so].Use formatting tools to make your post more readable. Use `code blocking` for code and log and error texts and **bold** and *italics* to highlight things . please elaborate your answer – Morse Jul 07 '18 at 16:22