Displaying 20 results from an estimated 2000 matches similar to: "two minor bugs in rowsum()"
2011 Mar 29
1
rowsum
> with the entirely different rowSums, but it has been around
> for a long time.)
A lot longer than rowSums ...
> Bill Dunlap
> Spotfire, TIBCO Software
---
This made me smile. The rowsums function was originally an internal
part of the survival package, used for fast computation of certain sums
when there is a cluster() statement. It was Statistical
2001 Sep 13
1
rowsum dimnames
Hi,
The result of rowsum() in R doesn't have the dimnames I'd expect, e.g.:
> rowsum(matrix(1:12, 3,4), c("Y","X","Y"))
[,1] [,2] [,3] [,4]
1 2 5 8 11
2 4 10 16 22
whereas S-Plus gives the more useful result:
[,1] [,2] [,3] [,4]
X 2 5 8 11
Y 4 10 16 22
This is because R's rowsum() code gives
2001 Sep 14
1
rowsum dimnames (PR#1092)
The result of rowsum() in R doesn't have the dimnames I'd expect, e.g.:
> rowsum(matrix(1:12, 3,4), c("Y","X","Y"))
[,1] [,2] [,3] [,4]
1 2 5 8 11
2 4 10 16 22
whereas S-Plus gives the more useful result:
[,1] [,2] [,3] [,4]
X 2 5 8 11
Y 4 10 16 22
This is because R's rowsum() code gives the
2008 Mar 25
2
help with rowsum/aggregate type functions
Hi--
This is a question with a trivial and obvious answer, I'm sure, but I can't seem to find it in the help files and books that I have handy. I have a dataframe consisting of two columns, "Gene_Name," a list of gene symbols, and "Number," a numeric measure of how frequently a tag representing that gene showed up in a SAGE library. Several of the genes are
2003 Aug 13
2
rowsum() may return a vector instead of a matrix (PR#3737)
If all rows are in the same "group", rowsum() returns a vector instead of a
(1xN) matrix, contrary to documentation:
R> print(z <- rowsum(matrix(1:12, 3,4), rep("x",3)))
[1] 6 15 24 33
R> dim(z)
NULL
It worked correctly in version 1.4.0 but was broken by version 1.6.1. I'm
currently using 1.7.1 under Solaris 2.8.
--please do not edit the information
2016 Sep 15
2
row names of 'rowsum()'
'rowsum()' seems to add row names to the resulting matrix, corresponding to
the respective 'group' values. This is very handy, but it is not
documented. Should the documentation mention it so it could be relied upon
as part of API?
Cheers,
Ott
--
Ott Toomet
Visiting Researcher
School of Information
Mary Gates Hall, Suite 310
University of Washington
Seattle, WA 98195
2010 Oct 20
2
rowsum
Hello,
I am trying to achieve something which I *think* is possible using rowsum,
but a little help should be useful:
Consider the following dataframe DF0:
A B C
89 1 140
89 06 20
89 29 137
89 52 13
89 57 10
89 97 23
89 1 37
89 1 12
89 1 3
52 1 11
52 1 31
52 1 16
52 1 6
52 1 10
52 1 13
52 1 10
52 1 25
52 1 2
52 59 38
52 97 75
57 1 14
57 1 13
57 1 14
57 114 12
57 1 23
57 06 26
I need create a
2007 Mar 24
1
frequency tables and sorting by rowSum
Dear list,
I have some trouble generating a frequency table over a number of vectors.
Creating these tables over simple numbers is no problem with table()
> table(c(1,1,1,3,4,5))
1 3 4 5
3 1 1 1
, but how can i for example turn:
0 1 0
0 0 1
0 1 0
1 0 0
0 1 0
1 0 0
into
0 0 1 1
1 0 0 2
0 1 0 3
My second problem is, sorting rows and columns of a matrix by the rowSums/colSums.
I did it
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
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
Assigning NULL to large variables is much faster than rm() - any reason why I should still use rm()?
2013 May 25
2
Assigning NULL to large variables is much faster than rm() - any reason why I should still use rm()?
Hi,
in my packages/functions/code I tend to remove large temporary
variables as soon as possible, e.g. large intermediate vectors used in
iterations. I sometimes also have the habit of doing this to make it
explicit in the source code when a temporary object is no longer
needed. However, I did notice that this can add a noticeable overhead
when the rest of the iteration step does not take that
2011 Mar 07
2
rowSums - am I getting something wrong?
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 I'm having.
I then want to get the sum of the rows and delete any row with a sum of greater than 1.
2006 Dec 03
1
passing an argument to a function which is also to be a dataframe column name
any suggestions on the following gratefully welcome,
I have a dataframe, which I am subsetting via labels
atpi[, creativity]
where (for example)
atpi = as.data.frame(matrix(1:50, ncol = 5, nrow = 10))
names(atpi) = c("Q1", "Q2", "Q3", "Q4", "Q5")
and
creativity = c("Q1", "Q3", "Q4")
I want to add an extra column
2003 Feb 12
2
Various Errors using Survey Package
Hi,
I have been experimenting with the new Survey package. Specifically, I was
trying to use some of the functions on the public-use survey data from NHIS
(2000 Sample Adult file).
Error 1): The first error I get is when I try to specify the complex survey
design.
nhis.design<-svydesign(ids=~psu, probs=~probs, strata=~strata, data=nhis.df,
check.strata=TRUE)
Error in svydesign(ids =
2012 Mar 23
2
R Error : DATA to MATRIX
Dear Sir/Madam,
I'm getting a problem with a R-code which converts a data frame to a matrix.
It first generate a (m^(n-m) * m) matrix A and then regenerate another
matrix B having less dimension than A which satisfy some condition. Now I
wish to assign each row of B to a vector as individual.
My problem is when I set any choice of (n,m) except m=1 it works fine but
setting m=1 I got the
2009 Sep 27
2
Count number of zeros in a collumn
I have a matrix 700x2000 which is sampled in each cycle from another matrix
788x2000 with the numbers 0,1 and 9
There is one specific collumn of this matrix, dart[,1977], that usually,
after the samplimg procedure has only 1 and 9 (because the zero frequency in
this collumn is low).
However, when this happens, I want to include an IF conditional in my code.
so basically what i wanted to do was to
2010 Nov 28
4
how to divide each column in a matrix by its colSums?
Hi,
I have a matrix, say
m=matrix(c(
983,679,134,
383,416,84,
2892,2625,570
),nrow=3
)
i can find its row/col sum by
rowSums(m)
colSums(m)
How do I divide each row/column by its rowSum/colSums and still return in
the matrix form?
(i.e. the new rowSums/colSums =1)
Thanks.
Casper
--
View this message in context:
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
>
>
2002 Sep 18
2
No subject
--============_-1179735293==_ma============
Content-Type: text/plain; charset="us-ascii" ; format="flowed"
To: r-help-request@lists.R-project.org
From: "Dr. Chris Wills" <cwills@ucsd.edu>
Subject: Questions about sorting and functions
Cc:
Bcc:
X-Attachments:
Dear R-Gang -
Two questions for you:
1) I cannot figure out how to sort one column in an array,
and
2006 Nov 14
3
Creating a table
Dear R List,
I am a new to R, so my question may be easy to answer for you:
I have a dataframe, for example:
df<-data.frame(loc=c("A","B","A","A","A"),
year=as.numeric(c("1970","1970","1970","1976","1980")))
and I want to create the following table without using loops:
1970-74 ;