Created
March 7, 2012 02:20
-
-
Save johnjosephhorton/1990485 to your computer and use it in GitHub Desktop.
Code snipped for turning Postgresql stdout of a table into an R data frame
This file contains hidden or 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
get.sql.out <- function(file, nrows = -1){ | |
raw <- read.table(file, header=TRUE, nrow = nrows, sep="|", fill=TRUE, strip.white=TRUE) | |
num.rows <- dim(raw)[1] | |
raw$index <- 1:num.rows | |
raw <- subset(raw, index != 1 & index != num.rows) | |
raw | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment