DataFrame Rows & Column Segment in R Last Updated : 28 Apr, 2025 Summarize Comments Improve Suggest changes Share Like Article Like Report The process of extracting the row and column information in a dataset by simply using the index or slice operator is known as Slicing. In R Programming, the rows and columns can be sliced in two ways either by using an index or using the name of the row and column. The slice operator is much more useful when one wants to extract if the index or name of the row or column is known. Slicing the data frame using the slice operator is more efficient than slicing the data set using the slice() method in the dplyr package. Syntax: dataframe[start_row:end_row,start_column:end_column] Loading Dataset Load the default dataset iris in R and convert it as a data frame. R # Load the iris dataset data(iris) # Convert the data set to data frame df <- data.frame(iris) Examples Let's see some examples of slicing for the above dataset. Slice the data frame in such a way that only 3rd row data is extracted. R # To extract all the columns of row number 3 records df[3,] Output: Slice the data frame to extract all the columns from row number 5 to 10. R # To extract all the columns from row number 5 to 10 df[5:10,] Output: Slice the data frame to extract 5th column and all the rows. R # To extract 5th column and all the rows of it df[,5] Output: Slice the data frame to extract the 3rd and 5th column data present from 2nd to 5th row. R # To extract the 3rd and 5th column # data present from 2nd to 5th row df[2:5,3:5] Output: Comment More infoAdvertise with us Next Article DataFrame Rows & Column Segment in R S sri06harsha Follow Improve Article Tags : Technical Scripter R Language Technical Scripter 2022 Similar Reads DataFrame Row Slice in R In this article, we are going to see how to Slice row in Dataframe using R Programming Language. Row slicing in R is a way to access the data frame rows and further use them for operations or methods. The rows can be accessed in any possible order and stored in other vectors or matrices as well. Row 4 min read Convert Data Frame Column to Numeric in R In R, converting DataFrame columns to numeric is a common and important step in data preprocessing, particularly for statistical modeling and analysis. Below are effective methods to perform this conversion using base R and the readr package.Method 1: Convert One Column to NumericStart by checking t 2 min read Select Subset of DataTable Columns in R In this article, we will discuss how to select a subset of data table columns in R programming language. Let's create a data table using a matrix. First, we need to load data.table package in the working space. Installation install.packages("data.table") Â Â Â Â Â Â Â Â Â Â Â Â Â Loading library("dat 2 min read Import Only Selected Columns of Data from CSV in R In this article, we will be looking at two different approaches to import selected columns of the Data from a CSV file in the R programming language. Method 1: Using read.table() function In this method of only importing the selected columns of the CSV file data, the user needs to call the read.tabl 2 min read Convert dataframe to data.table in R In this article, we will discuss how to convert dataframe to data.table in R Programming Language. data.table is an R package that provides an enhanced version of dataframe. Characteristics of data.table :Â data.table doesnât set or use row namesrow numbers are printed with a : for better readabilit 5 min read Like