I was trying to create an event table programmatically. My subject ids were cast as a character. I'm recreating that effect below with as.chacter(). When I created the dosing like below everything just went into the first compartment:
library(rxode2et)
sub_ids = c(1,2,3,4,5)
# creating observations
obs_times = c(0:20)
events = et(time=obs_times, id=sub_ids)
for(sub_id in sub_ids){
events = etRbind(
events,
# This does not work
et(cmt = "Ac", amt=c(1,1,1), time = c(0, 1, 2), id=as.character(sub_id)))
}
However this works fine:
rm(list=ls())
library(rxode2et)
sub_ids = c(1,2,3,4,5)
# creating observations
obs_times = c(0:20)
events = et(time=obs_times, id=sub_ids)
for(sub_id in sub_ids){
events = etRbind(
events,
# This works
et(cmt = "Ac", amt=c(1,1,1), time = c(0, 1, 2), id=sub_id))
}
I think it should either convert ids to numeric values or fail with an error.
I was trying to create an event table programmatically. My subject ids were cast as a character. I'm recreating that effect below with
as.chacter()
. When I created the dosing like below everything just went into the first compartment:However this works fine:
I think it should either convert ids to numeric values or fail with an error.