Question: Can someone please help me with this R-Program coding question? Thanks so much in advance! Write a function that calculates the geometric mean of a
Can someone please help me with this R-Program coding question? Thanks so much in advance!

Write a function that calculates the geometric mean of a vector x = (x-1,... x_n) and returns an error message if any element of x is negative. Apply your function to each column of the dataset given below. Some of the columns have "data entry errors" and contain negative numbers. Create a labeled output vector that gives the geometric mean for valid data and NA for columns with invalid data. (Hint use try()). set.seed(123) data matrix(rnorm( 10000, mean=3), ncol=25, dimnames=Iist(NULL, paste Write a function which takes a numeric vector x, and returns a named list containing the mean, median and variance of the values in x. Write a function which goes through every entry in a list, cheks whether it is a character vector (is.character()), and if so prints it (print() or cat())
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
