graphs 

Send to Kindle
home » snippets » r » learn » graphs



barplot

> x = 1:10
> x[4] = NA
> x
 [1]  1  2  3 NA  5  6  7  8  9 10
> barplot(x)
R SVG Plot! 0 2 4 6 8 10
# If you set names(x), then those will appear as the labels
# in the bar graph.
> names(x) = c("one", "two", "three", "four", "five")
> barplot(x)
R SVG Plot! one two three four five 0 2 4 6 8 10

plot

> x = seq(0, 6*pi, 0.1)
> y = sin(x)
> plot(x, y)
R SVG Plot! 0 5 10 15 -1.0 -0.5 0.0 0.5 1.0 x y