# Blog Archives

## List Vol.2 Exercises

December 27, 2016
By 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 2005 2006 2007 2008 2009 2010 2011 2012 2013 2014 2015 2016 \$month 1 2 3 4 5 6 7 8 9 10 11 12 \$day

## Web Scraping Exercises

December 20, 2016
By 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 url ‘http://www2.sas.com/proceedings/sugi30/toc.html’ Extract all the papers names, from 001-30 to 268-30 Exercise 3

## Recursive Partitioning and Regression Trees Exercises

December 13, 2016
By 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 absent present indicating if a kyphosis (a

## Matrix Vol. 2 Exercises 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 the matrix M, What is the value of: M M M M Exercise 3 Consider the matrix

## Functions exercises vol. 2 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 of the data frame)

## Scripting Loops exercises Vol.2 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 following variables: x=1 y=40

## Data frame exercises Vol. 2

November 28, 2016
By 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 -14.545455 5

## If else sequences Exercises

November 22, 2016
By 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

## Vectors Vol. 2 Exercises

November 15, 2016
By 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=c(3,2,4,1,9) What is the value of: cbind(a,b) Exercise

## Regular Sequences Vol. 2 Exercises Answers to the exercises are available here. Exercise 1 if x