stat133fa10CompleteNotes - Statistics 133: Concepts in...

Info iconThis preview shows pages 1–17. Sign up to view the full content.

View Full Document Right Arrow Icon
Statistics 133: Concepts in Computing with Data Instructor: Dr. Cari Kaufman cgk@stat.berkeley.edu GSI: Nathan Boley nboley@berkeley.edu 1
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
What Are Data? 2
Background image of page 2
Numbers Example: TrafFc on I-80 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Dates, Times, Locations Example: Flight information 4
Background image of page 4
Text Example: SPAM or HAM? 5
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Images, video, or audio Example: Radiohead “House of Cards” video Lidar and GeoVideo used to create 3-dimensional images without lights or cameras. 6
Background image of page 6
Meta-data Example: Shelters along the Applachian trail 7
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Getting Started with R 8
Background image of page 8
Why use R? Some of you may have used statistical software with a GUI, like Minitab or SPSS. You may also be familiar with other programming languages, like C, Java, Python, etc. In this class, we’ll use the R programming language and environment as our “home base” for performing many data analytic tasks. Some beneFts of R: Allows custom analyses and easy replicability High level language designed for statistics Active user community, lots of add-ons It’s free! 9
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A screenshot from http://www.R-project.org / 10
Background image of page 10
R can be run in interactive or batch modes. The interactive mode is useful for trying out new analyses and making sure your code is doing what you think it is. The batch mode is useful for carrying out pre-deFned analyses in the background. ±or now, we’ll focus on the interactive mode. When you Fre up R, you’ll see a prompt, like this: 11
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
At the prompt, you can type an expression . An expression is a combination of letters/numbers/symbols which are interpreted by a particular programming language according to its rules. It then returns a value. We can also say it evaluates to that value. > 3 + 5 [1] 8 > 1:20 [1] 1 2 3 4 5 6 7 8 9 10 11 12 13 [14] 14 15 16 17 18 19 20 > > # This is a comment > > 30 + 10 / # I'm not done typing + 2 [1] 35 12
Background image of page 12
Writing Expressions in R 13
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
To store a value for later, we can assign it to a variable . > x1 <- 32 %% 5 > print(x1) [1] 2 > x2 <- 32 %/% 5 > x2 # In interactive mode, this prints the object [1] 6 > ls() # List all my variables [1] "x1" "x2" > rm(x2) # Remove a variable > ls() [1] "x1" = ” and “ <- ” are both valid assignment operators in R. Choose one and use it consistently. As we’ll see “ == means something completely different. 14
Background image of page 14
Variable names must follow some rules: May not start with a digit or underscore (_) May contain numbers, characters, and some punctuation - period and underscore are ok, but most others are not Case-sensitive, so x and X are different Advice on variable names: Use meaningful names Avoid names that already have a meaning in R. If in doubt, check: > exists("pi") [1] TRUE 15
Background image of page 15

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
A function is a portion of code that performs a speciFc task. Usually it takes some inputs, performs some computations, and returns a value. The inputs are called arguments to the function. When you use a function with a particular set of arguments, you are set to be calling the function. The computer evaluates the function call and returns the output.
Background image of page 16
Image of page 17
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 386

stat133fa10CompleteNotes - Statistics 133: Concepts in...

This preview shows document pages 1 - 17. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online