Suppose you're asked to write a function in R that takes a data frame and returns a new data frame with only numeric columns. How would you do it?
- Use the select() function from the dplyr package
- Use the filter() function from the dplyr package
- Use the subset() function
- Use the keep() function from the purrr package
To accomplish this task, you can use the select() function from the dplyr package in R. You can specify the column selection criteria to include only numeric columns and obtain a new data frame with the desired columns.
Loading...
Related Quiz
- Imagine you need to create a list in R containing the first 100 positive integers and their corresponding square values. How would you do this?
- What are the potential risks or downsides of using recursive functions in R?
- What is the purpose of a for loop in R?
- What are some techniques to optimize a recursive function in R?
- To represent a double quote within a string, the syntax in R would be "______".