Posts Tagged ‘Data Frame’

Select numeric columns from a Data frame in R

We can get the list of columns in a data frame using sapply function. In this article, we are going extract the numeric columns of diamonds dataset. 1. Diamonds data frame contains numeric and noon-numeric columns. head(diamonds)

How to delete rows from Data Frame in R

There is no direct method to remove rows from R. We can remove the row(s) from Data Frame by creating new Data Frame. How to delete rows from Data Frame in R?

How to get first and last rows of Data Frame in R

We can get first n rows of Data Frame using head() function and can get last n rows of Data Frame using tail() function. Syntax of head() and tail() functions: head(data.frame,number_of_first_rows) tail(data.frame,number_of_last_rows)

Powered by k2schools