0

Is there an alternative to using %in%dosetimes for subsetting doserows in the example below? The reason I want to use something else is because I am adding this part in my R-package example I am developing and doesn't seem to accept the %in% in the example code!

#Set dose records:
dosetimes <- c(0,12)
#set number of subjects
ID <- 1:2
#Make dataframe: CLCR: is creatinine clearance
df <- expand.grid("ID"=ID,"TIME"=sort(unique(c(seq(0,24,1),dosetimes))),"AMT"=0,"DV"=NA)
doserows <- subset(df, TIME%in%dosetimes)

1 Answer 1

3

From the R extensions manual:

Because backslashes, braces and percent symbols have special meaning, to enter them into text sometimes requires escapes using a backslash. In general balanced braces do not need to be escaped, but percent symbols always do, except in the ‘verbatim’ variant. For the complete list of macros and rules for escapes, see “Parsing Rd files”.

So try

doserows <- subset(df, TIME \%in\% dosetimes)

in your .Rd file or roxygen-formatted example.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.