Lrm function error: Error in if (x) { : argument is not interpretable as logical

I have a logistic model, and I want to plot a nomogram using the rms package. But when a use the same formula with the lrm function it throws an error:

Error in if (x) { : argument is not interpretable as logical In addition: Warning message: In if (x) { : the condition has length > 1 and only the first element will be used

The code I used is
library(rms)
tardata=final_data[,c(“delirium”,“brain_artery_dis”,“hbp”,“ageL60”,“firstMVtime”,“OPTIME”,“hb100”,“ne”,“heartFunc”,“varMBP”)]
tardata=na.omit(tardata)
dd<-datadist(tardata)
options(datadist=‘dd’)
summary(glm(delirium~ageL60+firstMVtime+OPTIME+hb100+ne+heartFunc+varMBP,data = tardata,family = binomial()))
fit1<-lrm(delirium~ageL60+firstMVtime+OPTIME+hb100+ne+heartFunc+varMBP,data = tardata,x=T,y=T)

tardata is a dataframe with no NA values.

The str(tardata) is

‘data.frame’: 3397 obs. of 10 variables:
delirium : logi FALSE FALSE FALSE FALSE FALSE FALSE ... brain_artery_dis: logi TRUE TRUE TRUE FALSE TRUE TRUE …
hbp : logi FALSE TRUE TRUE FALSE TRUE TRUE ... ageL60 : logi TRUE TRUE FALSE TRUE TRUE FALSE …
firstMVtime : num 1200 370 730 990 890 490 320 570 545 590 ... OPTIME : num 5.5 3.08 3.33 4.67 4.92 …
hb100 : logi FALSE FALSE TRUE FALSE FALSE TRUE ... ne : logi TRUE FALSE FALSE FALSE TRUE FALSE …
heartFunc : num 3 3 3 3 3 3 3 2 3 3 ... varMBP : num 740.9 41.8 283.3 194.3 76.3 …

Any comments will be appreciated. Thanks.

I don’t see anything wrong the the code on quick inspection. Try deleting variables one at a time from the list of predictors and see if you can identify a culprit variable. Note that it is best to spell out T as TRUE, and the use of casewise deletion is discouraged for handling missing data.

When you subset variables it’s much better to use something like

d <- subset(mydata, select=c(delirium, brain_artery_dis, ...))

instead of typing a lot of quote marks.

Whenever your report problems be sure to include the version number of the rms and Hmisc packages you have installed.