Skip to content

Yext in parentheses.

3 messages · Steven Yen, Sarah Goslee, Jeff Newmiller

#
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)
 ? }
#
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.
[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 <styen at ntu.edu.tw> wrote:

  
    
#
I recommend cutting snippets out of your code by stopping the code at the point of interest and using dput() to pull out "data as it is" before the troublesome section and then using the reprex package to test that the snippet runs.

Either you will notice the problem on your own while taking this time, or you will end up with something we can actually try out. Your current approach fails to provide everything we might need precisely because you don't know what you need to know to solve your problem.

If you have privacy issues with the data then once you have a reprex you can make a shareable reprex by replacing the private data with generic data of the same type. Also, you should often experiment to reduce the size of your sample data to a minimum necessary to reproduce the problem, as this will often remove unnecessary confusion as well.

Remember, you are trying to learn how to solve your problems on your own anyway, so this is not wasted time even if you do end up solving it on your own.
On October 26, 2023 9:18:10 AM PDT, Steven Yen <styen at ntu.edu.tw> wrote: