Displaying 20 results from an estimated 10000 matches similar to: "slow access to matrix dimnames"
2009 Apr 13
3
tapply output as a dataframe
i use tapply and by often, but i always end up banging my head against
the wall with the output.
is there a simpler way to convert the output of the following tapply to
a dataframe or matrix than what i have here:
# setup data for tapply
dt = data.frame(bucket=rep(1:4,25),val=rnorm(100))
fn = function(x) {
ret =
c(unname(quantile(x,probs=seq(.25,.75,.25),na.rm=T)),mean(x,na.rm=T))
}
a =
2011 Feb 03
2
tapply output as a dataframe
On Mon, Apr 13, 2009 at 12:41 PM, Dan Dube <ddube-at-advisen.com> wrote:
> i use tapply and by often, but i always end up banging my head against
> the wall with the output.
The proposed solution of Dan's problem posted on R-help was:
> do.call(rbind,a)
When I use this 'solution' I get 'ERROR: second argument must be a list'. So head on wall continues.
My
2009 May 17
1
[wishlist, patch] make row() and col() preserve dimnames (PR#13705)
Full_Name: Ben Goodrich
Version: 2.9.0
OS: Linux (Debian unstable)
Submission from: (NULL) (128.103.220.16)
row(x), col(x), and functions that call them like lower.tri(x) and upper.tri(x)
do not retain the rownames or colnames of x in the matrix that is returned.
Example from R version 2.9.0 :
x <- matrix(1:9, nrow = 3, ncol = 3)
rownames(x) <- LETTERS[1:3]
colnames(x) <- letters[1:3]
2010 Jun 25
1
dimnames(x) <- dn error
Hi ,
I want to assign names to the rows in my matrix so that when I use the
'agnes' function from R cluster package , the dendogram that is produced
represents the rows of the matrix. This way I would know what elements in
the matrix are clustered together. But when I do the following,
rownames(distF) <- paste("A",dim(distF)[1])
it gives the following error;
Error in
2012 May 22
1
Naming dimnames in an array using the results of an expression
dear all
i'm struggling with naming in an array
diag.data is one of a series of 2x2 diagnostic testing arrays, with
'Outcome' columns (true/false) and 'Test' rows (High-risk, Low-risk),
drawn from a larger list object of 'results'
i can hard-code the names of the array using dimnames;
diag.data<-array(c(19,2,125,50),c(2,2)) #example to run - actually comes
out
2012 Aug 13
4
dimnames in an array(I'll be grateful if this message will be passed to all list users)
Hello,
I'm hoping someone with a wide experience with R may be able to see
what the program is trying to tell me.
I've got an array:
y1=rnorm(41,0.2)
y2=rnorm(41,0.2)
y3=rbind(y1,y2)
data11<-array(0,c(41,2,2))
data11[,1,]=y3
data11[,2,]=y3
rownames(data11)<-rownames(data11, do.NULL = FALSE, prefix = "Obs.")
colnames=c("V","R")
2012 Aug 08
1
dimnames in array
Hello,
I'm working with an array; I'm trying to make it so that an array of
dim(42,2,2) has names whose length corresponds to that of the array,
and am hoping someone with experience with this can see what I'm not
doing correctly:
data11 = array(0,c(41,2,2))
y = lsoda(x0,times,fhn$fn.ode,pars)#This is make.fhn() from colloc
infer package#
y = y[,2:3]
2004 Sep 27
8
cannot assign dimnames
Dear list,
If anyone knows how to assign dimnames to matrices or arrays I would be most
grateful for help. I've tried various permutations of likely-looking code
but get error messages every time. I could find no example in the
documentation.
Many thanks,
Dan Bebber
Department of Plant Sciences
University of Oxford
South Parks Road
Oxford OX1 3RB
UK
Tel. 01865 275000
2010 Mar 16
2
Dimnames of array inside loop
hello R-helpers,
I have an array
acuracia <- array(NA, dim = c(1, 1, A, B, C))
which is first defined and in the example above with dimensions 1x1xAxBxC.
My array is then filled using 3 loops (I am not well familiar yet with
lapply or sapply functions so I am still a loop-user):
for (i in 1:A){
for (j in 1:B){
for (k in 1:C){
acuracia[,,i,j,k] <- correlacao / (sqrt(ac))
}
}
}
then I
2001 Aug 07
1
cannot assign to NULL dimnames (PR#1042)
Full_Name: Hsiu-Khuern Tang
Version: 1.3.0
OS: GNU/Linux (Debian unstable)
Submission from: (NULL) (192.6.19.124)
Hi all,
I am not sure this is a bug rather than an intentional design, but here
goes:
If I do
> a <- matrix(1:4, nrow=2)
> dimnames(a)[[1]] <- c("a", "b")
I get the following error message because dimnames(a) is NULL:
Error: more elements
2005 Dec 08
1
kronecker(... , make.dimnames=TRUE)
Hi
I'm using kronecker() with a matrix and a vector. I'm interested in
the column names that kronecker() returns:
> a <- matrix(1:9,3,3)
> rownames(a) <- letters[1:3]
> colnames(a) <- LETTERS[1:3]
> b <- c(x=1,y=2)
> kronecker(a,b,make.dimnames=TRUE)
A: B: C:
a:x 1 4 7
a:y 2 8 14
b:x 2 5 8
b:y 4 10 16
c:x 3 6 9
c:y 6 12 18
>
The
2006 May 12
1
Dropping dimnames doesn't matter (anymore)?
In the "old days", one way of speeding up matrix calculations was to
drop the dimnames of the matrices prior to the calculations, i.e.,
dimnames(X) <- NULL. I distinctly remember that this could have a
great impact at least in Splus 3.x (under UNIX/Linux).
I just did a small, informal test of this with a couple of functions I
use to fit plsr models, in R 2.3.0 (Linux). It
2004 May 10
3
sqlSave with underscores in table fieldname
Hi group,
I try to write a frame to a table (RODBC). I use
colnames(temp6) <- c("ind_id","ser_id","period_id","year","calc","mean")
sqlSave(channel, temp6, tablename = "series_indices_test",append= TRUE, rownames=FALSE, verbose = FALSE, test = FALSE, nastring = -999999, fast = FALSE)
This is giving me an error:
Error in
2002 Jan 29
3
dimnames usage in ts (PR#1288)
Full_Name: Tim Keitt
Version: 1.4
OS: Linux
Submission from: (NULL) (129.49.19.70)
I think this code in 'ts' is incorrect:
if (is.matrix(data) || is.data.frame(data)) {
nseries <- ncol(data)
ndata <- nrow(data)
dimnames(data) <- list(NULL, names)
}
since
> x <- data.frame(matrix(rnorm(100),ncol=10))
> names(x)
[1] "X1"
2007 May 01
1
(PR#9623) qr.coef: permutes dimnames; inserts NA; promises
On Thu, 19 Apr 2007, brech at delphioutpost.com wrote:
> Full_Name: Christian Brechbuehler
> Version: 2.4.1 Patched (2007-03-25 r40917)
> OS: Linux 2.6.15-27-adm64-xeon; Ubuntu 6.06.1 LTS
> Submission from: (NULL) (24.61.47.236)
>
>
> Splus and R have different ideas about what qr.coef(qr()) should return,
> which is fine... but I believe that R has a bug in that it is not
2013 Apr 09
4
Converting matrix to data frame without losing an assigned dimname
Hello All,
Would like to be able to convert a matrix to a dataframe without losing an assigned dimname.
Here is an example that should illustrate what I'm talking about.
tableData <- state.x77[c(7, 38, 20, 46), c(7, 1, 8)]
names(dimnames(tableData)) <- c("State", "")
tableData
State Frost Population Area
Connecticut 139 3100 4862
2002 Jul 11
1
How to get relevant dimnames from apply() ?
Hello,
in order to vectorize task (of plotting barplots), I use, as probably all
R-folks, function apply()
instead of for() loop.
<R>
testarr<-matrix(1:30, nrow=5)
rownames(testarr)<-letters[1:5]
colnames(testarr)<-LETTERS[1:6]
apply(testarr,1,function(x) {x11(); barplot(x)}) #the funcion used is
actually more compex, but it doesn't matter
</R>
Now, how I can propagate
2011 Mar 01
2
Entering table with multiple columns & rows
Hi,
I'm having difficulty with getting a table to show with
multiple rows and columns. Below is the commands that I've typed in and
errors that I am getting. Thank you.
Laura
Table trying to enter:
Diet: Binger-yes: Binger-No: Total:
None 24 134 158
Healthy 9 52 61
Unhealthy 23 72 95
Dangerous 12 15 27
>
2006 Mar 21
3
ROWNAMES error message
I am getting an error message, which I do not know the source to.
I have a matrix SAMPLES that has preexisting rownames that I would like to
change.
GENE_NAMES contains these rownames.
> rownames(SAMPLES) = GENE_NAMES
Error in "dimnames<-.data.frame"(`*tmp*`, value = list(list(V1 = c(3843, :
invalid 'dimnames' given for data frame
> dim(SAMPLES)
[1] 12626
2023 Oct 29
1
dim<-() changed in R-devel; no longer removing "dimnames" when doing dim(x) <- dim(x)
Hello,
the fix of PR18612 (https://bugs.r-project.org/show_bug.cgi?id=18612)
in r85380 (https://github.com/wch/r-source/commit/2653cc6203fce4c48874111c75bbccac3ac4e803)
caused a change in `dim<-()`. Specifically, in the past, any
`dim<-()` assignment would _always_ remove "dimnames" and "names"
attributes per help("dim"):
The replacement method changes