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

wd() fails without paramater path #374

Closed
thomaskern opened this Issue Nov 17, 2013 · 0 comments

Comments

Projects
None yet
1 participant
@thomaskern

thomaskern commented Nov 17, 2013

Function wd() throws an exception when parameter path is left untouched, even inside a package.

setwd("~/ggplot2")
wd()

results in

> wd()
Error in if (!file.exists(path)) { : argument is of length zero
> traceback()
1: wd()

On the other hand, passing an empty character vector works:

wd(path="")
Changing working directory to /Users/bosie/ggplot2/

I would argue that according to the docs, this behavior is not expected. If it is, the default value NULL for parameter path should be removed and path should not be optional but mandatory.

Setup:

> sessionInfo()
R version 3.0.2 (2013-09-25)
Platform: x86_64-apple-darwin10.8.0 (64-bit)

locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8

attached base packages:
[1] graphics  grDevices utils     datasets  stats     methods   base     

other attached packages:
 [1] ggHorizon_0.1      roxygen2_2.2.2     digest_0.6.3       proto_0.3-10       RColorBrewer_1.0-5
 [6] plyr_1.8           maps_2.3-6         devtools_1.3       ggplot2_0.9.3.1.99 vimcom.plus_0.9-9 

loaded via a namespace (and not attached):
 [1] brew_1.0-6       colorspace_1.2-4 dichromat_2.0-0  evaluate_0.5.1   grid_3.0.2       gtable_0.1.2    
 [7] httr_0.2         labeling_0.2     MASS_7.3-29      memoise_0.1      munsell_0.4.2    parallel_3.0.2  
[13] RCurl_1.95-4.1   reshape2_1.2.2   scales_0.2.3     stringr_0.6.2    tools_3.0.2      whisker_0.3-2   

@hadley hadley closed this in dd83801 Nov 26, 2013

@lock lock bot locked and limited conversation to collaborators Sep 19, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.