A few fixes

This commit is contained in:
Adam 2013-06-29 08:52:41 -07:00
parent c3083760f6
commit 6e3e273451
2 changed files with 14 additions and 14 deletions

View File

@ -1,5 +1,5 @@
--- ---
language: Dart language: dart
author: Joao Pedrosa author: Joao Pedrosa
author_url: https://github.com/jpedrosa/ author_url: https://github.com/jpedrosa/
--- ---

View File

@ -7,7 +7,7 @@ author_url: http://github.com/e99n09
R is a statistical computing language. R is a statistical computing language.
```r ```python
# Comments start with hashtags. # Comments start with hashtags.
@ -16,9 +16,9 @@ R is a statistical computing language.
# Protip: hit COMMAND-ENTER to execute a line # Protip: hit COMMAND-ENTER to execute a line
################################################################################### #########################
# The absolute basics # The absolute basics
################################################################################### #########################
# NUMERICS # NUMERICS
@ -119,9 +119,9 @@ myFunc <- function(x) {
# Called like any other R function: # Called like any other R function:
myFunc(5) # => [1] 19 myFunc(5) # => [1] 19
################################################################################### #########################
# Fun with data: vectors, matrices, data frames, and arrays # Fun with data: vectors, matrices, data frames, and arrays
################################################################################### #########################
# ONE-DIMENSIONAL # ONE-DIMENSIONAL
@ -243,7 +243,7 @@ array(c(c(c(2,300,4),c(8,9,0)),c(c(5,60,0),c(66,7,847))), dim=c(3,2,2))
# LISTS (MULTI-DIMENSIONAL, POSSIBLY RAGGED, OF DIFFERENT TYPES) # LISTS (MULTI-DIMENSIONAL, POSSIBLY RAGGED, OF DIFFERENT TYPES)
# Finally, R has lists (of vectors) # Finally, R has lists (of vectors)
list1 <- list(time = 1:40, price = c(rnorm(40,.5*list1$time,4))) # generate random list1 <- list(time = 1:40, price = c(rnorm(40,.5*list1$time,4))) # random
list1 list1
# You can get items in the list like so # You can get items in the list like so
@ -251,9 +251,9 @@ list1$time
# You can subset list items like vectors # You can subset list items like vectors
list1$price[4] list1$price[4]
################################################################################### #########################
# The apply() family of functions # The apply() family of functions
################################################################################### #########################
# Remember mat? # Remember mat?
mat mat
@ -281,9 +281,9 @@ install.packages("plyr")
require(plyr) require(plyr)
?plyr ?plyr
################################################################################### #########################
# Loading data # Loading data
################################################################################### #########################
# "pets.csv" is a file on the internet # "pets.csv" is a file on the internet
pets <- read.csv("http://learnxinyminutes.com/docs/pets.csv") pets <- read.csv("http://learnxinyminutes.com/docs/pets.csv")
@ -292,14 +292,14 @@ head(pets, 2) # first two rows
tail(pets, 1) # last row tail(pets, 1) # last row
# To save a data frame or matrix as a .csv file # To save a data frame or matrix as a .csv file
write.csv(pets, "pets2.csv") # to make a new .csv file in the working directory write.csv(pets, "pets2.csv") # to make a new .csv file
# set working directory with setwd(), look it up with getwd() # set working directory with setwd(), look it up with getwd()
# Try ?read.csv and ?write.csv for more information # Try ?read.csv and ?write.csv for more information
################################################################################### #########################
# Plots # Plots
################################################################################### #########################
# Scatterplots! # Scatterplots!
plot(list1$time, list1$price, main = "fake data") plot(list1$time, list1$price, main = "fake data")