trouble with mread() while following "introduction.pdf" for 2016-03-12 workshop

2 views
Skip to first unread message

jscav...@gmail.com

unread,
Sep 18, 2017, 1:30:16 PM9/18/17
to mrgsolve
I started a new R session, navigated to the folder in which I have mrgsolve-related stuff, and tried to follow along in the slides from 2016-03-12 and got this—I don't understand why I got the final output shown; it's basically slide 8 of "introduction.pdf" for this workshop, and yes, in this folder there is a file called "intro_model.cpp" which is the same as slide 7 from this same "introduction.pdf".  Comments, please?  Since it's the model object, it stops me cold:

> getwd()
[1] "C:/Users/James/Documents"
> setwd("~/academic/conceptual sciences/information, signals, systems/pharmacometrics/algorithms and software/R packages/mrgsolve/2016-03-12 workshop")
> # Compile and load model
> model <- mread("intro_model", proj) %>%
+   update(delta = 0.25, end = 120)
Error in mread("intro_model", proj) %>% update(delta = 0.25, end = 120) : 
  could not find function "%>%"
> library(mrgsolve)
> library(dplyr)

Attaching package: ‘dplyr’

The following objects are masked from ‘package:stats’:

    filter, lag

The following objects are masked from ‘package:base’:

    intersect, setdiff, setequal, union

> library(ggplot2)
Need help? Try the ggplot2 mailing list:
http://groups.google.com/group/ggplot2.
> # Compile and load model
> model <- mread("intro_model", proj) %>%
+   update(delta = 0.25, end = 120)
Error in as.character(x) : 
  cannot coerce type 'closure' to vector of type 'character'

Kyle Baron

unread,
Sep 18, 2017, 1:36:36 PM9/18/17
to jscav...@gmail.com, mrgsolve
Hi James - 

Error in mread("intro_model", proj) %>% update(delta = 0.25, end = 120) : 
  could not find function "%>%"
> library(mrgsolve)
> library(dplyr)

Please load dplyr before trying to use %>% operator.  Also, if using an object called "proj" you need to set it to wherever the model is located.  If the model is in your working directory, just omit that argument.

Kyle




--
MetrumRG Website: http://www.metrumrg.com/opensourcetools.html
---
You received this message because you are subscribed to the Google Groups "mrgsolve" group.
To unsubscribe from this group and stop receiving emails from it, send an email to mrgsolve+unsubscribe@metrumrg.com.
To post to this group, send email to mrgs...@metrumrg.com.
Visit this group at https://groups.google.com/a/metrumrg.com/group/mrgsolve/.



--
Kyle Baron, PharmD, PhD
Senior Scientist
Metrum Research Group

Cavenaugh, James S.

unread,
Sep 18, 2017, 1:45:29 PM9/18/17
to Kyle Baron, mrgsolve

Thanks Kyle, but my question wasn't really with dplyr (I saw that mistake but copied and pasted in my output from the top, warts and all so to speak).  Instead it was with the last line (and note that my second command was the setwd() to where the .cpp code resides.  There is no saved object called proj in that directory, but then this wasn't indicated as a task in the file introduction.pdf either.  The documentation for mread() lists "project = getwd()" as its second argument, and I thought that "proj" was short for this argument.

Kyle Baron

unread,
Sep 18, 2017, 1:55:10 PM9/18/17
to Cavenaugh, James S., mrgsolve
Hi James - 

Then it sounds like the call should be
model <- mread("intro_model")


If "proj" doesn't exist as an R object in your R session, the mread call clearly won't work.


Kyle
Reply all
Reply to author
Forward
0 new messages