Create a Tabular representation of Data in R Programming - table() Function Last Updated : 19 Jun, 2020 Comments Improve Suggest changes Like Article Like Report table() function in R Language is used to create a categorical representation of data with variable name and the frequency in the form of a table. Syntax: table(x) Parameters: x: Object to be converted Example 1: Python3 1== # R Program to create # a tabular representation of data # Creating a vector vec = c(2, 4, 3, 1, 2, 3, 2, 1, 4, 2) # Calling table() Function table(vec) Output: vec 1 2 3 4 2 4 2 2 Example 2: Python3 1== # R Program to create # a tabular representation of data # Creating a data frame df = data.frame( "Name" = c("abc", "cde", "def"), "Gender" = c("Male", "Female", "Male") ) # Calling table() function table(df) Output: Gender Name Female Male abc 0 1 cde 1 0 def 0 1 Comment More infoAdvertise with us Next Article Create a Tabular representation of Data in R Programming - table() Function N nidhi_biet Follow Improve Article Tags : R Language R DataFrame-Function R Vector-Function R Object-Function R Matrix-Function R List-Function +2 More Similar Reads Reading contents of a Text File in R Programming - read.table() Function The read.table() function in R can be used to read a text file's contents. A versatile and often used function for reading tabular data from different file formats, including text files, is read.table(). It returns the data in the form of a table.Syntax: read.table(filename, header = FALSE, sep = "" 2 min read Convert an Object to a Table in R Programming - as.table() Function as.table() function in R Language is used to convert an object into a table. Syntax: as.table(x) Parameters: x: Object to be converted Example 1: Python3 1== # R Program to convert # an object to a table # Creating a vector vec = c(2, 4, 3, 1, 2, 3, 2, 1, 4, 2) # Calling as.table() Function as.table 1 min read Reading Tabular Data from files in R Programming Often, the data which is to be read and worked upon is already stored in a file but is present outside the R environment. Hence, importing data into R is a mandatory task in such circumstances. The formats which are supported by R are CSV, JSON, Excel, Text, XML, etc. The majority of times, the data 4 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 Read contents of a CSV File in R Programming - read.csv() Function read.csv() function in R Language is used to read "comma separated value" files. It imports data in the form of a data frame. The read.csv() function also accepts a number of optional arguments that we can use to modify the import procedure. we can choose to treat the first row as column names, sele 3 min read Concatenate List of Two data.tables Using rbindlist() Function in R In this article, we will be looking at the approach to concatenating a list of two data.tables using rbindlist() function in the R programming language. Concatenate List of Two data.tables Using rbindlist() Function In this method of concatenating a list of two data.tables using the rbindlist() func 3 min read data.table vs data.frame in R Programming data.table in R is an enhanced version of the data.frame. Due to its speed of execution and the less code to type it became popular in R. The purpose of data.table is to create tabular data same as a data frame but the syntax varies. In the below example let we can see the syntax for the data table: 3 min read Apply function to each row in Data.table in R In this article, we are going to see how to apply functions to each row in the data.table in R Programming Language. For applying a function to each row of the given data.table, the user needs to call the apply() function which is the base function of R programming language, and pass the required p 1 min read Convert an Object to Data Frame in R Programming - as.data.frame() Function as.data.frame() function in R Programming Language is used to convert an object to data frame. These objects can be Vectors, Lists, Matrices, and Factors. Syntax: as.data.frame(object) Parameters: object: Vector, Matrix, factor, or data frameR - as.data.frame() Function ExampleExample 1: Basic exam 2 min read Apply Function to data.table in Each Specified Column in R In this article, we are going to see that how to apply a function to data.table in each specified column in R Programming Language. The data.table library in R is used to create datasets and represent it in an organized manner. The library can be downloaded and installed into the working space using 3 min read Like