[R] Good Evening,

Rui Barradas ru|pb@rr@d@@ @end|ng |rom @@po@pt
Thu Oct 29 18:07:00 CET 2020


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:
> runif (100,
> 1000, 10000)



More information about the R-help mailing list