Data Structures Exercises (Part-1)

April 7, 2017
By

(This article was first published on R-exercises, and kindly contributed to R-bloggers)

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.

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 on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)