Main Page/Research/MSB/Scripts/msb.get.data.R

From phurvitz
< Main Page‎ | Research‎ | MSB‎ | Scripts
Jump to: navigation, search
# downloading data
# usage:
# source ("/home/phurvitz/public_html/msb/tools/msb.get.data.R")
# get.data(sid)
# e.g., "get.data("s56")

# main function
get.data <- function(sid) {
    cat("downloading data from ubi\n")
    # save the current dir
    current.dir <- getwd()
    # change to the proper dir for downloading
    setwd("/home/phurvitz/public_html/msb/processed_data/processed")
    # source URL
    source.url <- paste("http://www.cs.washington.edu/research/projects/ubicomp3/phurvitz/data", "/", sid, sep="");
    # make a wget command
    command.wget <- paste("wget -np -nv -r -nH --mirror --accept=png,csv,kml --reject=html,htm,txt",
        "--http-user=phurvitz --http-passwd=phurvitz", source.url, sep=" ")
    cat(paste(command.wget,"\n", sep=""))
    # do the download
    system(command.wget)
    # change back to the current dir
    setwd(current.dir)
}