Question: Write an R function called normalize to normalize each element in a vector x to a number between 0 and 1. Return the normalized values
Write an R function called "normalize" to normalize each element in a vector "x" to a number between 0 and 1. Return the normalized values in a new vector "y" where y_value = (x_value - x_min)/(x_max - x_min). Save the function a function library called example_lib.R. Write an R program called example_p1_main.R to call the function normalize to test the function using a vector x =[2,3,5,7,9,11]. The output should look as follows:
Program: example_p1.R
Input vector: 2 3 4 5 7 9 11
Output vector: 0 0.1111111 0.2222222 0.3333333 0.5555556 0.7777778 1
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
