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
• 11,360 points
3,332 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,840 points

Related Questions In Data Analytics

+5 votes
0 answers
0 votes
0 answers

Error in xy.coords(x, y, xlabel, ylabel, log) : argument "x" is missing, with no default

Hi, my code is showing this, what's ...READ MORE

Sep 7, 2020 in Data Analytics by Nurdiana
• 120 points

recategorized Sep 7, 2020 by Gitika 1,956 views
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,130 points
874 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,750 points
4,556 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,720 points
2,250 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,720 points
1,921 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,720 points

edited Jun 9, 2020 by Gitika 1,182 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,720 points
1,341 views
0 votes
1 answer

Error saying "Error in source("myfirst.R") : myfirst.R:14:2: unexpected '!' 13: 14: ë! ^"

This is a very common issue that ...READ MORE

answered Oct 30, 2018 in Data Analytics by Maverick
• 10,840 points
1,033 views
webinar REGISTER FOR FREE WEBINAR X
REGISTER NOW
webinar_success Thank you for registering Join Edureka Meetup community for 100+ Free Webinars each month JOIN MEETUP GROUP