Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
Write a function in R language to replace the missing value in a vector with the mean of that vector.
Home
R Language
Write a function in R language to replace the missing value in a vector with the mean of that...
+3
votes
asked
Jul 28, 2019
in
R Language
by
Aarav2017
Write a function in R language to replace the missing value in a vector with the mean of that vector.
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jul 28, 2019
by
SakshiSharma
mean impute <- function(x) {x [is.na(x)] <- mean(x, na.rm = TRUE); x}
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
+3
votes
Q: There is a function fn(a, b, c, d, e) a + b * c - d / e. Write the code to call fn on the vector c(1,2,3,4,5) such that the output is same as fn(1,2,3,4,5).
asked
Jul 28, 2019
in
R Language
by
Aarav2017
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
+4
votes
Q: How missing values and impossible values are represented in R language?
asked
Jul 28, 2019
in
R Language
by
Aarav2017
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
+3
votes
Q: Write code to build an R function powered by C?
asked
Jul 28, 2019
in
R Language
by
Aarav2017
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
+3
votes
Q: Which function in R language is used to find out whether the means of 2 groups are equal to each other or not?
asked
Jul 28, 2019
in
R Language
by
Aarav2017
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
+3
votes
Q: If you want to know all the values in c (1, 3, 5, 7, 10) that are not in c (1, 5, 10, 12, 14). Which in-built function in R can be used to do this? Also, how this can be achieved without using the in-built function.
asked
Jul 28, 2019
in
R Language
by
Aarav2017
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
+3
votes
Q: Two vectors X and Y are defined as follows – X <- c(3, 2, 4) and Y <- c(1, 2). What will be output of vector Z that is defined as Z <- X*Y.
asked
Jul 28, 2019
in
R Language
by
Aarav2017
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
+3
votes
Q: How do you write R commands?
asked
Jul 28, 2019
in
R Language
by
Aarav2017
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
+3
votes
Q: What is the process to create a table in R language without using external files?
asked
Jul 28, 2019
in
R Language
by
Aarav2017
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
+3
votes
Q: R language has several packages for solving a particular problem. How do you make a decision on which one is the best to use?
asked
Jul 28, 2019
in
R Language
by
Aarav2017
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
+3
votes
Q: What is the value of f (2) for the following R code?
asked
Jul 28, 2019
in
R Language
by
Aarav2017
#r-language
#r-programming
#r-course
#r-tutorial
#r-question-answer
#r-interview-question
#r-basics
#r-test
#what-is-r
#learn-r
...