PSnonmem and GGPLOT

ggplot2

#1

install.packages("ggplot2")
library("ggplot2")

vpcfig2(vpcdir = "C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2", vpctab = "C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2",
vpcresult = "C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2",
use.model.path = TRUE, strata.names = CMT, strata.subset = NULL,
percentile = 10, fy = function(y) { y }, fx = function(x) { x },
xlab = ("Time, hrs "), ylab =("Concentration ng/ml"), col.data = "gray20", cex.data = 1,
pch.data = 19, alpha.data = 0.5, col.line = "grey20", lwd.line = 1,
lty.line = c(2, 1, 2), col.segm = c("steelblue", "gray50", "steelblue"),
alpha.segm = 0.6, type = 3)

When this code is run I get the error
Version:1.0 StartHTML:0000000107 EndHTML:0000000928 StartFragment:0000000127 EndFragment:0000000910

Error in vpcfig2(vpcdir = "C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2", : could not find function "vpcfig2"


#2

It's hard to see, but let's try. Here is vpcfig2 with everything between the opening and closing parentheses symbolized:

vpcfig2(vpcdir = "A", vpctab = "B",
vpcresult = "C",use.model.path = TRUE ... {similar arguments}, fy = function(y) { y }, fx = function(x) { x }, xlab = ("Time, hrs "), ... {similar arguments})

or even more symbolically, vpcfig2(x) which is syntactically a function, but it hasn't been defined as such; there's not anything in the form, except within the parens

vcpfig2 <- function(x) {x = 2x}

To go further, it would be helpful to know what kind of graph you're looking to produce and a FAQ: What's a reproducible example (`reprex`) and how do I do one?, which would be a representative chunk of your variables or fabricated values in the same form.

If you have an image of the output you're looking for, that would be very helpful as well.


#3

I have used R to produce the graph that I want but the graph has a two column output (i.e., two graphs side-by-side). I was informed that I could use plot-lists of the graph objects and have them out put as two separate graphs. It was too complex so I decided to convert the output to a ggplot and use grid.arrange. I found the code to do so at:

https://rdrr.io/cran/nonmem2R/man/vpcfig2.html

However, I am not knowledgeable enough in R to know how to correctly use the “vpcfig2” statement. I did use Reprex for my posted R code. I will attach the graph but if it also needs to be posted via Reprex let me know.

Perhaps when you look at the post you can tell me exactly what to do?

Thanks

(Attachment VPC.emf is missing)


#4

I just got a message that the figure upload was rejected so I will send it later via Replex.


#5

Found the missing function in the nonmem2R package, which takes care of

Error in vpcfig2(vpcdir = "C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2", : could not find function "vpcfig2"

So, what happens when you add

library(nonmem2R)

#6

It bypassed that error one the library was loaded and it began to read the path but then gave me this error:

cannot open file 'C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2_vpc': Permission denied

I don’t know why since the file is on my C:/drive and I have posted the path which is the same as in the R code.

C:\BIPHENPEDS_NDA205831\PhysiolPopFit\PSN\run2_vpc


#7

I wish I could help you on that one, but I haven't deal with Windows internals since the first Clinton Administration.

If this were *nix, I'd say that the process under which RStudio is running doesn't have file access permission that you yourself do in browsing the file system and could tell you how to fix it.

I suggest starting a new thread, say "RStudios Windows file open permission denied problem"


#8

I will do so and at least you helped me over the firs hurdle because I was making no progress.

Thanks


#9

I found this code on line to produce a vpcfig2. The code was located at:

https://rdrr.io/cran/nonmem2R/man/vpcfig2.html

After I started the R session I get the warning error that the file can’t be opened. This is a folder that I have access to on my C:drive. Can anyone tell me how to overcome this issue?


 library(nonmem2R)

 vpcfig2(vpcdir = "C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2_vpc", vpctab = "C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2_vpc",

         vpcresult = "C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2_vpc",

        use.model.path = TRUE, strata.names = CMT, strata.subset = NULL,

        percentile = 10, fy = function(y) {     y }, fx = function(x) {     x },

        xlab = ("Time, hrs "), ylab =("Concentration ng/ml"), col.data = "gray20", cex.data = 1,

        pch.data = 19, alpha.data = 0.5, col.line = "grey20", lwd.line = 1,

        lty.line = c(2, 1, 2), col.segm = c("steelblue", "gray50", "steelblue"),

        alpha.segm = 0.6, type = 3)

#> VPC based on files:

#>    C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2_vpc

#> and

#>    C:/BIPHENPEDS_NDA205831/PhysiolPopFit/PSN/run2_vpc

#> Warning in file(file, "rt"): cannot open file 'C:/BIPHENPEDS_NDA205831/

#> PhysiolPopFit/PSN/run2_vpc': Permission denied

#> Error in file(file, "rt"): cannot open the connection

Created on 2018-12-09 by the reprex package (v0.2.1)


Windows file open permission denied problem
#10

Cross posted to Windows file open permission denied problem which is the remaining portion of the problem.