Extract Data Frame with One Column
In the code sample below, diamonds dataset from ggplot2 package is used. To work with the example below, one needs to load the ggplot2 library using command such as require(“ggplot2”). In the command below, method as.data.frame is used. Make a note of drop=false parameter passed to as.data.frame method.
dfn1 <- as.data.frame(diamonds[,c(1)], drop=false)
- To Become a Data Analyst, Data Scientist or Data Engineer? - August 9, 2022
- Data-centric vs Model-centric AI: Concepts, Examples - August 9, 2022
- Data Science Architect Interview Questions - August 8, 2022
Leave a Reply