Displaying 20 results from an estimated 99 matches for "substraction".
2011 Oct 09
2
Substract "previous" element
Dear all,
I have a matrix with data and I want to substract from every value the previous element.
Let's assume that my vector(matrix) is c<-(1,2,3,4,5)
I want to get remove_previous c<-(0,1,2,3,4).
How I can do that efficiently in R?
I would like to thank you in advance for your help
B.R
Alex
[[alternative HTML version deleted]]
2011 Mar 21
3
How to substract a valur from dataframe with condition
Hello All,
I need help with my dataframe, it is big but here I am using a small table
as an example.
My dataframe df looks like:
X1 X2 X3
1 2011-02 0.00 96.00
2 2011-02 0.00 2.11
3 2011-02 2.00 3.08
4 2011-02 0.06 2.79
5 2011-02 0.00 96.00
6 2011-02 0.00 97.00
7 2011-02 0.08 2.23
I want values in columns X2 and X3 to be checked if they are greater than
2008 Jan 07
2
Efficient way to substract all entries in two vectors from each other
Hi all,
I'm to inexperienced to come up with the matrix solution elusively appearing
on the horizon for the following problem and would appreciate if you could
give me a nudge ...
I have two vectors a, and b and need to find the closest match for each
value of a in b.
How to do that efficiently?
Thanks, Joh
2012 Sep 12
3
how to create a substraction matrix (subtract a row of every column from the same row in other columns)
...(This would probably entail just taking a portion of the matrix.) .
This is what the result would be
difftype value
x1x2
x1x3
x1x4
x1x5
x2x3
x2x4
x2x5
x3x4
x3x5
x4x5
Thank you for any help you can give me.
--
View this message in context: http://r.789695.n4.nabble.com/how-to-create-a-substraction-matrix-subtract-a-row-of-every-column-from-the-same-row-in-other-column-tp4642949.html
Sent from the R help mailing list archive at Nabble.com.
2012 Oct 05
3
loop for column substraction of a matrix
Dear useRs,
I have a matrix with 38 columns and 365 rows. what i want to do is the following.....
1. subtracting from each column, first itself and then all the remaining columns. More precisely, from column number 1, i will first subtract itself(column 1) and then the remaining 37 columns. Afterwards i will take column number 2 and do the same. In this way i want to proceed till 38th column.
2006 Mar 06
7
is there a way to let R do smart matrix-vector operation?
Hi all,
I want to substract vector B from A's each column... how can R do that
smartly without a loop?
> A=matrix(c(2:7), 2, 3)
> A
[,1] [,2] [,3]
[1,] 2 4 6
[2,] 3 5 7
> B=matrix(c(1, 2), 2, 1)
> B
[,1]
[1,] 1
[2,] 2
> A-B
Error in A - B : non-conformable arrays
[[alternative HTML version deleted]]
2013 Oct 03
1
prcomp - surprising structure
...column" in my data (see attachment). I
suggest it is an artefact (but of what?).
Suggestion:
I used prcomp this way: prcomp (mat), where mat is a matrix with the column
means already substracted followed by a normalisation procedure (see below
for details). Is that okay? Or does prcomp repeat substraction steps?
Originally my approach was driven by the idea to compute a covariation
matrix followed by the use of eigen, but the covariation matrix was to huge
to handle. So I switched to prcomp.
As I guess that the "columns" in my plots reflect some artefact production
I hope to get some hel...
2012 Jul 31
1
TimeStamps to seconds
Dear all,
I am having a matrix that stores data information in the following format.
> roofPart1$TimeStamps[1:5,]
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 2011 7 21 15 25 20.609
[2,] 2011 7 21 15 25 23.265
[3,] 2011 7 21 15 25 26.000
[4,] 2011 7 21 15 25 28.671
[5,] 2011 7 21 15 25 31.343
I would like to be able to report some simple statistics
2003 Sep 02
1
convert character to POSIXct
Dear list-members,
I would like to calculate the difference between two points in time. To convert a 'time (GMT)'-character with the format "1/1/1999 01:01:01" into an object of class "POSIXct"', I first use the strptime() as suggested in the details help(as.POSIXct).
e.g.
starttime<-strptime("1/1/1999 01:01:01",format="%d/%m/%Y %H:%M:%S")
2011 Feb 27
2
substract 2 data.frames
Hi!
I have 2 data.frames: "fish" and "popn":
>fish
xloc yloc id birth size weight energy gonad
20 15 15 54 -60 107.9 63.0 15952.9 8.0
21 15 15 32 -60 105.1 61.4 15538.8 7.8
91 4 43 96 -60 118.9 69.4 17573.2 8.8
71 32 4 64 -60 121.6 71.0 17976.0 9.0
34 2 64 20 -60 116.2 67.9 17173.0 8.6
95 6 20 58 -60 106.5
2008 May 21
3
Converting a 'difftime' to integer - How to???
I want to find the DOY (Day of Year) of some dates. I think to substract the date 1. January from the data to achive this. Something like:
> d <- as.Date("2006-03-13") - as.Date("2006-01-01") +1
> d
Time difference of 72 days
So far so good. But d is a 'difftime' object. How do I get an Integer value from that?
I tried severel things, incuding the
2010 Apr 23
3
substract start from the end of the vector
Dear group,
Here is my df :
df <-
structure(list(DESCRIPTION = c("PRM HGH GD ALUMINIUM USD 09/07/10 ",
"PRM HGH GD ALUMINIUM USD 09/07/10 ", "PRIMARY NICKEL USD 04/06/10 "
), CREATED.DATE = structure(c(18361, 18361, 18325), class = "Date"),
QUANITY = c(-1L, 1L, 1L), CLOSING.PRICE = c("2,415.90", "2,415.90",
2019 Mar 01
2
Meaning of `sub nsw`
In the following code.
unsigned char x1 = atoi(argv[1]);
unsigned char x2 = atoi(argv[2]);
printf("%d\n", x1-x2);
The substraction of the last command is translated to the following IR code.
%18 = load i8, i8* %6, align 1
%19 = zext i8 %18 to i32
%20 = load i8, i8* %7, align 1
%21 = zext i8 %20 to i32
%22 = sub nsw i32 %19, %21
I don't follow the explanation of nsw in langref. Could anybody help
explain what nsw means he...
2007 May 10
3
Getting the last day of the month.
Hi,
Given a date, how do I get the last date of that month? I have
data in the form YYYYMM, that I've read as a date using
> x$Date <-
as.Date(ISOdate(substr(x$YearEnd,1,4),substr(x$YearEnd,5,6),1))
But this gives the first day of the month. To get the last day of the
month, I tried
> as.Date(as.yearmon(x$Date,frac=0))
But I don't get the last day of the month here. (Tried
2023 Feb 21
2
Problem of intercept?
Dear R-experts,
Here below my R code working with quite a few warnings.?
x11 and x12 are dichotomous variable (0=no and 1=yes). I substract 1 to ignore intercept.
I would like not to ignore intercept. How to modify my R code because if I just remove -1 it does not work?
y= c(32,45,65,34,23,43,65,76,87,98,7,867,56,45,65,76,88,34,55,66)
x11=c(0,1,1,0,0,1,1,1,0,0,1,0,0,1,0,0,1,1,0,1)
2009 Dec 01
4
median for time data
Hi everybody
How do I do to calculate the median and average of a colum of time data like
this: "8:50:10". I also need to plot the time difference between two colums
Thanks a lot
--
View this message in context: http://n4.nabble.com/median-for-time-data-tp932287p932287.html
Sent from the R help mailing list archive at Nabble.com.
2011 Jan 28
3
sapply puzzlement
Hi,
I have this data.frame with two variables in it,
> z
V1 V2
1 10 8
2 NA 18
3 9 7
4 3 NA
5 NA 10
6 11 12
7 13 9
8 12 11
and a vector of means,
> means <- apply(z, 2, function (col) mean(na.omit(col)))
> means
V1 V2
9.666667 10.714286
My intention was substracting means from z, so instictively I tried
> z-means
V1 V2
1 0.3333333
2009 Jul 29
3
Newbie in R: Reading .txt files and storing the 'numbers' in a vector
Hello everybody,
I'm a newbie in R and just went through an introduction class recently.
Here's my problem.
I have 2 text files (.txt) with plain numbers ('doubles' for those who
know c++) ordered into 2 columns as below:
coordinate1 value1
coordinate2 value2
coordinate3 value3
... ...
coordinateN valueN
I would like to write a small programme in which i would:
1. take
2012 Mar 27
1
[LLVMdev] Compiling integer mod
For the simple C program below I show the output of clang and the
output of the VS compiler (I am on windows). Maybe this is obvious to
you, but is it really faster to do 2 multiplications, 3 movl
instructions, 2 shifts, 1 add, and 1 substract than to do 1 mov, 1
cdq, and 1 idiv?
I run into this while trying to understand why my code runs slower
with llvm than a comparable program on windows.
2002 Apr 17
1
zero center a group of variables
*This message was transferred with a trial version of CommuniGate(tm) Pro*
A simple question, perhaps to simple, but I am new to R:
For a data frame with k variables and n1+n2 observations (two
groups) how can i substract the group means for every variable, so
both group variables become centered to mean zero?
Thanks in advance for your help
H?ctor