Get the First parts of a Data Set in R Programming - head() Function Last Updated : 30 Jun, 2020 Comments Improve Suggest changes Like Article Like Report head() function in R Language is used to get the first parts of a vector, matrix, table, data frame or function. Syntax: head(x, n) Parameters: x: specified data types n: number of row need to be printed Example 1: Python3 # R program to illustrate # head function # Calling the head() function to # get the iris demo dataset head(iris) Output: Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1 1.5 0.2 setosa 5 5.0 3.6 1.4 0.2 setosa 6 5.4 3.9 1.7 0.4 setosa Example 2: Python3 # R program to illustrate # head function # Calling the head() function to # get the iris demo dataset in # 4 rows head(iris, 4) Output: Sepal.Length Sepal.Width Petal.Length Petal.Width Species 1 5.1 3.5 1.4 0.2 setosa 2 4.9 3.0 1.4 0.2 setosa 3 4.7 3.2 1.3 0.2 setosa 4 4.6 3.1 1.5 0.2 setosa Comment More infoAdvertise with us Next Article Get the First parts of a Data Set in R Programming - head() Function K Kanchan_Ray Follow Improve Article Tags : R Language R DataFrame-Function Similar Reads Get the Last parts of a Data Set in R Programming - tail() Function tail() function in R Language is used to get the last parts of a vector, matrix, table, data frame or function. Syntax: tail(x, n) Parameters: x: specified data types n: number of row need to be printed Example 1: Python3 # R program to illustrate # tail function # Calling the tail() function to # g 1 min read Generate a set of Sample data from a Data set in R Programming - sample() Function sample() function in R Language creates random sample based on the parameters provided in the function call. It takes either a vector or a positive integer as the object in the function parameter. Syntax: sample(x, size, replace) Parameters: x: indicates either vector or a positive integer or data f 2 min read Create Subsets of a Data frame in R Programming - subset() Function subset() function in R Programming Language is used to create subsets of a Data frame. This can also be used to drop columns from a data frame.Syntax: subset(df, expr)Parameters: df: Data frame usedexpr: Condition for subsetCreate Subsets of Data Frames in R Programming LanguageHere we will make sub 3 min read Choose Specific Columns of a Data Frame in R Programming - select() Function select() function in R Language is used to choose whether a column of the data frame is selected or not. Syntax: select(x, expr) Parameters: x: Data frame expr: condition for selection Example 1: Python3 1== # R program to select specific columns # Loading library library(dplyr) # Create a data fram 2 min read How to print the first or last rows of a data set A data set typically means a collection of data organized in a tabular form, like a spreadsheet or a database table. Various programming languages have different techniques/methods to represent a data set in C++ we use vectors or arrays of structs/objects, In python pandas Data Frames, and Java 2D a 5 min read Get or Set names of Elements of an Object in R Programming - names() Function names() function in R Language is used to get or set the name of an Object. This function takes object i.e. vector, matrix or data frame as argument along with the value that is to be assigned as name to the object. The length of the value vector passed must be exactly equal to the length of the obj 2 min read Get the Minimum and Maximum element of a Vector in R Programming - range() Function range() function in R Programming Language is used to get the minimum and maximum values of the vector passed to it as an argument. Syntax: range(x, na.rm, finite) Parameters:Â x: Numeric Vectorna.rm: Boolean value to remove NAfinite: Boolean value to exclude non-finite elementsR - range() Function 1 min read Display the internal Structure of an Object in R Programming - str() Function str() function in R Language is used for compactly displaying the internal structure of a R object. It can display even the internal structure of large lists which are nested. It provides one liner output for the basic R objects letting the user know about the object and its constituents. It can be 3 min read How To Import Data from a File in R Programming The collection of facts is known as data. Data can be in different forms. To analyze data using R programming Language, data should be first imported in R which can be in different formats like txt, CSV, or any other delimiter-separated files. After importing data then manipulate, analyze, and repor 4 min read Getting Match of an Element within a Vector in R Programming - charmatch() Function charmatch() function in R Programming Language is used to find matches between two arguments. Syntax: charmatch(x, table, nomatch = NA_integer_) Parameters:Â x: the values to be matchedtable: the values to be matched againstnomatch: the integer value to be returned at non-matching positionr - charma 1 min read Like