Week 2

Lab 1

Monday, Sep 2

GitHub


Shell, git, and GitHub

Tuesday, Sep 3

Learning objectives

  • Version control with git and GitHub
  • Best practices with git
  • *NIX, bash, and the terminal
  • Basic command line use
  • git on the command line

Materials


Data structures and subsetting

Thursday, Sep 5

Learning objectives

  • Attributes
  • Create data frames, matrices, and arrays using attributes
  • Subset atomic vectors
  • Subset generic vectors

Materials


Exercise of the week

Part 1

Create date and date-time objects using function attr() or attributes(). Start with what these types of objects are built on.

Part 2

Consider the atomic vector x.

set.seed(962019)
x <- sample(1:100, size = 100, replace = TRUE)
x
##   [1]  11  59  87  29  72  16  14  32  66   4  31  68  37 100  35   1  10
##  [18]  72  54  29  50   3  79  98  46  65  15   9  42  39  64  52  65   8
##  [35]   5 100  26  31  83  10  47   2  62  97  75  92  54  18  76  89  90
##  [52]  84  78  93  98   2  25  49  67  54  87  28  53  79  12  10  71  95
##  [69]  59  48  21  38  16  14  51  13  85  82   4  45  32  58  27  75  80
##  [86]   6  24  68   6  38  46  25   9  36  50  67  17  89  71  63

Use subsetting to

  1. select every third values from x beginning at position 2;

  2. remove all values with an odd index;

  3. remove every 4th value, but only if it is odd;

  4. remove all numbers divisible by 3 or 7 and replace them with 0.

Previous
Next