2. Starting with a plot


Let’s start easy and create a simple plot of a dataset. The dataset consists of 10 values ranging from 12 to 95 which are stored in the vector y while the vector x contains the series 1:10 that will be used as the X-axis. Here we use the function plot() in the following way: plot(Y~X):

[code language=”r”]
y <- c(45,12,48,79,65,32,78,95,12,75)
y
x <- c(1,2,3,4,5,6,7,8,9,10)
x
plot(y~x)
[/code]

 

plot

  Fant du det du lette etter? Did you find this helpful?
[Average: 0]