To load this code, we’ll use this code:
set.seed(123): This ensures that whenever running the code, we get the same random numbers.
house_size <- round(runif(50, 1000, 5000)): It makes a list of 50 random house sizes. The sizes range from 1000 to 5000 square feet.
house_price <- 50000 + house_size * 100 + rnorm(50, mean = 0, sd = 50000): This calculates the pretend prices for the houses. It adds a base price of $50,000 to each house, plus an extra amount based on its size.
data <- data.frame(house_size, house_price): Finally, it puts the house sizes and prices together into a table called “data”. Each row in the table represents one house, with its size and price.