Skip to content

Commit

Permalink
Enable handling of https URLs. Resolves r-gregmisc#10.
Browse files Browse the repository at this point in the history
  • Loading branch information
warnes committed Dec 30, 2020
1 parent da00b9b commit fc40809
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
4 changes: 4 additions & 0 deletions R/isURL.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
isURL <- function(x)
{
sapply(x, function(X) any(startsWith(x, c("https://", "http://", "ftp://"))) )
}
8 changes: 6 additions & 2 deletions R/lookup.xport.R
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ lookup.xport <- function(file)
{
fname <- file

if(length(grep('http://', file))>0 || length(grep('ftp://', file))>0 )
if(isURL(file))
{
scat("Downloading file...")
tf <- tempfile()
Expand Down Expand Up @@ -64,10 +64,14 @@ summary.lookup.xport <- function(object, ...)
#' @export
print.summary.lookup.xport <- function(x, ...)
{
filname <- attr(x,"file")
if(Sys.getenv("RCMDCHECK") != "FALSE")


cat("\n")
cat("SAS xport file\n")
cat("--------------\n");
cat("Filename: `", attr(x,"file"), "'\n", sep="")
cat("Filename: `", filename, "'\n", sep="")
cat("\n")
for(dSetName in unique(x$dataset))
{
Expand Down
2 changes: 1 addition & 1 deletion R/read.xport.R
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ read.xport <- function(file,
on.exit(options(oldOptions))
}

if(length(grep('http://', file))>0 || length(grep('ftp://', file))>0 )
if(isURL(file))
{
scat("Downloading file...")
tf <- tempfile()
Expand Down

0 comments on commit fc40809

Please sign in to comment.