Displaying 20 results from an estimated 10000 matches similar to: "rowSums - am I getting something wrong?"
2013 Feb 06
1
weighing proportion of rowSums in dataframe
Dear R-List,
I am sure there must be a very simple way to do this - I just do not know how...
This is what I want to do:
#my dataframe
df<-data.frame(id=c("x01","x02","x03","x04","x05","x06"),a=c(1,2,NA,4,5,6),b=c(2,4,6,8,10,NA),c=c(NA,3,9,12,NA,NA),sum=c(3,9,15,24,15,6))
id a b c sum
1 x01 1 2 NA 3
2
2013 Nov 26
7
[PATCH RESEND 0/1] libxl: introduce an option for disabling the non-O_DIRECT
I think I posted this patch before, but it looks like it was in
December 2012 (!).
1/1 libxl: introduce an option for disabling the non-O_DIRECT workaround
Ideally it would go into 4.4, at least. Provided the corresponding
qemu part has gone into qemu-xen, which I think it has. Can anyone
confirm ?
2010 Aug 17
2
Matrix
How do I completely remove the first column?
(x <- matrix(c(1, 44, 124, 80, 254, 70, 190, 0, 2, 35, 110, 70, 240, 73, 216, 0, 3, 41, 114, 80, 279, 68, 178, 0, 4, 31, 100, 80, 284, 68, 149, 0, 5, 61, 190, 110, 315, 68, 182, 1, 6, 61, 130, 88, 250, 70, 185, 0, 7, 44, 130, 94, 298, 68, 161, 0, 8, 58, 110, 74, 384, 67, 175, 0, 9, 52, 120, 80, 310, 66, 144, 0, 10, 52, 120, 80, 337, 67, 130, 0, 11,
2012 Jun 05
3
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 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.
Now, all I need to do is multiply all of the rows of the temperature data
frame by the weights
2012 Feb 02
4
The "less than" (<) operator doesnt seem to perform as expected
The example here puzzles me. It seems like the < operator doesn't work as expected.
> l <- 0.6
> u <- seq(0.4, 0.7, 0.1)
> u
[1] 0.4 0.5 0.6 0.7
> mygrid <- expand.grid("l" = l, "u" = u)
> mygrid
l u
1 0.6 0.4
2 0.6 0.5
3 0.6 0.6
4 0.6 0.7
> mygridcollapsed <- mygrid[mygrid$l < mygrid$u, ]
> mygridcollapsed
l u
3 0.6 0.6
4
2013 Jan 03
2
Sas by function in R
Hello,
It's an alternative to use SAS by function in R?
I want to plot d histograms by plot.from example bellow:
Thank you!
plot d
1 1 16.3
2 1 25.0
3 1 57.8
4 1 17.0
5 2 10.8
13 2 96.4
17 3 76.0
18 3 32.0
19 3 11.0
20 3 11.0
24 3 106.0
25 3 12.5
21 4 19.3
22 4 12.0
26 4 15.0
27 5 99.3
32 7 11.0
36
2017 Jun 19
2
LLVM behavior different depending on function symbol name
On Mon, Jun 19, 2017 at 12:06 PM, Mehdi AMINI <joker.eph at gmail.com> wrote:
> Hi,
>
> 2017-06-19 8:45 GMT-07:00 Andrew Kelley via llvm-dev <
> llvm-dev at lists.llvm.org>:
>
>> Greetings,
>>
>> I have a Zig implementation of ceil which is emitted into LLVM IR like
>> this:
>>
>> ; Function Attrs: nobuiltin nounwind
>> define
2013 Feb 06
0
weighing proportion of rowSums in dataframe
Hi Eik,
thank you so much - it works perfectly!
Thank you and best wishes
Alain
Eik Vettorazzi <E.Vettorazzi@uke.de> hat am 6. Februar 2013 um 17:01 geschrieben:
> Hi Alain,
> here is a one-liner for a df without the rowSum column
>
>
2007 Sep 14
6
replace NA value with 0
Hi,
how can I replace NA value with 0:
1991 217 119 103 109 137 202 283 240 146 NA
1992 270 174 149 144 166 239 278 237 275 NA
1993 146 111 104 89 98 131 153 148 175 NA
1994 177 123 146 124 121 200 266 191 240 106
1995 145 98 95 89 95 130 183 161 164 129
1996 145 98 89 90 93 138 158 131 161 161
1991 217 119 103 109 137 202 283 240 146 0
1992 270 174 149 144 166 239 278 237
2004 Sep 03
6
seq
Hi everyone,
I've tried the below on R 1.9.1 and the 2004-08-30 builds of R 1.9.1
Patched and R 2.0.0 on Windows 2000, and the results are consistent.
> seq(0.5, 0, by = -0.1)
[1] 0.5 0.4 0.3 0.2 0.1 0.0
> seq(0.7, 0, by = -0.1)
[1] 7.000000e-01 6.000000e-01 5.000000e-01 4.000000e-01 3.000000e-01
2.000000e-01 1.000000e-01 -1.110223e-16
Is this really the intended behaviour?
2007 Mar 28
5
Large matrix into a vector
Hi,
I have a matrix HR(9x27). I would like to make a
single vector with elements: t(HR[,1]) followed by
t(HR[,2]) and then t(HR[,3] ... etc. Is there any neat
way of converting this matrix into a vector rather
doing something like c(t(HR[,1]), t(HR[,2]), t(HR[,3])
..)?
Thanks in Advance.
Kind regards,
Ezhil
____________________________________________________________________________________
2009 Oct 20
2
descriptive statistics qn
This is day one on R for me, I am trying to figure out how to do simple
computations. For example I have a data set with 200 observations. I am
trying to compute the mean and variance in r for 1:25 (first 25
observations); 1:50 (first 50 obs) ; 1:100th observation etc. Here is the
dataset:
Id value
1 2.2338
2 3.13597
3 1.98685
4 4.35593
5 2.43963
6 4.20262
7 3.12131
8 4.79583
9 3.13937
10
2009 Nov 30
2
command similar to colSums for rowSums?
Working with an NxMxO sized matrix, currently I can do this in my code:
if (max(colSums(array)) >= number)
But to get an equivalent result using rowSums, I have to do:
for (i in 1:10)
{
if (max(rowSums(array[,,i])) >= number)
}
I'm running both in a much larger loop that loops millions of times, so
speed and such is quite a big factor for me. Currently, the colSums line
uses about
2005 Apr 21
1
colSums and rowSums with arrays - different classes and dim ?
Hi,
I'm using colSums and rowSums to sum the first dimensions of arrays. It
works ok but the resulting object is different. See
> a3d <- array(rnorm(120, mean=2), dim=c(20,6,1))
> dim(colSums(a3d))
[1] 6 1
> dim(rowSums(a3d))
NULL
> class(colSums(a3d))
[1] "matrix"
> class(rowSums(a3d))
[1] "numeric"
I was expecting rowSums to preserve the array
2012 Mar 26
4
reading header in txt file and making histogram
Dear all
I am a BEGINNER and have R on my Mac. I saved my excel file as .txt file, I
have just one column with first row as the column name. My file when read by
R looks like this. After reading the table I try to make a histogram by
hist(dbh), it says object dbh not found. What am I doing wrong? thanks
dbh
1 11.53
2 16.05
3 7.36
4 16.05
5 8.66
6 12.74
7 22.93
8 7.55
9
2007 Nov 09
2
rowSums() and is.integer()
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?
--
Robin Hankin
Uncertainty Analyst
National Oceanography Centre,
2008 Jan 11
2
How to add rowSums into list?
Hi R-users,
I have a list
a <- list(one=matrix(rnorm(20), 5, 4), two=matrix(rnorm(20, 3, 0.5),5,4))
How to add rowSums (calculated using lapply) to corresponding matrix
in this list
lapply(a, function(x) rowSums(x))
??
-Lauri
2010 Nov 18
2
RowSums Question
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/90 1 1 1
1/6/90 1 1 1
if i use RowSums, i will get
1/5/90 3
1/6/90 3
but i want
1/1/90 2
1/2/90 2
1/3/90 2
1/4/90 2
1/5/90 3
1/6/90 3
I cant
2011 May 16
2
conditional rowsums in sapply
Hi all
I have a data frame with duplicate columns and i want to remove duplicates
by adding rows in each group of duplicates, but have lots of NA's.
Data:
dfrm <- data.frame(a = 1:4, b= 1:4, cc= 1:4, dd=1:10, ee=1:4)
names(dfrm) <- c("a", "a", "b", "b", "b")
dfrm[3,2:3]<-NA
dfrm
a a b b b
1 1 1 1 1 1
2 2 2 2 2 2
3
2010 Aug 12
3
Error in rowSums
Hi
I am trying to calculate the row sums of a matrix i have created
The matrix ( FeaturePresenceMatrix) has been created by
1) Read csv
2) Removing unnecesarry data using [-1:4,] command
3) replacing all the NA values with as.numeric(0) and all others with as.numeric
(1)
When I carry out the command
TotalFeature <- rowrowSums(FeaturePresenceMatrix, na.rm = TRUE)
I get the following