Created
January 24, 2012 15:53
-
-
Save rogerallen/1670804 to your computer and use it in GitHub Desktop.
Roger's Utility Functions for R
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
# Roger's Utility Functions for R | |
# | |
# source("Documents/Devel/R/utils.R") | |
# | |
isMac <- function() | |
{ | |
x <- Sys.info()[1]=="Darwin" | |
x | |
} | |
# http://personality-project.org/r/Rfunc/read.clipboard.R | |
# | |
# Read clipboard from Excel for use as table | |
# (copy range in Excel, then run this function) | |
# foo <- readClipboardExcel() | |
# names(foo) | |
# | |
tableFromClipboardExcel <- function() | |
{ | |
if(isMac()) { | |
x <- read.table(pipe("pbpaste"),header=TRUE,sep="\t") | |
} else { | |
x <- read.table(text=readClipboard(), sep="\t", header=T) | |
} | |
x | |
} | |
# read csv from url | |
tableFromUrlCsv <- function(url,UPW) { | |
myCsv <- getURL(url,ssl.verifypeer = FALSE,userpwd=UPW) | |
myData <- read.csv(textConnection(myCsv)) | |
myData | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment