Hi, It isn't at all clear to me what you're trying to do. For one thing, you never actually add more items to cat.ref in the code snippet you give. You do use c() on zx.ref - is that what you mean?
But you aren't adding cat.ref to it, you're adding v$cat.ref, and I have no idea what that might contain. Lots of things, apparently. It's possible that something in pred0 is stripping things out of cat.ref, I suppose, since c() alone won't do that. > cat.ref<-"dilemma1(ref.)" > cat.ref <- c(cat.ref, "scigrn1(ref.)") > cat.ref [1] "dilemma1(ref.)" "scigrn1(ref.)" I think we need a reproducible example showing the actual problem, or at least very clear explanation. For instance, what's dput(v$cat.ref) Is it the same as cat.ref, or is that where the alteration happens? Sarah On Thu, Oct 26, 2023 at 12:18 PM Steven Yen <st...@ntu.edu.tw> wrote: > > Dear All > > My program is long and sorry I do not have a replicable set of codes to > present. But I present a chunk of codes at the end below. Essentially, > > 1. I initialize cat.ref as NUL (see line 1) > > 2. Then, I repeatedly add elements to cat.ref, where each element > include parentheses in double quotations (see line 2). > > I had expected cat.ref to eventually contain the list > > dilemma1(ref),scigrn1(ref),... > > Not so, I end up getting the following (see first column; not in > parentheses, like (ref.)). > > dilemma1.ref.. 22.356 2.619 8.535 0.000 *** scigrn1.ref.. 22.474 2.697 > 8.334 0.000 *** > > Any idea how I might revise lines like the following (first line below): > > dv.group<-c("dilemma2","dilemma3"); cat.ref<-"dilemma1(ref.)" > > etc. Thanks. > > ap0<-zx.ref<-NULL > > dv.group<-c("dilemma2","dilemma3"); cat.ref<-"dilemma1(ref.)" > if(any(dv.group%in%jindex)){ > v<-pred0(dv.group,cat.ref) > ap0<-rbind(ap0,v$ap0); zx.ref<-c(zx.ref,v$cat.ref) > } > > dv.group<-c("scigrn2","scigrn3"); cat.ref<-"scigrn1(ref.)" > if(any(dv.group%in%jindex)){ > v<-pred0(dv.group,cat.ref) > ap0<-rbind(ap0,v$ap0); zx.ref<-c(zx.ref,v$cat.ref) > } > > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. -- Sarah Goslee (she/her) http://www.numberwright.com ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.