similar to: Subset based on multiple values

Displaying 20 results from an estimated 200 matches similar to: "Subset based on multiple values"

2017 Aug 28
5
"Improvement with the R code"
Hello, I am trying to implement a formula aij= transition from state S_i to S_j/no of transition at state S_i Code I have written is working with three state {1,2,3 }, but if the number of states become={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
2017 Aug 28
0
"Improvement with the R code"
Hi, I think you overthought this one a little bit, I don't know if this is the kind of code you are expecting but I came up with something like that: generate_transition_matrix <- function(data, n_states) { #To be sure I imagine you should check n_states is right at this point transitions <- matrix(0, n_states, n_states) #we could improve a little bit here because at
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 like below?
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
2002 Jun 18
3
FINDNEXT problem, w2k and linux smbfs
I have inconsistent directory listing on share mounted on linux from windows 2k. Some time not all files appear in the directory listing. If reading directory listing multiple times (60-200 times) files listed originally would have one or two files missing in one of consecutive lists. The same problem appear as well if you are making backup of Windows files from multiple directories, there are
2004 Jul 07
1
Histograms, density, and relative frequencies
R-users, I have been using R for about 1 year, and I have run across a couple of graphics problem that I am not quite sure how to address. I have read up on the email threads regarding the differences between density and relative frequencies (count/sum(count) on the R list, and I am hoping that someone could provide me with some advice/comments concerning my approach. I will admit
2012 Jul 06
4
convert a table
I have my data in a table table <- table(test2$Filename, test2$PREDICT) I need to convert this table so it keeps the same structure, but is a different format. The current output is count data by Filename and I want to get the max for each Filename. Columns are: Filename, 1, 2, 3, 4, 5, 6, 7 When I try to convert it to a data.frame it reverts to Var1(Filename), Var2(1:7), Freq. My end goal
2001 Sep 12
2
glm + error
Can someone explain this error? I do not understand it and do not know what to do. > v.glm.allmax<-glm(ALL.MAX~.,data=v.q.allmax) Error in eval(expr, envir, enclos) : numeric envir arg not of length one Thank you for your help. Thomas platform i386-pc-mingw32 arch x86 os Win32 system x86, Win32 status major 1
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
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
2012 Aug 14
2
igraph: Turn multiple edges into weights
Dear all, I have some network data - about 300 vertices and several thousand edges. I am looking for a way to turn multiple edges into weights of the edges. I looked around and - surprisingly? - haven't found anything. Is there an easy way to do this? Best, Jonas [[alternative HTML version deleted]]
2010 Jun 28
2
Stacked Histogram, multiple lines for dates of news stories?
Dear colleagues, I have extracted the dates of several news stories from a newspaper data base to chart coverage trends of an issue over time. They are in a data frame that looks just like one generated by the reproducible code below. I can already generate a histogram of the dates with various intervals (months, quarters, weeks years) using hist.Date. However, there are two other
2010 Feb 18
1
an error about " return some vectors from some functions within a function"
Dear all, When I try to return some vectors from some functions within a function, it indicate an error," Error in rbind(ck1, ck2, ck3) : object 'ck1' not found", in one of the iterations and stop.  Since 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
2007 Feb 20
1
Reshape (pivot) question
Hi R-users, I have a data set like this (first ten rows): id patient_id date code class eala ID1564262 1562 6.4.2006 12:00 5555 1 NA ID1564262 1562 6.4.2006 12:00 5555 1 NA ID1564264 1365 14.2.2006 14:35 5555 1 50 ID1564265 1342 7.4.2006 14:30 2222 2 50 ID1564266 1648 7.4.200614:30 2222 2 50 ID1564267 1263 10.2.2006 15:45 2222 2 10 ID1564267 1263 10.2.200615:45 3333 3 10 ID1564269 5646
2011 Feb 09
2
Generate multivariate normal data with a random correlation matrix
Hi All. I'd like to generate a sample of n observations from a k dimensional multivariate normal distribution with a random correlation matrix. My solution: The lower (or upper) triangle of the correlation matrix has n.tri=(d/2)(d+1)-d entries. Take a uniform sample of n.tri possible correlations (runi(n.tr,-.99,.99) Populate a triangle of the matrix with the sampled correlations Mirror the
2017 Aug 28
0
"Improvement with the R code"
Ok, I assumed you wanted to compute a matrix M for all states such that M[i][j]= transition from state i to state j / number of transition from state i but from what you just answered it looks like you want to compute a matrix M for a set of states S such that: M[S_i][S_j]= transition from state S_i to state S_j / number of transition from state S_i where S_i is in the set S ? 2017-08-28
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
2017 Aug 28
0
"Improvement with the R code"
Chuck (Is it fine to call you Chuck?) has far more R jutsu than I do obviously. I don't know much about pmin and factor but it might worth looking into if you want to manipulate states by names (I assume this is why one might want to use it?) generate_transition_matrix <- function(data, states) prop.table(table(head(data, -1), tail(data, -1)), 1)[states,]
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
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