Site icon R-bloggers

Data Structures Exercises (Part-1)

[This article was first published on R-exercises, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

R Programming has various Data Structures for efficient manipulation of Data.
Following are the list of data structures supported by R.

1. Vectors
2. Lists
3. Matrix
4. Data frame
This exercise helps through various operations of R Data structures.

Answers to the exercises are available here.

Exercise 1

Create an atomic vector of Character type, double type, logical type , integer type, complex type and raw type

Exercise 2

Check whether each of the created data structure is of vector type as well as check the class of each of the data.

Exercise 3

Create a List of heterogeneous data, which include numeric, character and logical vectors and prints the lists.

Exercise 4

Create a matrix of 3 rows and 4 columns which stores data from 1 to 12 and arrange the value row wise.

Exercise 5

Create a matrix of 3 rows and 4 columns which stores random data and arrange the matrix column wise

Exercise 6

Create two 2 x 2 matrices with random values and perform all arithmetic operations with those two and print the resultant matrices

Exercise 7

Create a random matrix having values between 1 and 1000 and print the matrix and transpose of the matrix

Exercise 8

Create Data Frames which contain details of 5 employees and display the same.

Exercise 9

Create Data Frames which contain details of 5 employees and display summary of the data

Exercise 10

Create a Data Frame of 5 employees and display the details of First and Last Employee and Names of All employees.

Related exercise sets:

  1. Matrix exercises
  2. 3D plotting exercises
  3. Basic Operations Exercises
  4. Explore all our (>1000) R exercises
  5. Find an R course using our R Course Finder directory

To leave a comment for the author, please follow the link and comment on their blog: R-exercises.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.