# Articles by Maria Elisa Bertinat Tulipano

### List Vol.2 Exercises

December 27, 2016 |

Answers to the exercises are available here. Exercise 1 Consider 3 vectors, day, month and year: year=c(2005:2016) month=c(1:12) day=c(1:31) Define a list Date such as: Date= \$year [1] 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 \$month [1] 1 2 3 4 5 6 7 8 9 10 11 12 \$day […] [Read more...]

### Web Scraping Exercises

December 20, 2016 |

[For this exercise, before proceeding, first read the rvest package help and the selectorgadget help.] Answers to the exercises are available here. Exercise 1 Consider the url ‘http://statbel.fgov.be/en/statistics/figures/economy/indicators/prix_prod_con/’ Extract all the information load on table ‘Third Quarter 2016’. Exercise 2 Consider the ... [Read more...]

### Recursive Partitioning and Regression Trees Exercises

December 13, 2016 |

[For this exercise, we will work using the package rpart. This is a beginner level exercise. Please refer to the help of rpart package] Answers to the exercises are available here. Exercise 1 Consider the Kyphosis data frame(type help(‘kyphosis’) for more details), that contains: -Kyphosis:a factor with levels ... [Read more...]

### Matrix Vol. 2 Exercises

December 8, 2016 |

[For this exercise, first write down your answer, without using R. Then, check your answer using R.] Answers to the exercises are available here. Exercise 1 If M=matrix(c(1:10),nrow=5,ncol=2, dimnames=list(c('a','b','c','d','e'),c('A','B'))) What is the value of: M Exercise 2 Consider ... [Read more...]

### Functions exercises vol. 2

December 5, 2016 |

[For this exercise, first write down your answer, without using R. Then, check your answer using R.] Answers to the exercises are available here. Exercise 1 Create a function that given a data frame and a vector, will add a the vector (if the vector length match with the rows number ... [Read more...]

### Scripting Loops exercises Vol.2

December 1, 2016 |

[For this exercise, first write down your answer, without using R. Then, check your answer using R.] Answers to the exercises are available here. Exercise 1 Using the following variables: x=1 i=c(1:10) For this exercise, write a for() loop that increments x by two for each i. Exercise 2 Using the ... [Read more...]

### Data frame exercises Vol. 2

November 28, 2016 |

[In the exercises below we cover the basics of data frames.] Answers to the exercises are available here. Exercise 1 Consider two vectors: x=seq(1,43,along.with=Id) y=seq(-20,0,along.with=Id) Create a data.frame df: __df Id Letter x y 1 1 a 1.000000 -20.000000 2 1 b 4.818182 -18.181818 3 1 c 8.636364 -16.363636 4 2 a 12.454545 ... [Read more...]

### If else sequences Exercises

November 22, 2016 |

Answers to the exercises are available here. Exercise 1 What is the output of: ifelse(sqrt(9)9,sqrt(100),0) Exercise 3 What is the output y of: x=12 if(is.numeric(x)) y=x*2 Exercise 4 What is the output x,y of: z=-1 if(z [Read more...]

### Vectors Vol. 2 Exercises

November 15, 2016 |

[For this exercise, first write down your answer, without using R. Then, check your answer using R.] Answers to the exercises are available here. Exercise 1 Consider two vectors, x, y x=c(4,6,5,7,10,9,4,15) y=c(0,10,1,8,2,3,4,1) What is the value of: x*y Exercise 2 Consider two vectors, a, b a=c(1,2,4,5,6) b=... [Read more...]

### Regular Sequences Vol. 2 Exercises

November 9, 2016 |