similar to: sequentially summing up a elements of a vector

Displaying 20 results from an estimated 50000 matches similar to: "sequentially summing up a elements of a vector"

2011 Aug 22
2
test if vector contains elements of another vector (disregarding the position)
Hi, I have the following problem: I have two vectors: i <- c('a','c','g','h','b','d','f','k','l','e','i') j <- c('a', 'b', 'c') now I would like to generate a vector with the length of i that has zeros where i[x] != any element of j and 1 where i[x] == any element of j.
2018 May 21
3
draw borders of bars inside of the rectangles in a barplot
Dear R-users, I want to draw a barplot with beside=TRUE. One halve of the bars are drawn with a border, while the other halve are drawn without a border (i.e. filled bars vs. non-filled bars next to each other). Because borders are drawn around the bars, doing this leads to one halve of the bars being wider than the other halve, expanding across the 0-point of the y-axis. This problem emerges
2010 Jan 04
3
Extract vector elements until cumsum <= x
Hi All, I have a vector n, and for each n[i] I want to extract n[i], n[i+1], n[i+2]..., until the cumulative sum of n[i] and subsequent elements exceeds a CheckValue, whereupon I move to the next index and repeat. I am trying to find a Vectorized approach, and have seen similar posts where filter{stat} and rollmean{zoo} were suggested, but, I haven't been able to figure a way to use them
2007 May 21
2
sequentially process a list
Hi dear R users, I'm a R beginner and I have a basic question about sequential treatments of lists. I have a time based (i.e. events are consecutive) list of values of a biological property. Like : time value 1 5 2 10 3 7 4 10 5 19 6 21 7 20 8 18 9 10 10 7 11 8 12 12 13 17 14 19 15 24 16 18 17 15 18
2008 May 12
2
Cumulative lattice histograms
An embedded and charset-unspecified text was scrubbed... Name: inte tillg?nglig URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20080512/9533b31f/attachment.pl>
2012 Aug 24
6
updating elements of a vector sequentially - is there a faster way?
I would like to know whether there is a faster way to do the below operation (updating vec1). My objective is to update the elements of a vector (vec1), where a particular element i is dependent on the previous one. I need to do this on vectors that are 1 million or longer and need to repeat that process several hundred times. The for loop works but is slow. If there is a faster way, please let
2002 Jan 07
1
Help with displaying multiple data elements on one graph
I'm interested if anyone can help me to the R to display multiple data elements on one graph - just a simple graph, nothing fancy. I can't seem to find an example of this. An example of what I'm looking for is, say, a CPU graph which graphs user, system, and idle time as a cumulative stack representing each data element as a different color. See the following URL for an example
2009 Jul 10
2
while( ) to get a vector until the sum of elements are <= X ?
I have a vector of values X = seq(1:10) I want to get another vector V of with sample (with replacement) of X but with a constrain: V will have as much elements as those necessary to V sum exactly 10. If the N-th value of V make the sum greater than 10, it's is subtracted with the difference to achieve the constrain. I don't know how to achieve this. with a while?
2018 May 21
0
draw borders of bars inside of the rectangles in a barplot
I recommend instead of no border, that you use a border with the same color as the fill. I do this in the likert functions in the HH package. Rich On Mon, May 21, 2018 at 10:59 AM, Martin Batholdy via R-help <r-help at r-project.org> wrote: > Dear R-users, > > I want to draw a barplot with beside=TRUE. > One halve of the bars are drawn with a border, while the other halve are
2010 May 26
2
sequential treatment of a vector for formula
Please pardon the simplicity of this question of biological nature. I'm trying to calculate a statistic, px, the proportion of a cohort that survives through the interval x:x+1. I have the vector from which the calc is to be made but I can't figure out how to tell R to take the current value and divide it by the next value. The formula is P0=L1/LO The following is an example of the
2013 Feb 26
4
cut a vector in equal parts
Hi, I would like to cut a vector of values in parts. Each part should have an equal number of elements. for example: x <- (rnorm(500)^2) now I want 5 vectors each with 100 elements. The first vector should include the 100 lowest values of x and so on (so that the fifth vector contains the 100 highest values of x). thanks for any help!
2006 Dec 08
1
missing factor levels in a lattice barchart panel cause unexpected failure
Hi all - I'm trying to generate lattice barchart graphs with missing values, and came across the following: This does not run. I would expect it to: library(lattice) D = data.frame(X=1, Y=factor(letters[2], letters[1:2])) barchart(~ X, D, groups=Y) Error in grid.Call.graphics("L_rect", x$x, x$y, x$width, x$height, resolveHJust(x$just, : invalid line type which is simply
2010 Jan 12
1
barplot: border color when stacked
Dear R-users, I am using R version 2.10.1 under windows. In a barplot, I want to mark one of the bars with a special border color. For example: barplot(c(3, 7, 11), border = c(NA, "red", NA)) But how to do this when the bars are stacked? for example: barplot(matrix(1:6, ncol=3)) # border of second bar (i.e. the one with total height = 7) should be red again, I try: barplot(matrix(1:6,
2011 Jun 07
1
count length of continues elements in a vector
I am performing a precipitation analysis. data is in the form of daily precipitation amounts, e.g. x<- c(4,5,3,0,0,0,2,4,6,4,0,0,0,2,2,0,3,4,1,0,...) I would like to find the length of the "storm", length of storm would be defined as the number of days with continues precipitation. in this case the returned vector would be: (3,4,2,3,...) I would also like the amount of
2007 Dec 21
3
Finding overlaps in vector
<posted & mailed> Dear all, I'm trying to solve the problem, of how to find clusters of values in a vector that are closer than a given value. Illustrated this might look as follows: vector <- c(0,0.45,1,2,3,3.25,3.33,3.75,4.1,5,6,6.45,7,7.1,8) When using '0.5' as the proximity requirement, the following groups would result: 0,0.45 3,3.25,3.33,3.75,4.1 6,6.45 7,7.1
2011 Oct 18
1
How to read data sequentially into R (line by line)?
I have a data set like this in one .txt file (cols separated by !): APE!KKU!684! APE!VAL!! APE!UASU!! APE!PLA!1! APE!E!10! APE!TPVA!17122009! APE!STAP!1! GG!KK!KK! APE!KKU!684! APE!VAL!! APE!UASU!! APE!PLA!1! APE!E!10! APE!TPVA!17122009! APE!STAP!1! GG!KK!KK! APE!KKU!684! APE!VAL!! APE!UASU!! APE!PLA!1! APE!E!10! APE!TPVA!17122009! APE!STAP!1! GG!KK!KK! it contains over 14 000 000 records. Now
2011 Dec 09
3
bug in sum() on integer vector
Hi, x <- c(rep(1800000003L, 10000000), -rep(1200000002L, 15000000)) This is correct: > sum(as.double(x)) [1] 0 This is not: > sum(x) [1] 4996000 Returning NA (with a warning) would also be acceptable for the latter. That would make it consistent with cumsum(x): > cumsum(x)[length(x)] [1] NA Warning message: Integer overflow in 'cumsum'; use
2010 Feb 09
3
split strings in a vector and convert it to a data.frame
hi, I have a vector full of strings like; xy_100_ab xy_101_ab xy_102_ab xy_103_ab I want to seperate each string in three pieces and the separator should be the "_" at the end I want a data.frame like: column1 column2 column3 xy 100 ab xy 101 ab xy 102 ab xy 103 ab I tried strsplit but I couldn't figure out how to convert the list I get into a data.frame. I just
2012 Feb 02
1
get mean of same elements in a data.frame
Hi, I have the following data.frame: data.frame(x = c(1:10), y = rnorm(10,2,1), label = rep(c('a', 'b', 'c', 'd', 'e'),2)) in this data.frame there is a label-variable containing strings. Each string is represented two times. Now I would like to have the mean of the corresponding x (and y-values) for every unique label-element. For the label
2008 Feb 25
1
color area between two time-series via polygon()?
Hi all, I would like to color the area between two time-series. I tried it by using the polygon() function but I keeps drawing lines between beginning and end points. Is there another more appropriate function or how could I close the polygon at the end en the beginning of the time series (e.g., drawing a straight line)? The following doesn't plot a polygon between the two