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
<form method="post"> | |
<dl> | |
<% for(i=0; i<=itemTypes.length-1; i++) { %> | |
<dt><input type="checkbox" name="itemChoices" value="<%= itemTypes[i].itemTypeName %>"/> <strong><%= itemTypes[i].itemTypeName %></strong></dt> | |
<dd>Dominence Points: <%= itemTypes[i].domPts %><dd> | |
<dd>Picture: <%= itemTypes[i].picture %><dd> | |
<select> | |
<% for (r=rooms.length-1; r>=0; r--) { %> | |
<option value="<%= rooms[r].name %>"><%= rooms[r].name %></option> | |
<% } %> |
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
#Read in the data, save it to variable 'data' | |
data = read.csv("http://www.jakeporway.com/teaching/data/snf_11_2011_1.csv", header=TRUE, as.is=TRUE) | |
#How many women were stopped? | |
sum(data$sex == "F") | |
#[1] 3927 | |
#What percentage of the stops is this? | |
sum(data$sex == "F") / length(data$sex) * 100 | |
#[1] 6.760316 |
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
# Write code to return the percentage of people who were frisked for each | |
# race. In other words, count up the number of people who were frisked for a given race | |
# divided by the number of people of that race stopped. Which race leads to the highest | |
# percentage of frisks? Which one the lowest? | |
#read in the data | |
snf <- read.csv("http://www.jakeporway.com/teaching/data/snf_2.csv", as.is=TRUE) | |
#race1 is black | |
race1.in.total = table(snf$race ==1) |
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
#How many unique users have more than 100000 followers? What are their screen names? | |
tweets <- read.csv("/Users/michelleboisson/Documents/ITP/* Data without Borders/hw3/libya_tweets.csv", as.is=TRUE) | |
unique(tweets$screen_name[which(as.numeric(tweets$followers) >= 100000)]) | |
# [1] "detikcom" "DonLemonCNN" "HuffingtonPost" "Dputamadre" "WorldRss" "AlMasryAlYoum" | |
# [7] "theobscurant" "fadjroeL" "TPO_Hisself" "CAPAMAG" "TwittyAlgeria" "foxandfriends" | |
# [13] "PranayGupte" | |
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
video | time | person | behavior | id | real_time | |
---|---|---|---|---|---|---|
1 | 5:00 | girl in white hoodie | stretched shoulders | 1 | 12:35:00 | |
1 | 8:00 | sean | arms up stretch | 2 | 12:38:00 | |
1 | 9:30 | guy in green shirt infront of sean | arms up stretch | 3 | 12:39:30 | |
1 | 13:31 | sean | stretched back | 2 | 12:43:31 | |
1 | 15:38 | plaids shirt guy | brisk back bend | 4 | 12:45:38 | |
1 | 16:01 | guy in green shirt in front of sean | brisk back bend | 3 | 12:46:01 | |
1 | 17:57 | girl in white hoodie | wrist stretch | 1 | 12:47:57 | |
1 | 19:43 | girl in white hoodie | wrist stretch | 1 | 12:49:43 | |
1 | 20:48 | guy in green | hands behind neck stretch | 3 | 12:50:48 |
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
#include <Servo.h> // include the servo library | |
Servo servoMotor; // creates an instance of the servo object to control a servo | |
int servoPin = 2; // Control pin for servo motor | |
int pos = 0; // variable to store the servo position | |
int now, previousTime, interval = 0; | |
//for smoothing of values |
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
# Let’s breakdown our tweets around a certain topic. How about, oh, say, Iran? | |
# So how do we pull tweets out that have a certain word in them? | |
# grep() to the rescue! If you’ve used the grep function on the command-line, this | |
# should look familiar. grep() takes as arguments a phrase you’re searching for, a | |
# set of text to look through, and optional arguments about how to search. It will | |
# then return the row numbers of any rows that match your search. To pull out Iran | |
# tweets, we can use the code: | |
iran.tweets <- tweets[grep(“iran”, ignore.case=TRUE, tweets$text), ] |
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
# CRIME MAPPING | |
#We’ve done some basic analysis of our Stop and Frisk data this semester, looking at | |
#basic statistics (e.g. number of stops by race or most common crimes by race) and | |
#timeseries information. We haven’t yet touched geography though. Let’s spend this | |
#week’s assignment answering the question: Where are Stop n Frisks happening in New | |
#York? | |
snf = read.csv("/Users/michelleboisson/Documents/ITP/* Data without Borders/snf_3.csv", as.is=TRUE) | |
geo = read.csv("/Users/michelleboisson/Documents/ITP/* Data without Borders/geo.csv", as.is=TRUE) |
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
#Describing Distributions | |
snf = read.csv("http://jakeporway.com/teaching/data/snf_4.csv", head=T, as.is=T) | |
#Make a “height” column for your data that is the total number of inches tall each person is. | |
heights = apply(snf,1, function(x) { as.numeric(x['feet'])*12 + as.numeric(x['inches']) }) | |
snf$fullheight = heights | |
mean(heights) | |
#[1] 68.57884 |
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
/** | |
* <p>This uses the Ketai Sensor Library for Android: http://ketaiMotion.org</p> | |
* | |
* | |
*/ | |
import ketai.sensors.*; | |
KetaiSensor sensor; |
OlderNewer