This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
library("ggplot2") | |
crime <- read.csv("/Users/marcin/R/crime/crime.csv", header=TRUE) | |
mayors <- read.csv("/Users/marcin/R/crime/mayors.csv", header=TRUE) | |
(crimeplot <- qplot(Year, Murder, data=crime, geom="line",xlab = "", ylab = "No. Murders")) | |
crimeplot + geom_vline(aes(xintercept = start), data = mayors) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
row.names | name | start | end | party | |
---|---|---|---|---|---|
4 | Wagner Jr. | 1954 | 1965 | Democratic | |
5 | Lindsay | 1966 | 1973 | Liberal | |
6 | Beame | 1974 | 1977 | Democratic | |
7 | Koch | 1978 | 1989 | Democratic | |
8 | Dinkins | 1990 | 1993 | Democratic | |
9 | Giuliani | 1994 | 2001 | Republican | |
10 | Bloomberg | 2002 | 2011 | Republican |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Year | Population | Murder | Rape | Robbery | Assault | Burglary | CarTheft | |
---|---|---|---|---|---|---|---|---|
1965 | 18073000 | 836 | 2320 | 28182 | 27464 | 183443 | 58452 | |
1966 | 18258000 | 882 | 2439 | 30098 | 29142 | 196127 | 64368 | |
1967 | 18336000 | 996 | 2665 | 40202 | 31261 | 219157 | 83775 | |
1968 | 18113000 | 1185 | 2527 | 59857 | 34946 | 250918 | 104877 | |
1969 | 18321000 | 1324 | 2902 | 64754 | 36890 | 248477 | 115400 | |
1970 | 18190740 | 1444 | 2875 | 81149 | 39145 | 267474 | 125674 | |
1971 | 18391000 | 1823 | 3225 | 97682 | 42318 | 273704 | 127658 | |
1972 | 18366000 | 2026 | 4199 | 86391 | 45926 | 239886 | 105081 | |
1973 | 18265000 | 2040 | 4852 | 80795 | 47781 | 246246 | 112328 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; | |
; Opinion Lexicon: Negative | |
; | |
; This file contains a list of NEGATIVE opinion words (or sentiment words). | |
; | |
; This file and the papers can all be downloaded from | |
; http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html | |
; | |
; If you use this list, please cite one of the following two papers: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; | |
; | |
; Opinion Lexicon: Positive | |
; | |
; This file contains a list of POSITIVE opinion words (or sentiment words). | |
; | |
; This file and the papers can all be downloaded from | |
; http://www.cs.uic.edu/~liub/FBS/sentiment-analysis.html | |
; | |
; If you use this list, please cite one of the following two papers: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# load twitter library | |
library(twitteR) | |
# search for all the hilton tweets | |
hilton.tweets=searchTwitter('@hilton',n=1500) | |
length(hilton.tweets) | |
class(hilton.tweets) | |
tweet=hilton.tweets[[1]] | |
class(tweet) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#ggplot is an implementation of the grammar of graphics in R | |
library("ggplot2") | |
#Load the data into F1_POS dataframe | |
F1_POS <- read.csv("E:/R/f1/F1_POS.csv") | |
#The drivers are ordered by points, and the Salary variable converted to a factor for sorting. | |
F1_POS$Driver <- with(F1_POS, reorder(Driver, Salary)) | |
library("reshape2") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Driver | Salary | Australia | Malaysia | China | Turkey | Spain | Monaco | Canada | Europe | Great Britain | Germany | Hungary | Belgium | Italy | Singapore | Japan | Korea | India | Abu Dhabi | Brazil | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
Fernando Alonso | 30000000.00 | 4 | 6 | 7 | 3 | 5 | 2 | 25 | 2 | 1 | 2 | 3 | 4 | 3 | 4 | 2 | 5 | 3 | 2 | 4 | |
Lewis Hamilton | 16000000.00 | 2 | 8 | 1 | 4 | 2 | 6 | 25 | 4 | 4 | 1 | 4 | 25 | 4 | 5 | 5 | 2 | 7 | 1 | 25 | |
Felipe Massa | 10000000.00 | 7 | 5 | 6 | 11 | 25 | 25 | 6 | 5 | 5 | 5 | 6 | 8 | 6 | 9 | 7 | 6 | 25 | 5 | 5 | |
Jenson Button | 10000000.00 | 6 | 2 | 4 | 6 | 3 | 3 | 1 | 6 | 25 | 25 | 1 | 3 | 2 | 2 | 1 | 4 | 2 | 3 | 3 | |
Michael Schumacher | 8000000.00 | 25 | 9 | 8 | 12 | 6 | 25 | 4 | 17 | 9 | 8 | 25 | 5 | 5 | 25 | 6 | 25 | 5 | 7 | 15 | |
Nico Rosberg | 8000000.00 | 25 | 12 | 5 | 5 | 7 | 11 | 11 | 7 | 6 | 7 | 9 | 6 | 25 | 7 | 10 | 8 | 6 | 6 | 7 | |
Sebastian Vettel | 8000000.00 | 1 | 1 | 2 | 1 | 1 | 1 | 2 | 1 | 2 | 4 | 2 | 1 | 1 | 1 | 3 | 1 | 1 | 25 | 2 | |
Mark Webber | 8000000.00 | 5 | 4 | 3 | 2 | 4 | 4 | 3 | 3 | 3 | 3 | 5 | 2 | 25 | 3 | 4 | 3 | 4 | 4 | 1 | |
Jarno Trulli | 3000000.00 | 13 | 25 | 19 | 18 | 18 | 13 | 16 | 20 | 25 | 25 | 25 | 14 | 14 | 25 | 19 | 17 | 19 | 18 | 18 |