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)

______________________________________________
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to