Skip to content

Instantly share code, notes, and snippets.

View kylebaron's full-sized avatar
🏠
Working from home

Kyle Baron kylebaron

🏠
Working from home
View GitHub Profile
@kylebaron
kylebaron / reproducible.Rmd
Last active June 9, 2020 13:19
Reproducibility in Rmd
---
title: "reproducible rmd"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
@kylebaron
kylebaron / mrgsolve-to-nca.md
Last active April 4, 2020 05:35
mrgsolve-to-nca
library(mrgsolve)
#> 
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#> 
#>     filter
library(dplyr)
#> 
@kylebaron
kylebaron / ss-2.md
Created November 12, 2019 18:21
SS 1 and 2
library(mrgsolve)
#> 
#> Attaching package: 'mrgsolve'
#> The following object is masked from 'package:stats':
#> 
#>     filter
library(dplyr)
#> 
#> Attaching package: 'dplyr'
@kylebaron
kylebaron / Two_cmt.md
Created December 6, 2018 19:51
Example Two Compartment With Infusion into Depot
library(mrgsolve)

mod <- mread("pk2", modlib())
#> Building pk2 ... done.

mod %>% 
  ev(amt  = 100, rate = 3) %>% 
  mrgsim(end = 48, delta = 0.1) %>% 
 plot
@kylebaron
kylebaron / fcmt.md
Created March 19, 2018 21:57
Bioavability

fcmt.R

kyleb Mon Mar 19 16:56:57 2018

library(mrgsolve)

code <- '
$PARAM CL = 1, V = 30, KA = 1, F1 = 0.5, F2 = 1
@kylebaron
kylebaron / parameter_df.md
Created July 14, 2017 21:04
Create a data frame with parameter values
library(mrgsolve)

mod <- mread("irm1", modlib())
## Compiling irm1 ...

## done.
@kylebaron
kylebaron / rate.R
Created June 1, 2017 01:48
Modeling Infusion Duration
library(mrgsolve)
code <- '
$PARAM CL = 1, V = 5, D1 = 1
$PKMODEL cmt="CENT"
$MAIN
D_CENT = D1;
'
@kylebaron
kylebaron / set_my_path.R
Created March 7, 2017 20:23
A function to set path
set_my_path <- function() {
FLAG <- "RTOOLS_WAS_SET"
rtools <- 'C:\\RBuildTools\\3.3\\bin;C:\\RBuildTools\\3.3\\gcc-4.6.3\\bin;'
if(Sys.getenv(FLAG)=="") {
message("setting your path")
Sys.setenv(PATH=paste0(rtools,Sys.getenv("PATH")))
do.call(Sys.setenv,setNames(list("yes"),FLAG))
}
if(!grepl(rtools,Sys.getenv("PATH"),fixed=TRUE)) {
@kylebaron
kylebaron / path.R
Last active March 7, 2017 15:17
Path
# I don't know what the path to Rbuildtools is for you.
# Mine is
C:\\RBuildTools\\3.3\\bin
C:\\RBuildTools\\3.3\\gcc-4.6.3\\bin
## Look in your computer for these two equivalent directories; version number (3.3) might be different
### START .Rprofile ***** the first character of the file name is a dot (period) *******
## So my .Rprofile would be
rtools <- "C:\\RBuildTools\\3.3\\bin;C:\\RBuildTools\\3.3\\gcc-4.6.3\\bin;"
@kylebaron
kylebaron / RcppTOML.cpp
Created February 25, 2017 02:44
RcppTOML Install
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -DCPPTOML_USE_MAP -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/kyleb/Rlibs/lib/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c RcppExports.cpp -o RcppExports.o
clang++ -std=c++11 -I/Library/Frameworks/R.framework/Resources/include -DNDEBUG -I../inst/include/ -DCPPTOML_USE_MAP -I/usr/local/include -I/usr/local/include/freetype2 -I/opt/X11/include -I"/Users/kyleb/Rlibs/lib/Rcpp/include" -fPIC -Wall -mtune=core2 -g -O2 -c parse.cpp -o parse.o
In file included from parse.cpp:22:
In file included from ../inst/include/cpptoml.h:10:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/algorithm:1720:21: error: conversion from 'Rcpp::internal::generic_proxy<19>' to 'double' is ambiguous
*__result = *__first;
^~~~~~~~
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/