Error saying "Error in rnorm() : argument "n" is missing, with no default" in R

0 votes

I have just started learning R. I'm trying to execute a simple R program and i'm getting the following error:

Error in rnorm() : argument "n" is missing, with no default.

What could be the reason?

This is my code:

myfunction <- function()
{
                x <- rnorm()
                mean(x)
}
second <- function(x)
{
                x + rnorm(length(x))
}
Oct 30, 2018 in Data Analytics by Ali
• 10,450 points
175 views

1 answer to this question.

0 votes
Hey @ali, rnorm() function requires an argument, numeric argument. Try adding a number as a parameter and it should work.
answered Oct 30, 2018 by Maverick
• 10,040 points

Related Questions In Data Analytics

+5 votes
0 answers
0 votes
1 answer

Is there any way to check for missing packages and install them in R?

There are 2 options: Either you can use ...READ MORE

answered Apr 17, 2018 in Data Analytics by nirvana
• 3,060 points
40 views
0 votes
1 answer

How to write a custom function which will replace all the missing values in a vector with the mean of values in R?

Consider this vector: a<-c(1,2,3,NA,4,5,NA,NA) Write the function to impute ...READ MORE

answered Jul 4, 2018 in Data Analytics by CodingByHeart77
• 3,680 points
112 views
0 votes
1 answer

"no applicable method" Error in r programming

This is caused by using an object-oriented ...READ MORE

answered Oct 31, 2018 in Data Analytics by Kalgi
• 39,170 points
57 views
0 votes
1 answer

By using dpylr package sum of multiple columns

Basically here we are making an equation ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,700 points
79 views
0 votes
1 answer

How to convert a text mining termDocumentMatrix into excel or csv in R?

By assuming that all the values are ...READ MORE

answered Apr 5, 2018 in Data Analytics by DeepCoder786
• 1,700 points
95 views
0 votes
1 answer

In a dpylr pipline how to use sample and seq?

For avoiding rowwise(), I prefer to use ...READ MORE

answered Apr 6, 2018 in Data Analytics by DeepCoder786
• 1,700 points
71 views
0 votes
1 answer

How to create a list of Data frames?

Basically all we have to do is ...READ MORE

answered Apr 9, 2018 in Data Analytics by DeepCoder786
• 1,700 points
53 views
0 votes
1 answer