Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
in R Programming by (7.3k points)
Can anyone tell me how to create tables in R programming?

1 Answer

0 votes
by (41.4k points)

You can create tables in R programming in two ways as listed below:

You can use the table function to create a table and give the argument as two columns of data as shown below:

>data <- table(data$column1,data$column2)

In many instances, you will have the data in the form of a table, and you have to make a new table that contains the data. In such cases, you can do it as follows:

> colnames(dataset) <- c("USA","UK","Australia")

> rownames(dataset) <- c("Cricket","Football","Basketball")

dataset <- as.table(dataset)

If you are looking for an online course to learn R programming, check out this R Programming Training by Intellipaat.

Related questions

0 votes
1 answer
0 votes
1 answer
0 votes
1 answer

Browse Categories

...