Skip to content
Prev 386132 / 398513 Next

Good Evening,

Hello,

To plot a graph you don't need to compute the axis, R will do it for you:

# create data
set.seed(2020)    # Make the results reproducible
x <- runif(100, 1000, 10000)


This is not very intuitive but the following will plot the x values in 
the y axis, along the x axis values 1 to 100.


plot(x)


To plot a regression line you will need a regression model and that 
means you need a response variable.

y <- x + rnorm(100)

model <- lm(y ~ x)
plot(x, y)
abline(model, col = "red")



The question is very basic, you should focus on learning a bit more of 
R. Start with R-intro.pdf that comes with R. There are also many texts 
online that cover this and lots of other graphics stuff.


Hope this helps,

Rui Barradas

?s 14:49 de 29/10/20, Joy Kissoon escreveu: