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,270 points
904 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,820 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 in Data Analytics by Nurdiana
• 120 points

recategorized Sep 7 by Gitika 115 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,120 points
174 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,720 points
1,278 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
990 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
504 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 by Gitika 202 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
319 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,820 points
191 views