Displaying 20 results from an estimated 130 matches similar to: "HELP: How to subtract a vector out of each row of a matrix or array"
2010 Apr 05
0
subtract a specified number of days from current date
Hi R,
I have a column with dates. I need to create a vector say from (current
date-90 days: current date)
For example I need to subtract 90 days from say Sys.Date()-92
If Sys.Date()-92 == "Sunday", Sys.Date()-92+1
if Sys.Date()-92 == "Saturday", Sys.Date()-92+2
i.e if subtracting gives me a weekend I need the next work day.
I used the below.
2012 Mar 15
1
Subtract Date Between columns
Hello
I have this little dataset, my goal is create one column in the
data.frame with between the diference DataTime and Duration.
I'm using the next code to make do this
TIME_STAMP SESSIONTIME Time TimeStart
1162343932 8320 2006-10-31 19:01:34 2006-10-31 16:42:54
1162343215 592 2006-10-31 19:02:04 2006-10-31 18:52:12
1162341465 11875
2009 Jun 29
1
[LLVMdev] difficulting matching i64 subtract immediate due to isel normalization of sub -> add
Hi,
For some 64-bit immediates, ARM can generate a two instruction
sequence. For example, for the following code:
; 734439407618 = 0x000000ab00000002
define i64 @f1(i64 %a) {
%tmp = sub i64 %a, 734439407618
ret i64 %tmp
}
We should be able to generate:
subs r0, r0, #1
sbc r1, r1, #171 @ 0xab
But instead we get:
$ llvm-as < %s | llc -march=thumb -mattr=+thumb2
mvn r2, #1
2008 Apr 10
2
subtract the mean from each column
Hi,
I am new to R an dI need some help
I have a matrix of real values 100*300 and I would like to calculate the
mean for each column , then for each entry in a column i need to subtract
the mean so I will have a matrix where the columns have zero mean. any one
know how to do that . Thanks
--
View this message in context:
2010 Nov 29
1
How do I subtract sequential values ?
Just starting to learn R so excuse me if this is a simple question. I'm
wondering how I get the percent difference in sequential values in one
column of a dataframe. If I had a dataframe and one of the columns was
"value", how would I go about calculating (v2-v1)/v1 ....(v3-v2)/v2
....(v4-v3)/v3 ...etc ?
--
View this message in context:
2013 Jan 14
1
hwo to subtract a child array from the big array?
hi R users
I have a data set with the name AA
AA<-1:100
Now I want to get a child array from AA every 10 numbers
e.g.
ab =c(10,20,30,40,50,60,70,80,100)
How could I subtract aa from AA?
thank you .
--
TANG Jie
Email: totangjie@gmail.com
Tel: 0086-2154896104
Shanghai Typhoon Institute,China
[[alternative HTML version deleted]]
2015 Nov 19
0
[PATCH 2/3] Add Aarch64 intrinsics for saturated add/subtract.
---
silk/arm/macros_arm64.h | 39 +++++++++++++++++++++++++++++++++++++++
silk/macros.h | 4 ++++
silk_headers.mk | 1 +
3 files changed, 44 insertions(+)
create mode 100644 silk/arm/macros_arm64.h
diff --git a/silk/arm/macros_arm64.h b/silk/arm/macros_arm64.h
new file mode 100644
index 0000000..ed03041
--- /dev/null
+++ b/silk/arm/macros_arm64.h
@@ -0,0 +1,39 @@
2012 Nov 18
0
subtract multiple columns from single column for Nash Sutcliffe efficiency
Hi everyone, I am having trouble using my own data in the Nash-Sutcliffe
efficiency (NSE) function.
In R, this is what I have done:
Vobsr <- read.csv("Observed_Flow.csv", header = TRUE, sep =",") # see data
below
Vsimr <- read.csv("1000Samples_Vsim.csv", header = TRUE, sep =",") # see
data below
Vobsr <- as.matrix(Vobsr[,-1]) # remove column 1
2009 Jul 29
1
Subtract matrices within arrays along indices
I have the following array: 3 dimensional object, one dimension being year.
Object is 3*3*3
library(plyr, reshape)
a1<-rep(c(2007,2008,2009),9)
a2<-c(rep("a",9),rep("b",9),rep("c",9))
a3<-c(rep(c(rep(1,3),rep(2,3),rep(3,3)),3))
a4 <- rnorm(27)
A<-data.frame(cbind(comp=a2,val=a3, year=a1, a4))
A1<-melt(A, id=c("year", "comp",
2008 Jan 29
2
add/subtract matrices, ignoring NA or missing values
Hi,
For example, given two 2x2 matrices m1 and m2. I would like to add/subtract
element by element
> m1
[,1] [,2]
[1,] NA NA
[2,] 1 2
> m2
[,1] [,2]
[1,] 1 NA
[2,] NA 2
> m1 + m2
[,1] [,2]
[1,] NA NA
[2,] NA 4
How can I ignore the NA, and get this ? Hope the solution can be extended to
subtract and modulo also.
[,1] [,2]
2012 Nov 29
3
How to subtract the counter i in for loop?
Hi list,
I am writing a for loop that looks like this:
samples<-rep(NA,10)
x <- rep(c(111, 225), 5)
for(i in 1:10){
If(x[i]<200){
samples[i] <- x[i]
}else{
i=i-1
}
}
The problem is that the returning vector still contains NA, I think the i
in "else" is not getting subtracted. How should I get it to work?
Thanks,
Mike
[[alternative HTML version
2012 Oct 30
3
subtract a time period from a date
Hello everybody,
how can I reduce e.g. 30 days from a date?
When I do the following "2011-05-01 CEST" -"2011-04-01 CEST" I get:
"Time difference of 30 days"
an thats fine.
But when I try "2011-05-01 CEST" - 30 I get nonsense.
So how can I subtract some days, month or years from a date?
thanking you in anticipation
Claudia Paladini
2008 May 07
3
use list elements to subtract values from the dataframe
Hi,
I have a dataframe wf existing of a header with different labels and beneath
the values of those labels :
wf:
label1 label2 ...
0,45 0,21
0,10 0,45
.... ....
I have a list
fl <- c("label2","label3",..)
Isn't possible to use the list elements in the list in order to subtract
values from the dataframe? like :
wf$fl[[1]]
When I do in R I get :NULL
2011 Jul 27
2
Elegant way to subtract matrix from array
there are really two related problems here
I have a 2D matrix
A <- matrix(1:100,nrow=20,ncol =5)
S <- matrix(1:10,nrow=2,ncol =5)
#I want to subtract S from A. so that S would be subtracted from the
first 2 rows of
#A, then the next two rows and so on.
#I have a the same problem with a 3D array
# where I want to subtract Q for every layer (1-10) in Z
# I thought I solved this one
2012 Apr 30
1
Subtract days to dates in POSIXct format
Hello,
I'm having problems working with date values in POSIXct format. Here is what I got (eg.lig attached):
x <- read.table("eg.txt", sep = ',', col.names=c("ok","time","secs","lig")) # it gives time as factor
z <- cbind(x,colsplit(x$time, split="\\s", names=c("date", "clock")))
2009 Mar 19
1
subtract values
Dear R-help
I am using R version 2.6.2. I am trying to subtract specific values from a larger data frame. I feel this should be straightforward, but I am struggling.
I have a dataframe "Bk" as follows:
DateTime cumPrecip
01/01/2008 00:00 348
01/01/2008 01:00 348
01/01/2008 02:00 348
01/01/2008 03:00 347
01/01/2008 04:00 348
01/01/2008 05:00 348
01/01/2008 06:00 349
2011 Jun 18
3
how to subtract one string from another in R
Dear R Group
Here is what i am trying to do.. but couldnt figure out how..
string<-"ABC DEFG HIJKLM NOPQ RSTUV WXY"
string1<-substr(string,1,4)
I want to create an R object string 2 ( following the logic shown).. R does
not allow string subtraction.. any suggestions how to achieve this?
string2<-string-string1 (it should now hold "DEFG HIJKLM NOPQ RSTUV WXY"
I
2003 Sep 04
5
subtract 2 columns in a data.frame
Dear list,
could someone point me to the right command to subtract 2 columns in a
data.frame. Might be a bit embarrassing question. But I cannot figure
out how to do this simple command in R.
Thanks, Ulrich
--
__________________________________________________
Ulrich Leopold MSc.
Department of Physical Geography
Institute for Biodiversity and Ecosystem Dynamics
Faculty of Science
University
2006 Jul 25
6
Subtract a field from the current time in MySQL?
I have the following:
Table Products:
With a column called "purchased_at" of type "datetime".
Products.find(:all, :conditions => ["? - purchased_at >= 120",
Time.now])
Why doesn''t that work? What I''m trying to do is find records that were
purchased less than or equal to 2 minutes ago.
Thanks for your help.
--
Posted via
2012 Mar 29
2
subtract a list of vectors from a list of data.frames in an elegant way
Dear R experts,
I've realized that it might not be possible to define a negative SELCET statement in a SQL call so now I'm looking for the smoothest way to generate a list of what I would like from my large database by first pulling all the names with a query like this "SELECT top 1 * FROM your_table" (thank you Bart Joosen for the idea) and then subtract the variables I am not