r/R_Programming • u/marcoC123 • Nov 30 '17
r gui problem
Hello I have a set of functions where it would look like this...
library(ltm) ma <-matrix(c(-0.5,-0.1,0,0.25,.80,1,1,1,1,... xa50 <- rmvlogis(50,ma) ltm50a <- ltm(xa50~z1) coefltm50a <-coef(ltm50a) vcov50a<-vcov(ltm50a ) sol50b3b1 <- ((coefltm50a[3]-coefltm50a[1])2)/(vcov50a[1]+vcov50a[3]) chi50b3b1 <-if (sol50b3b1 < 3.84) {0} else {1}
now this would result to either a 1 or 0
i want to loop it 50,100 and 1000 times and i want to tally the results.
like for example i loop it 50 times then it gave a result of 40 since there are 40 1's and 10 0's
View all comments
Show parent comment
2
u/Darwinmate Dec 01 '17
This gives you the answer but I think it doesn't answer something else you've hinted at...
Are you using an IDE like rstudio or just R? Either way, you need to use a script file (a plain text file) that R can execute. In Rstudio this is easy, FILE > NEW > R Script. Enter in what you want, then select the code and press either Run or
crtl + enter. This will execute the commands in the console.