nlmixr2 / rxode2

rxode2
https://nlmixr2.github.io/rxode2/
GNU General Public License v3.0
28 stars 8 forks source link

set wd for cfile and all others #695

Closed motyocska closed 3 months ago

motyocska commented 3 months ago

Hello,

not sure what am I doing wrong but am unable to set the specific directory (instead of the tempdir()) for where I would like the rxode2 cfiles and all other supporting files to be created, please assist:

I have a folder here which is where I want all the files: setwd("C:\app\...\1PO_IV_epSsH")

then I write:

mod <- rxode2("cp<-cent/vc;d/dt(gutcp)<--ka*gutcp;d/dt(cent)<-(ka*gutcp)-q/vc*cent+q/vp*pericp-((vmax*cp)/vc)/(km+cp);d/dt(pericp)<-cent*q/vc-q/vp*pericp;f(gutcp)=bio;alag(gutcp)<-lag;gutcp(0)<-0;cent(0)<-0;pericp(0)<-0;",wd=getwd())

yet everything gets dropped into the temporary directory...

much appreciate your input on what I may be doing wrong...

thanks,

Andras

mattfidler commented 3 months ago

Hi, you need to also supply modName:

library(rxode2)
#> Warning: package 'rxode2' was built under R version 4.3.3
#> rxode2 2.1.3 using 4 threads (see ?getRxThreads)
#>   no cache: create with `rxCreateCache()`

mod <- rxode2("cp<-cent/vc;d/dt(gutcp)<--ka*gutcp;d/dt(cent)<-(ka*gutcp)-q/vc*cent+q/vp*pericp-((vmax*cp)/vc)/(km+cp);d/dt(pericp)<-cent*q/vc-q/vp*pericp;f(gutcp)=bio;alag(gutcp)<-lag;gutcp(0)<-0;cent(0)<-0;pericp(0)<-0;",wd="c:/home", modName="matt")

any(grepl("matt.d", list.files(path="c:/home")))
#> [1] TRUE

Created on 2024-06-23 with reprex v2.1.0

In fact, all you have to specify is the modName if the working directory is set:

library(rxode2)
#> Warning: package 'rxode2' was built under R version 4.3.3
#> rxode2 2.1.3 using 4 threads (see ?getRxThreads)
#>   no cache: create with `rxCreateCache()`

setwd("c:/home")

mod <- rxode2("cp<-cent/vc;d/dt(gutcp)<--ka*gutcp;d/dt(cent)<-(ka*gutcp)-q/vc*cent+q/vp*pericp-((vmax*cp)/vc)/(km+cp);d/dt(pericp)<-cent*q/vc-q/vp*pericp;f(gutcp)=bio;alag(gutcp)<-lag;gutcp(0)<-0;cent(0)<-0;pericp(0)<-0;", modName="matt")

any(grepl("matt.d", list.files(path="c:/home")))
#> [1] TRUE

Created on 2024-06-23 with reprex v2.1.0

motyocska commented 3 months ago

Thank you Matt, problem solved... Andras

Yahoo Mail: Search, Organize, Conquer

On Sun, Jun 23, 2024 at 9:26 AM, Matthew @.***> wrote:

Hi, you need to also supply modName: library(rxode2)

> Warning: package 'rxode2' was built under R version 4.3.3

> rxode2 2.1.3 using 4 threads (see ?getRxThreads)

> no cache: create with rxCreateCache()mod <- rxode2("cp<-cent/vc;d/dt(gutcp)<--kagutcp;d/dt(cent)<-(kagutcp)-q/vccent+q/vppericp-((vmaxcp)/vc)/(km+cp);d/dt(pericp)<-centq/vc-q/vp*pericp;f(gutcp)=bio;alag(gutcp)<-lag;gutcp(0)<-0;cent(0)<-0;pericp(0)<-0;",wd="c:/home", modName="matt")

any(grepl("matt.d", list.files(path="c:/home")))

> [1] TRUE

Created on 2024-06-23 with reprex v2.1.0

In fact, all you have to specify is the modName if the working directory is set: library(rxode2)

> Warning: package 'rxode2' was built under R version 4.3.3

> rxode2 2.1.3 using 4 threads (see ?getRxThreads)

> no cache: create with rxCreateCache()setwd("c:/home")

mod <- rxode2("cp<-cent/vc;d/dt(gutcp)<--kagutcp;d/dt(cent)<-(kagutcp)-q/vccent+q/vppericp-((vmaxcp)/vc)/(km+cp);d/dt(pericp)<-centq/vc-q/vp*pericp;f(gutcp)=bio;alag(gutcp)<-lag;gutcp(0)<-0;cent(0)<-0;pericp(0)<-0;", modName="matt")

any(grepl("matt.d", list.files(path="c:/home")))

> [1] TRUE

Created on 2024-06-23 with reprex v2.1.0

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

mattfidler commented 3 months ago

Great! This will error in the future instead of creating the model when you specify wd without modName