similar to: identifying a 'run' in a vector

Displaying 20 results from an estimated 5000 matches similar to: "identifying a 'run' in a vector"

2011 Dec 02
2
Moving column averaging
# need zoo to use rollapply() # your data (I called df) df <- structure(list(a = 1:2, b = 2:3, c = c(5L, 9L), d = c(9L, 6L), e = c(1L, 5L), f = c(4, 7)), .Names = c("a", "b", "c", "d", "e", "f"), class = "data.frame", row.names = c(NA, -2L)) # transpose and make a zoo object df2 <- zoo(t(df)) #rollapply to get
2011 Nov 17
1
split list of characters in groups of 2
hi, If i have a list of things, like this var.names <- c("a", "b", "c", "d", "e", "f") how can i get this: "a, b", "c, d", "e, f" thanks ahead of time. -- View this message in context: http://r.789695.n4.nabble.com/split-list-of-characters-in-groups-of-2-tp4079031p4079031.html Sent from the R
2012 Jan 23
1
R not giving significance tests for coefficients/estimates?
> 3x4 Error: unexpected symbol in "3x4" R has no idea that you equate "x" as multiplication.. use an astrix > 3*4 [1] 12 dominic wrote > > This is basically my code: > > library(MASS) > lmsreg(formula = b0 ~ b1 + b3 + b1xb2, data=mydata) > > b1xb2 is an interaction but it was the centered value for a continuous > variable times a
2011 Sep 07
1
reshaping data
I have the following data (see RawData using dput below) How do I get it in the following 3 column format (CO2 measurements are the elements of the original data frame). I'm sure the package reshape is where I should look, but I haven't figured out how. Thanks ahead of time Month Year CO2 J 1958 F 1958 M 1958 315.71 A 1958 317.45 M.1 1958 317.5 J.1 1958 J.2 1958 315.86 A.1 1958
2008 Sep 16
1
Car.proper C[] matrix
I am hoping someone can help translate some WinBUGS code into R code. I would like to use R to create the C[] matrix required for a car.proper model in WinBUGS, but I am having a difficult time negotiating the coding. The C matrix provides normalized weights for each pair of spatial areas. So the WinBUGS example is as follows: # of the weight matrix with elements Cij. The first J1 elements
2011 Nov 02
3
how to count number of occurrences
Dear R users, I have this data frame, y samp 8 0.03060419 X 18 0.06120838 Y 10 0.23588374 X 3 0.32809965 X 1 0.36007100 X 7 0.36730571 X 20 0.47176748 Y 13 0.65619929 Y 11 0.72014201 Y 17 0.73461142 Y 6 0.76221313 X 2 0.77005691 X 4 0.92477243 X 9 0.93837591 X 5 0.98883581 X 16 1.52442626 Y 12 1.54011381 Y 14 1.84954487 Y
2011 Nov 24
4
I cannot get species scores to plot with site scores in MDS when I use a distance matrix as input. Problems with NA's?
Hi, First I should note I am relatively new to R so I would appreciate answers that take this into account. I am trying to perform an MDS ordination using the function ?metaMDS? of the ?vegan? package. I want to ordinate species according to a set of functional traits. ?Species? here refers to ?sites? in traditional vegetation analyses while ?traits? here correspond to ?species? in such
2004 Oct 01
1
cumsum over a list or an array
Hello list, my question is related to svd of a matrix: b=matrix(rnorm(50),10,5) mysvd=svd(b) I would like to compute each xi where xi = di* ui %*% t(vi). I do it by : xlist=sapply(1:ncol(b), function(x1,y) y$d[x1]*y$u[,x1]%*%t(y$v[,x1]),y=mysvd,simplify=F) # result is a list xarray=array(sapply(1:ncol(b), function(x1,y) y$d[x1]*y$u[,x1]%*%t(y$v[,x1]),y=mysvd),c(nrow(b),ncol(b),ncol(b))) #
2011 Apr 08
5
duplicates() function
I need a function which is similar to duplicated(), but instead of returning TRUE/FALSE, returns indices of which element was duplicated. That is, > x <- c(9,7,9,3,7) > duplicated(x) [1] FALSE FALSE TRUE FALSE TRUE > duplicates(x) [1] NA NA 1 NA 2 (so that I know that element 3 is a duplicate of element 1, and element 5 is a duplicate of element 2, whereas the others were
2012 Aug 20
3
[LLVMdev] How to Identify if an Argument is a pointer?
Hello, I was wondering how you can identify whether or not an Argument is a pointer. The "isDereferenceablePointer" function for Values doesn't seem to be what I want (I don't care whether or not the pointer points to allocated memory or is suitably aligned). I want to be able to discern between: i32* %pArray and i32 %pArray Thanks in advance. - John
2007 Jan 03
1
User defined split function in Rpart
Dear all, I'm trying to manage with user defined split function in rpart (file rpart\tests\usersplits.R in http://cran.r-project.org/src/contrib/rpart_3.1-34.tar.gz - see bottom of the email). Suppose to have the following data.frame (note that x's values are already sorted) > D y x 1 7 0.428 2 3 0.876 3 1 1.467 4 6 1.492 5 3 1.703 6 4 2.406 7 8 2.628 8 6 2.879 9 5 3.025 10 3 3.494
2005 Jun 15
2
need help on computing double summation
Dear helpers in this forum, This is a clarified version of my previous questions in this forum. I really need your generous help on this issue. > Suppose I have the following data set: > > id x y > 023 1 2 > 023 2 5 > 023 4 6 > 023 5 7 > 412 2 5 > 412 3 4 > 412 4 6 > 412 7 9 > 220 5 7 > 220 4 8 > 220 9 8 > ...... > Now I want to compute the
2003 Apr 02
2
lme parameterization question
Hi, I am trying to parameterize the following mixed model (following Piepho and Ogutu 2002), to test for a trend over time, using multiple sites: y[ij]=mu+b[j]+a[i]+w[j]*(beta +t[i])+c[ij] where: y[ij]= a response variable at site i and year j mu = fixed intercept Beta=fixed slope w[j]=constant representing the jth year (covariate) b[j]=random effect of jth year, iid N(0,sigma2[b]) a[i]=random
2003 Jul 18
2
create a vector looping over a frame
Hello, I have a data.frame > names(popA) [1] "Year" "Series" "Age" "WM" "WF" "HM" "HF" "BM" [9] "BF" "IM" "IF" "AM" "AF" "Yr" how do i loop over a subset of variables in this frame to create a vector of
2004 Aug 09
5
Little problem with IMQ
When I try to put all incoming traffic to IMQ on PREROUTING I can''t discern traffic to LAN and traffic to server. When I try to put only INPUT traffic to IMQ... I can''t discern traffic from LAN and from internet. Help me plizz to put all incoming traffic to one IMQ device and all outcoming to other IMQ device and (it''s very important) discern traffic to clients and
2008 Mar 15
2
Please find the error in my code
hello everybody I use the following code for my programming & it runs with the error as specified below.Any help that would disolve the error will be highly appreciated. Thanks in advance my code looks like this #### R programme for simulating the power of the two sample t test vs various #### non-parametric alternatives sim.size <- 200 sample.size <- 10 set.seed(231) mu1 <- 0 delta
2003 Feb 27
2
PRESS again
Sorry for the repeat. The PRESS statistic is defined as sum(y-yhat(i))^2, where yhat(i) denotes the ith predicted value using all the data except the ith case (as used typically in linear models). Thanks again Jacob Jacob L van Wyk Department of Mathematics and Statistics Rand Afrikaans University P O Box 524 Auckland Park 2006 South Africa Tel: +27-11-489-3080 Fax: +27-11-489-2832
2002 Dec 06
6
fast code
Hello, I have two vectors x1 and x2 both in increasing order. I want to select the x1[j]th entry which is the max min of the x2[i]th entry. I can do this using if and for statements but is there a quick way to do it without running a loop? Thank you in advance, Pantelis
2008 Jan 24
6
Your "favorite" Asterisk application.
Hi, all. I've done some Asterisk recelling, but recently got roped into a Sr. SysAdmin position. Our PBX is c. 1823, and -- well, as pretty much all circuit-based systems do, it sucks. It sucks to administer, moves suck... you know the drill. So, I'd love change to an Asterisk system. My boss, who loves to spend money for no particular reason, wants to go proprietary, though. So
2012 Aug 20
0
[LLVMdev] How to Identify if an Argument is a pointer?
You can use isPointerTy() in Type class. George On Mon, Aug 20, 2012 at 12:39 PM, John Backes <back0145 at umn.edu> wrote: > Hello, > > I was wondering how you can identify whether or not an Argument is a > pointer. The "isDereferenceablePointer" function for Values doesn't > seem to be what I want (I don't care whether or not the pointer points > to