[R-pkg-devel] nparACT package: "working directory was changed to...resetting"

Blume Christine christine.blume at sbg.ac.at
Tue Dec 19 16:27:04 CET 2017


Hi Duncan,



Thanks a lot! Good to see that you had a similar idea, I did just that...in my example it looks like this, however, that does not help, i.e. that is the code that is associated with the warning…



data(sleepstudy)

wd <- getwd()

name <- "sleepstudy_example"

newdir <- paste(wd,name, sep="/")

if (dir.exists(newdir)){

setwd(newdir)

write.table(sleepstudy, file = "sleepstudy.txt", row.names=FALSE, col.names = FALSE)

r <- nparACT_flex_loop(newdir, SR = 4/60, minutes = 435)

} else {

dir.create(newdir)

setwd(newdir)

write.table(sleepstudy, file = "sleepstudy.txt", row.names=FALSE, col.names = FALSE)

r <- nparACT_flex_loop(newdir, SR = 4/60, minutes = 435)

}

setwd(wd)

}



Best,

Christine





-----Ursprüngliche Nachricht-----
Von: Duncan Murdoch [mailto:murdoch.duncan at gmail.com]
Gesendet: Dienstag, 19. Dezember 2017 16:19
An: Blume Christine; r-package-devel at r-project.org
Betreff: Re: [R-pkg-devel] nparACT package: "working directory was changed to...resetting"



On 19/12/2017 9:42 AM, Blume Christine wrote:

> Dear Community,

>

>

>

> For Fedora my package now gives a warning message when running the example:

>

>

>

> "Warning: working directory was changed to '/data/gannet/ripley/R/packages/tests-clang/nparACT.Rcheck/sleepstudy_example', resetting"

>

>

>

> I do not really know how to approach/solve this, what has recently been changed in R devel so this error message started appearing?



Previously you were allowed to change directory in an example.  Now you're not.  This makes sense:  the user might not want to change the working directory.



To fix this, just save the old directory, and restore it at the end of your example.  For example,



   olddir <- setwd(tempdir())

   # Run the rest of the example code here

   setwd(olddir)



Duncan Murdoch



>

>

>

> The full message can be seen here:

> https://CRAN.R-project.org/web/checks/check_results_nparACT.html

>

>

>

> Any help is appreciated and rewarded with gratitude.

>

>

>

> Best,

>

>

>

> Christine

>

>

>

>             [[alternative HTML version deleted]]

>

> ______________________________________________

> R-package-devel at r-project.org<mailto:R-package-devel at r-project.org> mailing list

> https://stat.ethz.ch/mailman/listinfo/r-package-devel

>



	[[alternative HTML version deleted]]



More information about the R-package-devel mailing list