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
<?php | |
require_once 'login.php'; | |
$db_server = mysql_connect($db_hostname, $db_username, $db_password); | |
if (!$db_server) die("Unable to connect to MySQL: " . mysql_error()); | |
mysql_select_db($db_database, $db_server) | |
or die("Unabale to select database: " . mysql_error()); | |
$url_query = "SELECT url FROM guides"; |
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
<?php // login.php | |
$db_hostname = 'localhost'; // whatever hostname actually is | |
$db_database = 'law_lib_guides'; | |
$db_username = 'username'; //possibly root? | |
$db_password = 'password'; // also possibly root | |
?> |
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
oztemp <- hw1_data[,hw1_data$Ozone > 31 && hw1_data$Temp > 90] ## hw1_data is the full data fram I'm working with | |
## I'm trying to get all of the rows where the value in the Ozone column is above 32 and the values in the Temp column are above 90 | |
## instead oztemp is a data frame w/ 0 columns and 153 rows (there are 153 rows in the data frame) |
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
> setwd("~/Downloads") | |
> hw1_data <- read.csv("hw1_Data.csv", header = TRUE) | |
> colnames(hw1_data) | |
[1] "Ozone" "Solar.R" "Wind" "Temp" "Month" "Day" | |
> tworows <- hw1_data[1:2,] | |
> tworows | |
Ozone Solar.R Wind Temp Month Day | |
1 41 190 7.4 67 5 1 | |
2 36 118 8.0 72 5 2 | |
> nrow(hw1_data) |
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
makeVector <- function(x = numeric()) { | |
m <- NULL | |
set <- function(y) { | |
x <<- y | |
m <<- NULL | |
} | |
get <- function() x | |
setmean <- function(mean) m <<- mean | |
getmean <- function() m | |
list(set = set, get = get, |
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
pollutantmean <- function(directory, pollutant, id) { | |
currentdir <- getwd() | |
if (currentdir != ~directory){ | |
setwd(~directory) ## returns Error in setwd(directory): cannot change working directory | |
} | |
monitorinfo <-read.csv(id)## takes id and reads that .CSV file | |
## will monitorinfo work if given a sequence e.g, 1:10? | |
pollutantcol <- monitorinfo[,pollutant] | |
pollutantcolnoNAs <- pollutantcol[!is.na(pollutantcol)] ## gets rid of NAs | |
meanpol <- mean(pollutantcolnoNAs) |
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
pollutantmean <- function(directory, pollutant, id = 1:332) { | |
files <- sprintf("%s/%03d.csv", directory, id) | |
measurements <- c() | |
for (file in files) { | |
frame <- read.csv(file) | |
file_measurements <- frame[[pollutant]] | |
measurements <- c(measurements, file_measurements) | |
} | |
mean(measurements, na.rm = 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
best <- function(state, outcome){ | |
outcome_data <-read.csv("outcome-of-care-measures.csv", colClasses = "character") | |
## | |
state_options <- outcome_data[,7] | |
if(state %in% state_options){} | |
else | |
{ | |
stop("invalid state") | |
} | |
if(outcome !="heart attack"){break} |
OlderNewer