American Musical and Dramatic Academy User Defined Function Questions
Description
Having Trouble Meeting Your Deadline?
Get your assignment on American Musical and Dramatic Academy User Defined Function Questions completed on time. avoid delay and – ORDER NOW
There are 4 questions: 3 questions are in the uploaded file
and this is the fourth one
10. Create a user-defined function that can clean up almost any
data frame using a loop. The function inputs are the dataset name
and the column indexes that we want to clean up. An example of
the function call might look like this:
function_name(x=mydata, col_idx=c(1,2,3))
The loop inside the function will take column indexes (from the
call inputs) and remove observations with empty values.
Hint: inside the loop, use:
new_df <– x[–which(is.na(x[ ,col_idx[i]]))]
Test your function with any dataset found on the
www.images.aqr.com/Insights/Datasets website.