search for: count1

Displaying 20 results from an estimated 30 matches for "count1".

Did you mean: count
2006 Dec 11
2
Switch and integer
I searched the help list and the manual, but I do not find my mistake. Switch is working with character , with integer, but not in the third example Regards Knut count1 <- 0 test =c("3","9","3","9","3","9","8","9","8","9","8","9","3","9","3","9","5","9","3","9",&q...
2010 Feb 18
1
an error about " return some vectors from some functions within a function"
...e I am not experienced in programming, can anyone give me a suggestion to inspect this error? The followings are the functions I created : ################### # functions in the convg # ################### check1 <- function(sumgt,beta1.0,gamma.0,sigma.0){    if (any(!is.finite(sumgt))){        count1 <- count1+1        return(c(count1,beta1.0,gamma.0,sigma.0))    }   else {return(c(NaN,NaN,NaN,NaN))}  } check2 <- function(v0,maxit,iter,beta1.0,gamma.0,sigma.0){     if (is.nan(sum(v0))==TRUE | any(!is.finite(v0)) | maxit == iter){        count1 <- count1+1        return(c(count1,beta1.0...
2012 Jul 11
3
Subset based on multiple values
...#39;m stuck on a seemingly simple problem. I'm trying to subset the data by several numbers and it cuts out half of the rows. Here is the sample code: test <- as.matrix(c(1,1,1,1,3,3,7,7,7,7)) Count <- tapply(test[,1], test[,1], length) # count for each value spp <- unique(test[,1]) Count1 <- as.data.frame(cbind(Count,spp)) Max <- max(Count) Count1$sppMax <- ifelse(Count1$Count >= Max, Count1$spp, 0) # only keep values that =Max Count2 <- subset(Count1, sppMax > 0) #get rid of values that are less than Max AllMax <- unique(Count2$sppMax) test2 <- subset(te...
2017 Aug 28
5
"Improvement with the R code"
...{1,2,3,4,......n} then the code will not work, so can some help me with this. For and some rows of my data frame look like checkdf=data.frame(clusterNum=c(3,2,3,1,1,3,4,3,2,1,1,3,2,1,3,2) no_of_state=3 transition_matrix=matrix(NA,nrow=no_of_state, ncol=no_of_state) for(k in 1: no_of_state) { count1=0 count2=0 count3=0 #For last point no transition takes place for(j in 1: (nrow(checkdf)-1)) { if(checkdf$clusterNum[j]==k) { if(checkdf$clusterNum[j+1]==1){ count1=count1+1 } else if(checkdf$clusterNum[j+1]==2){ count2=count2+1 } el...
2009 Feb 11
2
Loop on characters
Hi, suppose I have three vectors like : l1 = 1:4 l2 = 4:9 l3 = 16:67 now I want to construct a loop like : for (i in 1:3) { count1[i] = length(li) # i.e. it will take l1, l2, l3 according to value of i } Can anyone please tell me how to do that? Regards, -- View this message in context: http://www.nabble.com/Loop-on-characters-tp21949173p21949173.html Sent from the R help mailing list archive at Nabble.com.
2011 Feb 09
2
Generate multivariate normal data with a random correlation matrix
...the range (or most of the range) or the correlation [-1,1]? Here's the code I've used that won't work. ************************************************ library(mnormt) n <- 1000 d <- 50 n.tri <- ((d*(d+1))/2)-d r ? ? ? <- runif(n.tri, min=-.5, max=.5) cormat <- diag(c) count1=1 for (i in 1:c){ ? ? ? ?for (j in 1:c){ ? ? ? ? ? ? ? ?if (i<j) { ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?cormat[i,j]=r[count1] ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?cormat[j,i]=cormat[i,j] ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?count1=count1+1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? } ? ? ? ?} } eigen(cormat) ? ? # if negative e...
2017 Aug 28
0
"Improvement with the R code"
...o can some > help me with this. > > For and some rows of my data frame look like > > checkdf=data.frame(clusterNum=c(3,2,3,1,1,3,4,3,2,1,1,3,2,1,3,2) > no_of_state=3 > transition_matrix=matrix(NA,nrow=no_of_state, ncol=no_of_state) > for(k in 1: no_of_state) > { > count1=0 > count2=0 > count3=0 > #For last point no transition takes place > for(j in 1: (nrow(checkdf)-1)) > { > > if(checkdf$clusterNum[j]==k) > { > if(checkdf$clusterNum[j+1]==1){ > count1=count1+1 > } > else if(checkdf$clu...
2004 Jul 07
1
Histograms, density, and relative frequencies
...used (although from what I can understand wrong) relative frequency histogram approach. My rough code looks like this: bk <- c(0, .05, .1, .15, .2, .25,.3, .35, 1) par(mfrow=c(1, 1)) fawn1 <- hist(MFAWNRESID[regs1], plot=F, breaks=bk) fawn2 <- hist(MFAWNRESID[regs2], plot=F, breaks=bk) count1 <- fawn1$counts/sum(fawn1$counts) count2 <- fawn2$counts/sum(fawn2$counts) b <- c(0, .05, .1, .15, .2, .25, .3, .35) plot(count1~b,xaxt="n", xlim=c(0, .5), ylim=c(0, .40), pch=".", bty="l") lines(spline(count1~b), lty=c(1), lwd=c(2), col="black") lin...
2009 Oct 29
1
operation with if/else on a dataframe
Hi to all, I have this dataframe (I show the first six rows) >head(table) A R Fold.Change P.Value Count1 Count2 1 ENSRNOE00000000002_at 0 1.13 0.60 1 1 2 ENSRNOE00000000009_at 0 -1.04 0.73 3 3 3 ENSRNOE00000000020_at 0 -1.08 0.68 0 0 4 ENSRNOE00000000021_at 0...
2010 Jan 28
0
exactci package gives exact binomial and poisson tests and matching CI
...or group B assuming Poisson counts. The poisson.test function in the stats package gives a significant test result but a confidence interval that contains the rate ratio of 1: > poisson.test(c(2,10),c(17877,20000)) Comparison of Poisson rates data: c(2, 10) time base: c(17877, 20000) count1 = 2, expected count1 = 5.664, p-value = 0.04213 alternative hypothesis: true rate ratio is not equal to 1 95 percent confidence interval: 0.02383738 1.04995468 sample estimates: rate ratio 0.2237512 In the exactci package, the test and confidence interval are calculated from the same p-value fun...
2010 Jan 28
0
exactci package gives exact binomial and poisson tests and matching CI
...or group B assuming Poisson counts. The poisson.test function in the stats package gives a significant test result but a confidence interval that contains the rate ratio of 1: > poisson.test(c(2,10),c(17877,20000)) Comparison of Poisson rates data: c(2, 10) time base: c(17877, 20000) count1 = 2, expected count1 = 5.664, p-value = 0.04213 alternative hypothesis: true rate ratio is not equal to 1 95 percent confidence interval: 0.02383738 1.04995468 sample estimates: rate ratio 0.2237512 In the exactci package, the test and confidence interval are calculated from the same p-value fun...
2001 Mar 16
1
combine dataset
Hi, I have two data sets look like below: ========================== state count1 percent1 CA 19 0.34 TX 22 0.35 FL 11 0.24 OR 34 0.42 GA 52 0.62 MN 12 0.17 NC 19 0.34 state count2 percent2 FL 22 0.35 MN 22 0.35 CA 11 0.24 TX 52 0.62 ========================== How to combine these two data set and make it look...
2017 Aug 28
0
"Improvement with the R code"
...ook like >>>> >>>> checkdf=data.frame(clusterNum=c(3,2,3,1,1,3,4,3,2,1,1,3,2,1,3,2) >>>> no_of_state=3 >>>> transition_matrix=matrix(NA,nrow=no_of_state, ncol=no_of_state) >>>> for(k in 1: no_of_state) >>>> { >>>> count1=0 >>>> count2=0 >>>> count3=0 >>>> #For last point no transition takes place >>>> for(j in 1: (nrow(checkdf)-1)) >>>> { >>>> >>>> if(checkdf$clusterNum[j]==k) >>>> { >>>>...
2002 Jun 18
3
FINDNEXT problem, w2k and linux smbfs
...Connection: Windows 2000 Pro (file server) -> 100TX -> Linux (client) mount -t smbfs -o username=xxx,password=xxx,uid=0,gid=0,rw //w2k/c /mnt/w2kc samba 2.2.4 mount.smbfs 2.2.4 Linux kernel 2.4.18 problem also exists on samba-2.0.7 and kernel-2.4.2 (redhat-7.1) PS # Shell test count1=`ls -l | wc -l` cnt=1 while true ; do count2=`ls -l | wc -l` if [ $count2 != $count1 ]; then echo "Error: $count2 != $count1" fi cnt=`expr ${cnt} + 1` echo "Test : $cnt" done /* also java prog I used to test this problem on w2k and Linux */ import j...
2007 Oct 19
0
calculating power of log rank test
hie Im trying to calculate the power of the logrank test for different values of rho .I was just wandering whether the following programme would do it. any suggestions are welcome s=50 number=1 count1=0;count2=0;count3=0;count4=0;count5=0;count6=0;count7=0;count7=0; count8=0;count9=0 while(s!=0){ n=20 n1=n/2 n2=n/4 a11=1 ;a12=1.4 ;a21=16 ;a22=a12 * a21 t1<-array(1,c(n1))...
2017 Aug 28
0
"Improvement with the R code"
...t; checkdf=data.frame(clusterNum=c(3,2,3,1,1,3,4,3,2,1,1,3,2,1,3,2) >>>>>> no_of_state=3 >>>>>> transition_matrix=matrix(NA,nrow=no_of_state, ncol=no_of_state) >>>>>> for(k in 1: no_of_state) >>>>>> { >>>>>> count1=0 >>>>>> count2=0 >>>>>> count3=0 >>>>>> #For last point no transition takes place >>>>>> for(j in 1: (nrow(checkdf)-1)) >>>>>> { >>>>>> >>>>>> if(checkdf$clus...
2008 Feb 14
0
help in simplyfiying programme
my program given below can some one make it presentable. I trying to simulate survival data and calculate the power. I think i could have done better. s=10 number=0 count1=0;count2=0;count3=0;count4=0;count5=0;count6=0;count7=0;count8=0; count9=0; count11=0;count22=0;count33=0;count44=0;count55=0;count66=0;count77=0; count88=0;count99=0; while(s!=0){ n=100 n1=n/2 n2=n/4 t1<-array(1,c(n1)) t2<-array(...
2013 Feb 17
6
histogram
...9,14,16,44,1,41,4,15,20,46,32,38,5,31,12,48,27,36,24,34,2,35,11,42,9,8,7,26,22,43,17,19,28,23,3,49,37,50,45) label1<-unlist(lapply(mapply(c,lapply(seq(0,45,5),function(x) x),lapply(seq(5,50,5),function(x) x),SIMPLIFY=FALSE),function(i) paste(i[1],"<x<=",i[2],sep=""))) ?Count1<-as.data.frame(table(cut(vec1,breaks=seq(0,50,5),labels=label1))) ?Count1 #?????? Var1 Freq #1??? 0<x<=5??? 5 #2?? 5<x<=10??? 5 #3? 10<x<=15??? 5 #4? 15<x<=20??? 5 #5? 20<x<=25??? 5 #6? 25<x<=30??? 5 #7? 30<x<=35??? 5 #8? 35<x<=40??? 5 #9? 40<...
2009 Jul 09
3
Looking for recommendations for blocking hacking attempts
Hello: I have been looking into projects that will automatically restrict hacking attempts on my servers running CentOS 5. I think the two top contenders are: DenyHosts - http://denyhosts.sourceforge.net Fail2ban - http://www.fail2ban.org >From what I see, DenyHosts only blocks based on failed SSH attempts whereas Fail2ban blocks failed attempts for other access as well. The main benefit
2008 Apr 26
0
moving pagination code to model
...[:page] ||= 1).to_i items_per_page = 20 offset = (page - 1) * items_per_page # step 2: instead of performing the full find, just find the record count @search_sd_ticket_count_result = ServiceDeskTicket.find_where(:all,:select=>''count(*) as count1'' ) do |sd| end record_count=@search_sd_ticket_count_result[0].count1.to_i # step 3: create a Paginator, the second variable has to be the number of ALL items on all pages @search_sd_ticket_result_pages = Paginator.new(...