Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

profvis breaks for URL-sources, with rather mysterious error message #73

Closed
fabian-s opened this issue Nov 16, 2016 · 3 comments
Closed

Comments

@fabian-s
Copy link

 source("http://www.statistik.lmu.de/~scheipl/downloads/fortprog/slow_sim.R")
 set.seed <- 232323
 observations <- 5000
 covariates <- 10
 testdata <- as.data.frame(matrix(rnorm(observations * covariates),
                                  nrow = observations))
 
library(profvis)
profvis(expr = simulate(reps = 100, seed = 20141028, data = testdata))

## Error in readChar(filename, file.info(filename)$size, useBytes = TRUE) : 
##  invalid 'nchars' argument
traceback()
##6: readChar(filename, file.info(filename)$size, useBytes = TRUE)
##5: FUN(X[[i]], ...)
##4: lapply(filenames, function(filename) {
##       if (filename == "<expr>") {
##          return(expr_source)
##       }
##       filehandle <- tryCatch(file(filename, "rb"), error = function(e) NULL, 
##           warning = function(e) NULL)
##       if (is.null(filehandle)) {
##           return(extract_source_from_srcref(filename, srcref_cache))
##       }
##       on.exit(close(filehandle))
##       readChar(filename, file.info(filename)$size, useBytes = TRUE)
##   })
##3: get_file_contents(filenames, expr_source)
##2: parse_rprof(prof_output, expr_source)
##1: profvis(expr = simulate(reps = 100, seed = 20141028, data = testdata))

Issue is that file.info(file) only returns list of NAs if file is an URL.

@wch wch closed this as completed in 710de76 Nov 16, 2016
@wch
Copy link
Member

wch commented Nov 16, 2016

Thanks for the report! It should be fixed now.

@wch
Copy link
Member

wch commented Nov 16, 2016

That is, it won't error, and won't try to load the remote sources.

@fabian-s
Copy link
Author

Man, you're too fast -- I just wanted to send you a pull request with a similar patch...

You guys are amazing, thanks for all the great packages and the awesome support!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants