similar to: Subtracting one based on an If

Displaying 20 results from an estimated 200 matches similar to: "Subtracting one based on an If"

2010 Feb 17
1
Procedure not working for actual data
Hello all, I have what i feel is a unique situation which may not be resolved with this inquiry. I have constructed the below data set so that i may give an example of what im doing. The example works perfectly and i have no issues with it. My problem arises with my actual data, which includes another 11 columns of data (used in later analysis) and a total of about 7000 cases(rows). i
2009 Oct 29
5
Summing identical IDs
Hello All, I would like to select records with identical IDs then sum an attribute then and return them to the data frame as a single record. Please consider Acres<-c(100,101,100,130,156,.5,293,300,.09) Bldgid<-c(1,2,3,4,5,5,6,7,7) DF=cbind(Acres,Bldgid) DF<-as.data.frame(DF) So that: Acres Bldgid 1 100.00 1 2 101.00 2 3 100.00 3 4 130.00 4 5 156.00 5
2006 Apr 21
1
Titles in MAplots
Hi Does anyone know how to set the titles in MAplots to just show the CEL file name? So far I have; #define 'Array' as object containing CEL names Array <- col.names(Data) #open bmp and make a separate bmp for each MAplot bmp("C:/MAplot%03d.bmp") #remove the annotation and minimise margins par(ann=FALSE) par(mar=c(1,1,1,1)) #MAplot MAplot(Data...???? Does anyone know the
2011 Feb 07
1
color2d.maplot error
Dear all I am using color2D.maplot to map some matrixes to plot. everything works fine. It seems that when my matrix contains only the same value color2D.maplot returns the following error: color2D.matplot(estimatedsr,redrange=c(0,1),greenrange=c(0,.5),bluerange=c(0,.5),xlab="x",ylab="y",main=sprintf('Estimated'),show.legend=TRUE,show.values=TRUE) Error in rgb(reds,
2011 Feb 10
1
color2D.maplot fixed color range
Dear all, I have -one matrix sr ([200,200]) which is the original file -25 matrixes estimatedsr ([200,200]) which are an estimation of the sr. As I am plotting these matrixes I want to have ONE common way that the cells are colored. Eg. Values from 10-20--> red color, 20-30-->blue color (or something like that). This is the only way one can easily compare all these matrixes together. The
2010 Jan 12
5
Drop last numeral
Hello all, Frustrated and i know you can help I need to drop the last numeral of each of my values in my data set. So for the following i have tried the ?substring but since i have to specify the length, but because my data are of varying lengths it doenst work so well Data<-c("1131", "1132", "1731" ,"1732" ,"1821" ,"1822",
2011 Jan 23
1
Plotting multiple xts/zoo time series on a single plot.
So I've got a 154 column wide xts time series object and I want to plot the 154 series on a single plot and have the added benefit of the time series dates on the x axis. Any suggestions for plotting functions, maplot works but does not give dates on the axis and I can't seem to get plot to give me more than one series. Nick [[alternative HTML version deleted]]
2013 Jul 24
0
subtracting rows for unique
Hi, Try: dat1<- read.table(text=" ID Date x2 x1????????? x3 56 25-Jun-01 10 2? 126 56 29-Oct-01 10 2? 140 56 18-Mar-02 10 2? 445 56 6-Jun-03 10 2??? 224 56 16-Jan-04? 10 2??? NA 58 10-Jan-02 10.8 1 715 58 26-Dec-03 10.8 1??? NA ",sep="",header=TRUE,stringsAsFactors=FALSE) ?unlist(with(dat1,by(as.Date(Date,format="%d-%b-%y"),ID,FUN=function(x)
2004 May 26
2
Subtracting number of days from a date
Hi group, suppose I have a date, say May 15 2004, and I want to now what date it is 23 days before that date. The way to calculate the new date should (...) take account of leap years :) In pseudocode: olddate <- "May 15 2004" newdate <- olddate-23 I looked around in POSIXct etc..., maybe I overlooked? Thanks, Maarten
2019 Sep 30
1
Re: [PATCH nbdkit v2 1/4] common/include: Add function for subtracting struct timeval.
On 9/28/19 3:02 PM, Richard W.M. Jones wrote: > --- > common/include/test-tvdiff.c | 75 +++++++++++++++++++++++++++++------- > common/include/tvdiff.h | 13 ++++++- > 2 files changed, 74 insertions(+), 14 deletions(-) > ACK > int > -main (void) > +main (int argc, char *argv[]) Not sure this part matters, but doesn't hurt either. > +++
2010 Feb 02
1
Subtracting time series
Hi all, I've got a time series object (xts) called table. Table contains closing price and volume for each market day of 2009 on a given equity. I'd like to get another xts object, say table2, that contains for each market day holds the close of that day minus the close of the day before and the volume of that day minus the volume of the day before. So table2 <- table[x,] -
2013 Sep 10
1
Subtracting elements of a vector from each other stepwise
I am trying to figure out how to create a loop that will take the difference of each member of a vector from each other and also spit out which one has the least difference. I do not want the vector member to subtract from itself or it must be able to disregard the 0 obtained from subtracting from itself. For example: x = c(17,19,23,29) 1. abs(x-x[1]) = (0, 2, 6, 12) 2. abs(x-x[2]) = (2, 0,
2010 Jun 14
1
Subtracting POSIXct data/times
I have two dataframe columns of POXIXct data/times that include seconds. I got them into this format using for example zsort$ETA <- as.POSIXct(as.character(zsort$ETA), format="%m/%d/%Y %H:%M:%S") My problem is that when I subtract the two columns, sometimes the difference is given in seconds, and sometimes it is given in minutes. I don't care which it is, but I need to know which
2007 Sep 24
2
a bug when subtracting vectors?
Hi, I am calling in some data into R via the read.table function. The 'tail' of this data reads > tail(data) Date Open High Low Close Volume 3728 Fri 14-Sep-07 114.19 114.46 113.93 114.08 1117992 3729 Mon 17-Sep-07 113.99 114.37 113.91 114.27 899671 3730 Tue 18-Sep-07 114.30 114.32 113.47 113.85 1346282 3731 Wed 19-Sep-07 113.71 113.71
2011 May 25
1
Subtracting rows by id
Dear R users, I have two datasets: id1 <- c(rep(1,10), rep(2,10), rep(3,10)) value1 <- sample(1:100, 30, replace=TRUE) dataset1 <- cbind(id1,value1) id2 <- c(1,2,3) subtract.value <- c(1,3,5) dataset2 <- cbind(id2, subtract.value) I want to subtract the number of rows in the subtract.value that corresponds to the id value in dataset1. So for the 1 in id1, I want to
2019 Sep 28
0
[PATCH nbdkit v2 1/4] common/include: Add function for subtracting struct timeval.
--- common/include/test-tvdiff.c | 75 +++++++++++++++++++++++++++++------- common/include/tvdiff.h | 13 ++++++- 2 files changed, 74 insertions(+), 14 deletions(-) diff --git a/common/include/test-tvdiff.c b/common/include/test-tvdiff.c index 9cbcfc0..abefb2e 100644 --- a/common/include/test-tvdiff.c +++ b/common/include/test-tvdiff.c @@ -36,7 +36,6 @@ #include <stdlib.h> #include
2005 Nov 15
2
Subtracting timeseries objects
Sorry to keep posting but I want to do this right and I'm hoping for some pointers I now have two time series objects which I need to subtract. Unfortunatly the two series dont have the same sample rates. When I try to subtract them avgSub<-avg1-avg2 The time series object is clever enough to object. So I guess I need to write a function for subtraction of the time series objects which
2010 Sep 03
1
Incorrect formatted output after subtracting non-integer seconds from POSIXt origin
> x<-as.POSIXct("1970-1-1", tz="UTC")-.5 > y<-as.POSIXct("1970-1-1", tz="UTC")+.5 > x==y [1] FALSE # of course but x and y "appear" to be the same when formatted, even with extra precision: > format(x, format="%Y-%m-%d %H:%M:%OS2") [1] "1970-01-01 00:00:00.50" > format(y, format="%Y-%m-%d
2005 Oct 30
1
Help with Subtracting an effect from a Mixed Model
Hi Everyone, I posted a similar question about a week ago, but haven't gotten any replies -- I'm afraid that's because my previous question was too vague. Let me try again with a more specific question, and I hope someone can help. NOTE, I know I should be using the newer lme4 package, I just haven't had a chance to update my version of R yet, so the question below relates
2009 Apr 20
8
bug when subtracting decimals?
Try this: 0.7-0.3==0.4 (We get FALSE) 0.7-0.3<0.4 (We get TRUE) but 0.8-0.3==0.5 (TRUE) 0.8-0.3<0.5 (FALSE) Funny, he? There is a way around: round(0.7-0.3,1)==0.4 (TRUE) Obviously there is a problem with some combinations of decimal subtractions, that - we have the feeling - shouldt be solved. Best regards Sven & Wolfgang -- View this message in context: