Convert dataframe column to vector in R Last Updated : 23 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In this article, we will discuss how to convert a DataFrame column to vector in R Programming Language. To extract a single vector from a data frame in R Programming language, as.vector() function can be used. Syntax: as.vector( data_frame$column_name ) Here, data_frame is the name of the data framecolumn_name is the column to be extracted Given below are some implementations for this. Example 1: R # creating dataframe std.data <- data.frame(std_id = c (1:5), std_name = c("Ram","Shayam","Mohan", "Kailash","Aditya"), marks = c(95,96,95,85,80) ) # extracting vector from # dataframe column std_name name.vec <- as.vector(std.data$std_name) print(name.vec) Output: [1] "Ram" "Shayam" "Mohan" "Kailash" "Aditya" We can now examine whether the returned column is a vector or not, by passing it to the function is.vector() which returns a Boolean value i.e. either true or false. Example 2: We will extract the Species column from the well-known data frame Iris using as.vector( ) function and print it. We will also check whether the returned column is a vector or not. R df <- iris # print the data frame head(df) # extracting vector from # dataframe column Species name.vec <- as.vector(df$Species) print(name.vec) # returns Boolean value is.vector(name.vec) Output: Comment More infoAdvertise with us Next Article Convert DataFrame Column to Numeric in R M misraaakash1998 Follow Improve Article Tags : R Language R Programs R-DataFrame R-Vectors R DataFrame-Programs R Vector-Programs +2 More Similar Reads Convert dataframe rows and columns to vector in R In this article, we are going to convert a dataframe column to a vector and a dataframe row to a vector in the R Programming Language. Convert dataframe columns into vectors We are taking a column in the data frame and passing it into another variable by using the selection method. The selection met 2 min read Convert DataFrame Column to Numeric in R In this article, we are going to see how to convert DataFrame Column to Numeric in R Programming Language. All dataframe column is associated with a class which is an indicator of the data type to which the elements of that column belong to. Therefore, in order to simulate the data type conversion, 9 min read Convert dataframe column to list in R In this article, we will learn how to convert a dataframe into a list by columns in R Programming language. We will be using as.list() function, this function is used to convert an object to a list. These objects can be Vectors, Matrices, Factors, and data frames. Syntax: as.list( object ) Parameter 2 min read Convert Named Vector to DataFrame in R In this article, we will see how to convert the named vector to Dataframe in the R Programming Language. Method 1: Generally while converting a named vector to a dataframe we may face a problem. That is, names of vectors may get converted into row names, and data may be converted into a single colu 1 min read Convert List of Vectors to DataFrame in R In this article, we will discuss how to convert the given list of vectors to Dataframe using the help of different functions in the R Programming Language. For all the methods discussed below, few functions are common because of their functionality. Let us discuss them first. as.data.frame() is one 2 min read Convert dataframe to list of vectors in R In this article, we will learn how to convert a dataframe into a list of vectors, such that we can use columns of the dataframes as vectors in the R Programming language. Dataframe columns as a list of vectors as.list() function in R Language is used to convert an object to a list. These objects can 3 min read Like