Permalink
Browse files

init import

  • Loading branch information...
1 parent fc41102 commit a8f83e2fc602caf2dfd6b277191419cf7ae62fab @tavisrudd committed May 18, 2011
Showing with 132 additions and 0 deletions.
  1. +132 −0 exercises/README.txt
View
@@ -0,0 +1,132 @@
+ README
+ ======
+
+Author: Tavis Rudd
+Date: 2011-05-17 17:01:35 PDT
+
+
+Table of Contents
+=================
+1 hello world
+2 hello.world function
+3 create an anonymous version of the same function
+4 use Google to figure out what R's rules are for naming variables and functions
+5 hello(name) function
+6 hello(name) with a default argument
+7 create a `vector` of the following strings and assign it to a variable
+8 use help.search to find a function that can convert each element in that vector to uppercase
+9 find a function that will give you the length of the vector
+10 figure out the syntax to get the third element in the vector
+11 create a function that applies another function to each element in a vector
+12 find a function that will create a sequence of integers
+13 use that function and the `matrix` function to create a 4 x 5 matrix of the first 20 natural numbers
+14 figure out the syntax to get the matrix element at row 2, col 3
+15 multiply every element in the matrix by 3
+16 find a function that gives you the dimensions of the matrix
+17 convert this matrix to a vector
+18 create a Boolean matrix of the same size
+19 use the Boolean matrix to take a subset of our first matrix
+20 what is the type of the subset
+21 figure out how to create a random sample of 100 integers
+22 take a random sample of five elements from your first matrix
+23 find the built-in dataset `swiss` and the help information about it
+24 what are the `type`, `dimensions`, `structure`, and `dimension names` of this dataset
+25 figure out how to access each column of this dataset individually
+26 show the first and last six elements of this dataset
+27 what are the types of the columns in `swiss`
+
+
+1 hello world
+--------------
+Start the R interpreter and print the string "hello world"
+
+2 hello.world function
+-----------------------
+Create a function called hello.world that does what you did manually
+in the previous exercise.
+
+3 create an anonymous version of the same function
+---------------------------------------------------
+
+4 use Google to figure out what R's rules are for naming variables and functions
+---------------------------------------------------------------------------------
+
+5 hello(name) function
+-----------------------
+Create a variant of the previous function that accepts a `name`
+parameter and prints "Hello Mary", "Hello Lamb", etc.
+
+Hint: you'll need to figure out how to concatenate/join strings
+
+6 hello(name) with a default argument
+--------------------------------------
+Give the `name` argument a default value.
+
+7 create a `vector` of the following strings and assign it to a variable
+-------------------------------------------------------------------------
+"Mary", "had", "a", "little", "lamb"
+
+8 use help.search to find a function that can convert each element in that vector to uppercase
+-----------------------------------------------------------------------------------------------
+
+9 find a function that will give you the length of the vector
+--------------------------------------------------------------
+
+10 figure out the syntax to get the third element in the vector
+----------------------------------------------------------------
+
+11 create a function that applies another function to each element in a vector
+-------------------------------------------------------------------------------
+
+12 find a function that will create a sequence of integers
+-----------------------------------------------------------
+This is like the `range` function in Python.
+
+13 use that function and the `matrix` function to create a 4 x 5 matrix of the first 20 natural numbers
+--------------------------------------------------------------------------------------------------------
+
+14 figure out the syntax to get the matrix element at row 2, col 3
+-------------------------------------------------------------------
+
+15 multiply every element in the matrix by 3
+---------------------------------------------
+
+16 find a function that gives you the dimensions of the matrix
+---------------------------------------------------------------
+
+17 convert this matrix to a vector
+-----------------------------------
+
+18 create a Boolean matrix of the same size
+--------------------------------------------
+... that indicates whether the elements in our first matrix are > 13
+
+19 use the Boolean matrix to take a subset of our first matrix
+---------------------------------------------------------------
+... where the condition is true
+... and where it is false
+
+20 what is the type of the subset
+----------------------------------
+
+21 figure out how to create a random sample of 100 integers
+------------------------------------------------------------
+
+22 take a random sample of five elements from your first matrix
+----------------------------------------------------------------
+
+23 find the built-in dataset `swiss` and the help information about it
+-----------------------------------------------------------------------
+
+24 what are the `type`, `dimensions`, `structure`, and `dimension names` of this dataset
+-----------------------------------------------------------------------------------------
+
+25 figure out how to access each column of this dataset individually
+---------------------------------------------------------------------
+
+26 show the first and last six elements of this dataset
+--------------------------------------------------------
+hint: there are built in functions that will do this for you
+
+27 what are the types of the columns in `swiss`
+------------------------------------------------

0 comments on commit a8f83e2

Please sign in to comment.