Data Structures Exercises (Part 2)

April 12, 2017

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

In the Exercises we will cover Hashes, Factors and Zoo in R

Answers to the exercises are available here.

Learn more about Data Structures in the online course
R Data Pre-Processing & Data Management – Shape your Data!
. In this course you will learn how to:

  • Convert your data in R
  • Use SQL query embedded in R
  • Work with different data management packages like dplyr
  • And much more

Exercise 1

Create a Hash based Key Value Pairs with three employees, with Employees as the key and the name as the values.

Exercise 2

Create Hash of an Employee with the Name, Age, Address & SSN as the key and the details of the employee as the values

Exercise 3

Create Hash and use names function to give names to the key.

Exercise 4

Create a factor based on marks of students and print the summary of the same.

Exercise 5

Create a factor based on heights and print the levels and summary for the heights factor

Exercise 6

Create a factors of 10 random values between 1 and 100, with on repeating values and also check the variable is a factor

Exercise 7

Create a factor based on Age of students and plot a graph based on the age.

Exercise 8

Create a random factor based on 0 & 1 and give assign false for 0 and true for 1 and check the variable by print the type of the variable.

Exercise 9

Create a random factor based on 0 & 1 and give assign false for 0 and true for 1 and assign new 11 the value as False.

Exercise 10

Create a data Frame of dates and return of company and use zoo
to convert the data.

To leave a comment for the author, please follow the link and comment on their blog: R-exercises. 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


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)