similar to: If loop

Displaying 20 results from an estimated 400 matches similar to: "If loop"

2024 Aug 09
3
If loop
"Or use <<- assignment I think. (I usually return, but return can only return one object and I think you want two or more" You can return any number of objects by putting them in a list and returning the list. Use of "<<-" is rarely a good idea in R. -- Bert On Fri, Aug 9, 2024 at 1:53?AM CALUM POLWART <polc1410 at gmail.com> wrote: > > OK. The fact
2024 Aug 09
1
If loop
The following (using if else) did not help. Seemed like joint12 always kicked in. ??? me1<-me0<-NULL. ??? if(joint12){ ????? {me1<-cbind(me1,v1$p12);? me0<-cbind(me0,v0$p12)} ??? } else if(marg1) { ????? {me1<-cbind(me1,v1$p1);?? me0<-cbind(me0,v0$p1)} ??? } else if(marg2) { ????? {me1<-cbind(me1,v1$p2);?? me0<-cbind(me0,v0$p2)} ??? } else if(cond12){ ?????
2024 Aug 09
1
If loop
Is something wrong in the initialisation part that we don't see? joint12 <- marg1 <-F marg1 <-T if (joint12) { print ("joint 12") cat (joint12) } if (marg1) { print("marg 1") cat(marg1) } Would probably be my diagnostic approach On Fri, 9 Aug 2024, 04:45 Steven Yen, <styen at ntu.edu.tw> wrote: > Can someone help me with the if loop below?
2024 Aug 09
1
If loop
Thanks. Hmm. The loop is doing what it is supposed to do. > try1<-function(joint12=FALSE,marg1=FALSE,marg2=FALSE, +??????????????? cond12=FALSE,cond21=FALSE){ + # *************************************************** + # Testing if loop + # *************************************************** + if(joint12){ +?? {print ("joint12"); cat(joint12,"\n")} +?? {print
2024 Aug 09
2
If loop
OK. The fact it's in a function is making things clearer. Are you trying to update the values of an object from within the function, and have them available outside the function. I don't speak functional programming articulately enough but basically v <- 1 funA <- function() { v <- v+1 } funA() cat (v) # 1 You either return the v from the function so funB <- function() {
2024 Aug 11
3
Printing
Thanks. Will try it. Have not tried it but I think the following may work: out$results<-NULL out$results$ei<-ap out$results$vi<-vap All I need is printing by returning out (unless I turn it off). And, retrieve ap and vap as needed as shown above. Guess I need to read more about invisible. On 8/11/2024 10:09 PM, Rui Barradas wrote: > ?s 09:51 de 11/08/2024, Steven Yen escreveu:
2024 Aug 11
1
Printing
Hi In the following codes, I had to choose between printing (= TRUE) or deliver something for grab (ei, vi). Is there a way to get both--that is, to print and also have ei and vi for grab? Thanks. Steven ... out<-round(as.data.frame(cbind(ap,se,t,p)),digits) out<-cbind(out,sig) out<-out[!grepl(colnames(zx)[1],rownames(out)),] if(printing){ cat("\nAPPs of bivariate ordered
2024 Aug 11
1
Printing
?s 09:51 de 11/08/2024, Steven Yen escreveu: > Hi > > In the following codes, I had to choose between printing (= TRUE) or > deliver something for grab (ei, vi). Is there a way to get both--that > is, to print and also have ei and vi for grab? Thanks. > > Steven > > ... > > out<-round(as.data.frame(cbind(ap,se,t,p)),digits) > out<-cbind(out,sig) >
2011 Oct 12
1
CVbinary - Help
Hey, I need some help. I want to obtain a cross validation for a regression model (binary response) but I got an error with CVbinary. Well I did this: fit <- lm(resp ~ PC1 + PC2 + PC3 + PC4 + PC5 + PC6 + PC7 + PC8 + PC9+PC10+PC11+PC12+PC13+PC14+PC15+PC16+PC17+PC18+PC19+PC20+PC21+PC22+PC23+PC24+PC25+PC26+PC27+PC28, data = dexp.cp, family=binomial()) CVbinary(fit) Error in sample(nfolds, m,
2005 Aug 04
1
Where the error message comes from?
Hi all: I get the following error message that I am not able to resolve. Error in if (const(t, min(1e-08, mean(t)/1e+06))) { : missing value where TRUE/FALSE needed It appears right before the last data.frame statement. Below is the program that simulates data from one way random effects model and then computes normality and bootstrap confidence interval for
2007 Apr 27
4
Randomising matrices
I would like to be able to randomise presence-absence (i.e. binary) matrices whilst keeping both the row and column totals constant. Is there a function in R that would allow me to do this? I'm working with vegetation presence-absence matrices based on field observations. The matrices are formatted to have sites as rows and species as columns. The presence of a species on a site is
2009 Aug 23
2
difficult "for"
Hi, My english isn't brilliant and my problem is very difficult to describe but I try ;) My first question is: May I write loop "for" like this or similar - for (i in sth : sth[length(sth)], k in sth_else : length(sth_else) ) - I'd like to have two independent conditions in the same loop "for". My secound question depend on program below. I'd like to write every
2018 Jan 16
5
Merging RData files
I ran two separate hours-long projects. Results of each were saved to two separate .RData files. Content of each includes, among others, the following: ?????????????????? me??? se????? t???? p sig pc21.age??????? 0.640 0.219? 2.918 0.004 *** pc21.agesq????? 0.000 0.000??? NaN?? NaN pc21.inc??????? 0.903 0.103? 8.752 0.000 *** pc21.incsq????? 0.000 0.000??? NaN?? NaN pc21.sei10????? 0.451 0.145?
2009 Jul 13
7
Samba on RHEL issue
Hi, I am trying to install samba on the RHEL. The installation completes but after that I get the smbd dead message upon checking the status: [root@usps-dc1-pc12 share]# [root@usps-dc1-pc12 share]# service smb status smbd dead but pid file exists nmbd (pid 8078) is running... [root@usps-dc1-pc12 share]# The version of RHEL and samba are as follows:
2018 Jan 16
0
Merging RData files
?load Read this carefully. Pay attention to its instructions re: overwriting existing objects. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, Jan 16, 2018 at 12:43 AM, Steven Yen <styen at ntu.edu.tw> wrote: >
2018 Jan 16
2
Merging RData files
Hi all, This is great. Again, here is what I need. I run two separate jobs (a.R and b.R) with results (say regression outputs) going to a.RData and b.RData. I like to put all results in one place (where I can retrieve them in one place, ab.RData). The following codes do it (I am not sure if line 2 is needed but I am happy). Thank you all. load("a.RData")
2018 Jan 16
0
Merging RData files
Huh. I may by completely wrong but you cannot do such "merging". .RData files are AFAIK places where all objects from given session are stored. However you could load each .RData file and save/export result (one object). BTW, what do you mean exactly by "combine/consolidate"? And finally, post your questions in plain text not html, otherwise they can be mangled. Cheers
2018 Jan 16
0
Merging RData files
On 16/01/2018 6:33 AM, Steven Yen wrote: > Hi all, > This is great. Again, here is what I need. I run two separate jobs (a.R > and b.R) with results (say regression outputs) going to a.RData and > b.RData. I like to put all results in one place (where I can retrieve > them in one place, ab.RData). The following codes do it (I am not sure > if line 2 is needed but I am happy).
2018 Jan 16
1
Merging RData files
Understood. In my case, a.RData and b.RData contain identical variables/data, plus simulation outputs from separate runs. The codes deliver what I need. Good to know the three lines work. Thank you. On 1/16/2018 8:06 PM, Duncan Murdoch wrote: > On 16/01/2018 6:33 AM, Steven Yen wrote: >> Hi all, >> This is great. Again, here is what I need. I run two separate jobs (a.R >>
2007 Apr 20
1
Hiding "Warning messages" in coxme output
Dear list, I have been trying to use coxme in R 2.3.1. When I use coxme in the following data sim.fr1, i get "Warning messages: using 'as.environment(NULL)' is deprecated" Why does it occur? How can I hide such warning message, especially when coxme is under a loop? Mohammad Ehsanul Karim (Institute of Statistical Research and Training, University of Dhaka) >