noamross / zero-dependency-problems

Real-world code problems in R, without dependencies
79 stars 25 forks source link

null-in-output #14

Open noamross opened 9 years ago

noamross commented 9 years ago

https://github.com/noamross/zero-dependency-problems/blob/master/R/null-in-output.md

Does anyone know why using an apply() statement to draw multiple lines on a plot with abline() returns "NULL" in addition to drawing the lines? I am creating a plot in an R Markdown PDF document, and my document would look nicer if it didn't have "NULL" printed along with the plot.

Here is an example of the problem:

> plot(1)
> x <- cbind(c(0.8, 1.0, 1.2), c(0, 0, 0))
> apply(x, 1, abline)
NULL