3 <TITLE> CSC
120 - Computer Science for the Sciences (R section, L0201)
5 <base href=
"http://www.cs.utoronto.ca/~radford/csc120/" />
8 <H1> CSC
120 - Computer Science for the Sciences (R section, L0201,
11 <B>The handout for Assignment
1 is now available below, and a
12 clarifying note is also below. Note that it is due at the start of
13 lecture February
26, three days later than originally scheduled.
15 <P>Office hours on February
25 will be from
2:
30 to
3:
30.
17 <P>Remember that there is a Quiz on February
26!
19 <P>INSTRUCTION FOR HANDING IN ASSIGNMENT
1:
21 <P>You should hand in your assignment by emailing it to
<BLOCKQUOTE>
22 <TT>radford@cdf.utoronto.ca
</TT>
25 <P>You should NOT email your assignment to any other email address.
26 In particular, you should NOT send it to my regular email address for
27 other course correspondence.
29 <P>Your email should have the following subject line:
<BLOCKQUOTE>
30 <TT>A1,
9999999999, Lastname, Firstname
</TT>
32 Here,
9999999999 is your student ID number, Lastname is your family name,
33 and Firstname is your given name.
35 <P>The body of your email can be anything. (It could be
36 a note to me if you have some reason to say something.)
38 <P>Your email should have five attachments:
<UL>
39 <LI>The R script file containing your function definitions, called a1funs.r
40 <LI>The R script file that runs
<TT>find_pairings
</TT> on the test data,
42 <LI>The text output of this script, which should give the total distance
43 found after improving each random pairing, called a1out.txt
44 <LI>The PDF file for the plot of pairings obtained using ten random pairings
45 with the random seed set to
1, called a1plot1.pdf
46 <LI>The plot of pairings obtained using one random pairing with the random
47 set to your student ID number, called a1plot2.pdf
50 <P>You can create a text file with the text output by creating a text
51 file with File
> New File
> Text File in RStudio, then copying
54 <P>You can create a file with a plot using the Export menu in the RStudio
55 plot window (choose
"as PDF"). You can move back and forth between
56 multiple plots using the left and right arrows in the plot window.
60 <P>CSC
120 L0201 is an introduction to programming using the R language,
61 which is widely used for statistical applications. It is designed for
62 students with no programming experience, who are either planning to
63 specialize in statistics or who expect to use statistics extensively
64 while studying other fields.
66 <P>Students in other areas of science may wish to take
<A
67 HREF=
"http://www.cs.utoronto.ca/~drosu/csc120-winter2016.html">section
68 L0101 of CSC
120</A>, which uses the Python language. Students who
69 plan on taking further courses in CS may wish to take CSC
108 instead
70 of CSC
120, and then take CSC
148. It is possible to take CSC
148
71 after CSC
120 without taking CSC
108, but to do so you will have to
72 pick up some material on your own.
74 <P><B>Instructor:
</B> <A HREF=
"http://www.cs.toronto.edu/~radford/">
75 Radford Neal
</A>,
<B>Office:
</B> SS6026A / PT384,
77 <A HREF=
"mailto:radford@cs.utoronto.ca">radford@cs.utoronto.ca
</A>
79 <P><B>Office hours:
</B> Thursdays,
2:
10 to
3:
00, in SS6026A.
81 <P><B>Lectures and Tutorials/Labs:
</B></P>
83 Lectures: Tuesdays and Fridays,
3:
10-
4:
00pm, MP202.
<BR>
84 Tutorials/Labs: Wednesdays,
1:
10-
3:
00, CDF lab, room BA3185 (& others).
86 <P>Labs will start January
13.
87 The lab the first week will be to make sure you know how to log
88 into the CDF computers, start up R using Rstudio, and do simple things in R.
89 If you have a laptop computer, you should bring it, so you can also learn
90 how to install R and Rstudio on it. Later labs will involve
91 non-credit excercises, which will prepare you for assignments,
92 quizzes, and the exam.
97 21% - Three
30-minute quizzes (
7% each), written during lectures
98 on January
29, February
26, and March
18.
<BR>
99 30% - Three assignments (
10% each), due at start of lectures
100 on February
26, March
22, and April
8.
<BR>
101 49% - Final exam (scheduled by the Faculty).
103 <P><B>You must get at least
40% on the final exam to pass the course
</B>.
104 If you don't, your final grade will be less than
50 regardless of your
105 other grades in this course.
107 <P>Assignments will be done by students individually.
109 <P>Assignments may be handed in late by the date and time specified
110 on the handout with a
20% penalty. Later assignments will not be accepted.
112 <P>Students with a
<B>valid
</B> medical or other excuse will of course not
113 be penalized for late assignments, or for missing a quiz.
114 You must, however, contact the instructor (eg, by email) as soon as possible
115 (preferrably beforehand) if you are not able to hand in an assignment
119 <P><B>Getting and Using R:
</B>
121 <P>You will use R via Rstudio on the
<A HREF=
"http://www.cdf.utoronto.ca">CDF
122 computer system
</A>, on which you should automatically have an account
123 if you are registered in this course. To start Rstudio,
124 you need to open a terminal window, and then type
"rstudio".
126 <P>You can also install R and Rstudio (for free) on your own laptop or
127 desktop computer. You can download R from
<A
128 HREF=
"http://r-project.org">r-project.org
</A>, and
129 Rstudio from
<A HREF=
"http://rstudio.com">rstudio.com
</A>.
131 <P>The lab in the first week (January
13,
1:
10-
3:
00pm) will help you get
132 started on these things.
136 <P><B>Documentation on R:
</B>
138 There is no textbook for this course (lecture slides are below).
139 However, here are links to some on-line documentation on R:
141 <P><A HREF=
"http://cran.r-project.org/doc/manuals/R-intro.html">
142 Introduction to R (R Core Team)
</A>.
<BR>
143 <A HREF=
"http://cran.r-project.org/doc/manuals/R-lang.html">
144 R Language Definition (R Core Team)
</A>.
<BR>
145 <A HREF=
"http://www.r-tutor.com/r-introduction">Introduction to some
146 aspects of R (Chi Yau)
</A>.
<BR>
147 <A HREF=
"http://adv-r.had.co.nz/">Advanced R (Hadley Wickham)
</A>.
151 <P><B>Lecture Slides:
</B>
155 <P>Slides for the lectures will be posted here as they become available.
157 <P><a href=
"week1.pdf">Week
1</a>: Introduction, numeric and character data,
159 mathematical functions, string functions
<I>paste
</I>
160 and
<I>substring
</I>), variables and assignment,
162 <I>length
</I>, vector arithmetic and subscripting,
163 plotting vectors. The iris demo program is
164 <A HREF=
"iris-demo.r">here
</A>.
166 <P><a href=
"week2.pdf">Week
2</a>: R scripts done with
<I>source
</I>,
167 functions
<I>scan
</I>,
<I>mean
</I>,
<I>sd
</I>,
169 defining functions, multiple steps with curly brackets,
170 input and output with
<I>readLines
</I> and
<I>cat
</I>.
171 <P><a href=
"week3.pdf">Week
3</a>: Using
<I>if
</I>,
<I>for
</I>,
173 logical data and comparison operations, sequences
175 <P><a href=
"week4.pdf">Week
4</a>: Making vectors with
<I>rep
</I> and
176 <I>seq
</I>, matrices, matrix indexing,
<I>cbind
</I> and
177 <I>rbind
</I>, perspective and contour plots, named and
178 optional arguments, more on plots, random number
180 with
<I>runif
</I>,
<I>sample
</I>, and
<I>set.seed
</I>.
181 <P><a href=
"week5.pdf">Week
5</a>: Lists, using lists to return multiple values,
182 more on random number generation, random walks.
183 <P><a href=
"week6.pdf">Week
6</a>: Environments, local and global variables
187 <P><B>Lab Exercises:
</B>
189 January
13: Logging in to CDF, and then starting up R using RStudio.
190 Installing R and RStudio on your laptop (if you bring one).
191 Simple operations in R.
<BR>
192 January
20:
<A HREF=
"labex2.pdf">handout
</A>. Solution scripts:
193 <A HREF=
"labex2a.r">Part A
</A>,
<A HREF=
"labex2b.r">Part B
</A>.
<BR>
194 January
27:
<A HREF=
"labex3.pdf">handout
</A>,
195 <A HREF=
"lab3defs.R">solutions
</A>.
<BR>
196 February
3:
<A HREF=
"labex4.pdf">handout
</A>,
197 <A HREF=
"lab4defs.r">function definitions
</A>,
198 <A HREF=
"lab4script.r">script to try them
</A>.
<BR>
199 February
10:
<A HREF=
"labex5.pdf">handout
</A>,
200 <A HREF=
"randomwalk.r">random walk function
</A>,
201 <A HREF=
"lab5defs.r">function definitions
</A>,
202 <A HREF=
"lab5script.r">script to try them
</A>.
<BR>
203 February
24:
<A HREF=
"labex6.pdf">handout
</A>,
204 <A HREF=
"dots.R">Part I solution
</A>,
205 <A HREF=
"records.R">Part II solution
</A>.
208 <P><B>Assignments:
</B>
210 Assignment
1:
<A HREF=
"ass1.pdf">handout
</A>. Clarification: Note that the
211 <TT>find_pairings
</TT> function should, for each random set of initial
212 pairings, call
<TT>improve_pairings
</TT> repeatedly (not just once), until
213 <TT>improve_pairings
</TT> is not able to reduce the total distance.
218 Quiz
1:
<A HREF=
"quiz1.pdf">questions
</A>, plus
219 <A HREF=
"quiz1-ans.pdf">answers
</A>.
222 <P><b>Web page for a previous version of the course:
</b>
224 <a href=
"../csc120.S15">Spring
2015</A>