182859/rnorm-function-in-r-usage
I understand the normal usage of rnorm (pardon the pun)
rnorm(n, mean = 0, sd = 1)
However, I came across the code below and I am not sure what the 2nd input array does as the mean.
y <- rnorm(12, rep(c(1,2,1), each=4),0.2)
y = rnorm(12, rep(c(1,2,1), each=4, 0.2)) I can explain this in the following way: Create four normal random variables with mean 1 and standard deviation 0.2. Create four normal random variables with mean 2 and standard deviation 0.2. Create four normal random variables with mean 1 and standard deviation 0.2. You can accomplish this in a single line rather than having to write a for loop or multiple pieces of code. That is what makes R sweet. The code you see above is that. In a single line, all three claims.
Discover the world of data with our Data Science Course and embark on a transformative journey towards analytical excellence.
Asymmetric difference is provided by 18 setdiff. ...READ MORE
I must turn a sizable dataset into ...READ MORE
I'm trying to find the opposite of ...READ MORE
It seems like you are experiencing an ...READ MORE
Let's say that the training data is ...READ MORE
I recently bought the following book: An Introduction ...READ MORE
percent in percent "returns a vector of ...READ MORE
According to help('percent in percent'), percent in ...READ MORE
I created an example that demonstrates the ...READ MORE
The first time works, but after that, ...READ MORE
OR
At least 1 upper-case and 1 lower-case letter
Minimum 8 characters and Maximum 50 characters
Already have an account? Sign in.