I'm having a very frustrating problem, trying to find the inverse distance
squared weighted interpolants of some weather data.
I have a data frame of weights, which sum to 1. I have attached the weights
data. I also have a data frame of temperatures at 48 grid points, which I
have also attached.
http://r.789695.n4.nabble.com/file/n4632406/temp3880.csv temp3880.csv
http://r.789695.n4.nabble.com/file/n4632406/weight3880.csv weight3880.csv
Here are the files I promised to upload.
--
View this message in context:
http://r.789695.n4.nabble.com/rowSums-problem-tp4632405p4632406.html
Sent
Hello,
The files you've uploaded are the weights file and the results file, not
the original temp.csv.
So this is untested but it seems you have a standard matrix multiply
problem.
temp3880W - temp[, 3:50] %*% weight3880
Hope this helps,
Rui Barradas
Em 05-06-2012 15:48, alonis10
-
From: vashchyshy...@gmail.com
Sent: Tue, 5 Jun 2012 07:48:51 -0700 (PDT)
To: r-help@r-project.org
Subject: [R] rowSums problem
I'm having a very frustrating problem, trying to find the inverse
distance
squared weighted interpolants of some weather data.
I have a data frame
This is precisely what I needed; I can't believe how simple it is. Thanks!
--
View this message in context:
http://r.789695.n4.nabble.com/rowSums-problem-tp4632405p4632461.html
Sent from the R help mailing list archive at Nabble.com.
__
I am trying to construct a data set with some sequences for example:
a = seq(0,1,0.1)
m = matrix(nrow = 1331, ncol = 3)
m[,1] = rep(a,121)
m[,2] = rep(a,11,each = 11)
m[,3] = rep(a,1,each = 121)
I realize that there may be better ways of doing this, but this approach
demonstrates the problem
Hi Tom,
That's once again the floating point number issue: see FAQ 7.31.
Look at this:
sum(m[161,])
[1] 1
sum(m[161,])==1
[1] FALSE
sum(m[161,])-1
[1] 2.220446e-16
So 0.6+0.3+0.1 is indeed greater than 1
Try this instead:
round(sum(m[161,]))==1
[1] TRUE
HTH,
Ivan
Le 3/7/2011 08:08,
is
THOU SHALT NOT TEST WHETHER TWO FP NUMBERS ARE EQUAL
HTH
Rex
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of thomas.salve...@syngenta.com
Sent: Monday, March 07, 2011 2:09 AM
To: r-help@r-project.org
Subject: [R] rowSums - am I
I have a question on RowSums.
Lets say i have a timeSeries table
A B C
1/1/90 NA 1 1
1/2/90 NA 1 1
1/3/90 NA 1 1
1/4/90 NA 1 1
1/5/901 1 1
1/6/901 1 1
if i use RowSums, i will get
1/5/903
Try this:
rowSums(tsObj, na.rm = TRUE)
On Thu, Nov 18, 2010 at 3:58 PM, cameron raymond...@invesco.com wrote:
I have a question on RowSums.
Lets say i have a timeSeries table
A B C
1/1/90 NA 1 1
1/2/90 NA 1 1
1/3/90 NA 1 1
1/4/90
thanks Henrique
I have another question.
Lets say i have a timeSeries table
AB C
1/1/90 NA 1 2
1/2/90 NA 1 1
1/3/90 NA 1 -1
1/4/90 NA -1 1
1/5/901 1 1
1/6/901 51 1
I want to
Hi Cameron,
May be this (untested)?
rowSums(is.na(tsObj), na.rm = TRUE)
HTH,
Jorge
On Thu, Nov 18, 2010 at 2:38 PM, cameron wrote:
thanks Henrique
I have another question.
Lets say i have a timeSeries table
AB C
1/1/90 NA 1 2
1/2/90 NA
Thanks Jorge
It works great. I solved it by using loop, but i like your way better.
Thanks again
Cameron
--
View this message in context:
http://r.789695.n4.nabble.com/RowSums-Question-tp3049261p3049682.html
Sent from the R help mailing list archive at Nabble.com.
Say I have the following data:
testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))
testDat
A B
1 1 NA
2 NA NA
3 3 3
rowsums() with na.rm=TRUE generates the following, which is not desired:
rowSums(testDat[, c('A', 'B')], na.rm=T)
[1] 1 0 6
rowsums() with na.rm=F generates the
I guess this would be the fastest way would be:
rs - rowSums( testDat, na.rm=T)
rs[ which( rowMeans(is.na(testDat)) == 1 ) ] - NA
since both rowSums and rowMeans are internally coded in C.
Regards, Adai
Doran, Harold wrote:
Say I have the following data:
testDat - data.frame(A =
On 9/24/2008 10:06 AM, Doran, Harold wrote:
Say I have the following data:
testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))
testDat
A B
1 1 NA
2 NA NA
3 3 3
rowsums() with na.rm=TRUE generates the following, which is not desired:
rowSums(testDat[, c('A', 'B')],
try the following:
testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))
ind - rowSums(is.na(testDat)) == length(testDat)
out - rowSums(testDat, na.rm = TRUE)
out[ind] - NA
out
I hope it helps.
Best,
Dimitris
Doran, Harold wrote:
Say I have the following data:
testDat - data.frame(A =
on 09/24/2008 09:06 AM Doran, Harold wrote:
Say I have the following data:
testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))
testDat
A B
1 1 NA
2 NA NA
3 3 3
rowsums() with na.rm=TRUE generates the following, which is not desired:
rowSums(testDat[, c('A', 'B')],
On 9/24/2008 10:38 AM, Marc Schwartz wrote:
on 09/24/2008 09:06 AM Doran, Harold wrote:
Say I have the following data:
testDat - data.frame(A = c(1,NA,3), B = c(NA, NA, 3))
testDat
A B
1 1 NA
2 NA NA
3 3 3
rowsums() with na.rm=TRUE generates the following, which is not desired:
On Tue, 20 Nov 2007, Tim Hesterberg wrote:
I wrote the original rowSums (in S-PLUS).
There, rowSums() does not coerce integer to double.
Actaully, neither does R. It computes a double answer but does no
coercion per se.
However, one advantage of coercion is to avoid integer overflow.
On 21 Nov 2007, at 08:30, Prof Brian Ripley wrote:
On Tue, 20 Nov 2007, Tim Hesterberg wrote:
I wrote the original rowSums (in S-PLUS).
There, rowSums() does not coerce integer to double.
Actaully, neither does R. It computes a double answer but does no
coercion per se.
However, one
On Wed, 21 Nov 2007, Robin Hankin wrote:
On 21 Nov 2007, at 08:30, Prof Brian Ripley wrote:
On Tue, 20 Nov 2007, Tim Hesterberg wrote:
I wrote the original rowSums (in S-PLUS).
There, rowSums() does not coerce integer to double.
Actaully, neither does R. It computes a double answer
I wrote the original rowSums (in S-PLUS).
There, rowSums() does not coerce integer to double.
However, one advantage of coercion is to avoid integer overflow.
Tim Hesterberg
... So, why does rowSums() coerce to double (behaviour
that is undesirable for me)?
Hi
[R-2.6.0, macOSX 10.4.10].
The helppage says that rowSums() and colSums()
are equivalent to 'apply' with 'FUN = sum'.
But I came across this:
a - matrix(1:30,5,6)
is.integer(apply(a,1,sum))
[1] TRUE
is.integer(rowSums(a))
[1] FALSE
so rowSums() returns a float.
Why is this?
--
24 matches
Mail list logo