Skip to content
Prev 383353 / 398502 Next

NA command in a 'for' loop

Hi Helen,
I can follow you this far:

# just read in the data from your example
d<-read.csv(text="2.90546E+11,threat,1,2,1,2,1,death,stove,NA,NA,205,0,394
2.90546E+11,threat,2,2,2,1,1,emaciated,shortened,NA,NA,205,0,502
2.90546E+11,threat,3,1,1,1,2,mutilate,consider,NA,NA,205,1,468
2.90546E+11,threat,6,1,2,2,1,weep,shop,NA,NA,203,1,345
2.90546E+11,threat,9,2,1,2,2,tormented,easygoing,NA,NA,205,1,373
2.90546E+11,threat,10,1,2,2,2,snake,table,NA,NA,205,1,343
2.90546E+11,threat,11,2,2,1,1,crisis,faucet,NA,NA,203,1,437
2.90546E+11,threat,12,1,1,1,1,victim,utensil,NA,NA,203,1,343
2.90546E+11,threat,14,1,2,2,1,depressed,repentant,NA,NA,203,1,441
2.90546E+11,threat,15,2,2,1,2,scum,shoe,NA,NA,205,1,475",
header=FALSE,stringsAsFactors=FALSE)
# get rows of d you want
d2<-d[d$V13==1,]
d2
congruent<-(d2$V4 == 1)
congruent

and things are as I expect even though I have shortened the code somewhat.
I'm not familiar with the "get_tlbs" function which I can find on GitHub
but not on CRAN, so if this:

x<-get_tlbs(d2$V14,congruent,prior_weights=NULL,method="weighted",
 fill_gaps = FALSE)

gives you the "x" that you want, I think we're close.

Jim

On Tue, Apr 21, 2020 at 1:53 PM Helen Sawaya <helensawaya at hotmail.com>
wrote:

  
  
Message-ID: <CA+8X3fVmUM8h3yTG0FekxYudjs_tZ=UGc3GsBG_8xFiCKafNuQ@mail.gmail.com>
In-Reply-To: <AM5PR10MB17468DE9CA0AAE5332C9DD0CB9D50@AM5PR10MB1746.EURPRD10.PROD.OUTLOOK.COM>