Question: Programming in R: Using the ifelse() function in R, write a function that adds 1 to all the positive entries of a vector and subtracts
Programming in R:
-
Using the ifelse() function in R, write a function that adds 1 to all the positive entries of a vector and subtracts one from all the non-positive entries. Test it on 100 randomly generated observations from the N(0,1) distribution, and use the function from the previous problem to create a histogram of the modified sample.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
