similar to: reorder a matrix

Displaying 20 results from an estimated 3000 matches similar to: "reorder a matrix"

2005 May 10
4
summary statistics for lists of matrices or dataframes
Is there a simple way to calculate summary statistics for all the matrices or dataframes in a list? For example: > z <- list(matrix(c(2,2,2,2), ncol = 2), matrix(c(4,4,4,4), ncol = 2)) > z [[1]] [,1] [,2] [1,] 2 2 [2,] 2 2 [[2]] [,1] [,2] [1,] 4 4 [2,] 4 4 > I would like to calculate, for example, the mean value for each cell. I can do that the hard
2009 Sep 23
2
Stretch the x-axis for better alignment comparison
I have the following code that aligns the two graphs. Problem is that in .pdf it gives me it x-axis (0-100) is broken down into 0-20, 20-40..and so on. I wonder if there is for it to display the x-axis (and y-axis) in more detail than that. I'd appreciate your input -- pdf(file="VECTOR & ICA ALIGNMENT.pdf", height=5, width=5)
2005 Aug 31
0
Imputation using Pan in R
Hi, I've tried to run the multiple imputation for longitudinal data using Pan in R. The trimmed data consist 10 individuals across 4 time points. Following the example in panex.R, I imputated the model with one y variable and only random intercept. It worked well. The next step for me is to imputate a model with one y variable and both random intercept and slope. The program ran well, but
2010 Feb 15
1
Adjusted means and generalized chain block designs
Dear Colleagues, John Mandel ( Chain block designs with two-way elimination of heterogeneity. Biometrics 10, 251-272 ,1954). extended the class of chain block designs (Youden & Conner (1953) to elimination of both row and column (blocks) effects. These experimental designs can be useful in engineering and other fields. I am having difficulty obtaining his adjusted treatment means in his
2011 Mar 15
3
how to reshape the data.frame from long to wide in a specific order
Hi, For example, the data.frame like: origdata.long <- read.table(header=T, con <- textConnection(' subject sex condition measurement 1 M control 7.9 1 M first 12.3 1 M second 10.7 2 F control 6.3 2 F first 10.6 2 F second 11.1 3 F control 9.5 3
2003 Mar 04
3
question on latticeParseFormula (PR#2602)
This feels like inconsistent behavior. latticeParseFormula works the way I anticipated for factor, but not for ordered. I want the behavior I see with tmp2, but not with tmp. My next step is to use the right.name to isolate the tmp2[,c("a","b")] columns. tmp <- data.frame(y=(1:12)+.1, a=factor(rep(1:3,4)), b=ordered(rep(1:4,
2012 Sep 20
3
lattice dotplot reorder contiguous levels
my reproducible example test<-structure(list(site = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 3L, 3L, 3L, 3L, 3L, 3L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 4L, 5L), .Label = c("A", "B", "C", "D", "E"), class = "factor"),
2011 Mar 22
1
how to convert a data.frame to a list of dist objects for individual differences MDS?
I have a 45 x 16 data frame consisting of dissimilarities among 10 colors, giving in each column the 45 = 10*9/2 pairwise judgments for one of 16 subjects. The rownames identify each pair of colors, e.g, "AC" = ("A","C"), and the pairs are ordered by columns in the lower triangle of each distance matrix. > helm.raw <-
2011 Mar 22
1
help need on working in subset within a dataframe
Dear R-experts Execuse me for an easy question, but I need help, sorry for that. >From days I have been working with a large dataset, where operations are needed within a component of dataset. Here is my question: I have big dataset where x1:.....x1000 or so. What I need to do is to work on 4 consequite variables to calculate a statistics and output. So far so good. There are more vector
2010 Jul 13
2
Checking for duplicate rows in data frame efficiently
I wrote something to check for duplicate rows in a data frame, but it is too inefficient. Is there a way to do this without the nested loops? This code correctly indicates rows 1-7, 1-8, 2-9 and 7-8 are duplicates. > m <- matrix(c(1,1,1,1,1, 2,2,2,2,2, 6,6,6,6,6, 3,3,3,3,3, 4,4,4,4,4, 5,5,5,5,5, 1,1,1,1,1, 1,1,1,1,1, 2,2,2,2,2, 7,7,7,7,7), ncol=5, byrow=TRUE) > df <- data.frame(m)
2013 Sep 05
2
Pronósticos con modelos robusto de series de tiempo
Alguien me podría sugerir un paquete en R para generar pronóticos con modelos robusto de series de tiempo.   Saludos Enrique RAMOS [[alternative HTML version deleted]]
2007 Aug 09
2
Systematically biased count data regression model
Dear all, I am attempting to explain patterns of arthropod family richness (count data) using a regression model. It seems to be able to do a pretty good job as an explanatory model (i.e. demonstrating relationships between dependent and independent variables), but it has systematic problems as a predictive model: It is biased high at low observed values of family richness and biased low at
2001 Oct 26
1
Bug or new concept in formatC?
As a sequel to my previous mail on cut, formatC does not produce what I have been taught is significant digits: > x <- c(1.0793,1.0796, 11.0954, 11.0736 ) > formatC(x,digits=3,format="g") [1] "1.08" "1.08" "11.1" "11.1" (3,3,3,3) significant digits OK > formatC(x,digits=3,format="f") [1] "1.079"
2008 Jun 21
2
Generating groupings of ordered observations
Dear List, I have a problem I'm finding it difficult to make headway with. Say I have 6 ordered observations, and I want to find all combinations of splitting these 6 ordered observations in g groups, where g = 1, ..., 6. Groups can only be formed by adjacent observations, so observations 1 and 4 can't be in a group on their own, only if 1,2,3&4 are all in the group. For example,
2001 Nov 21
1
Slow printing in batch?
For doumentation purposes I run a batch R program that does reshaping etc. of data and finally prints things. When I paste the code into an R-window everything runs in a few seconds, but in Batch mode i get in the output file the result below. Any clues why R uses 4 min to print a 1129\times 6 dataframe in batch mode? The scrit I use to run R is: c:\stat\r\%R_VERS%\bin\Rterm --no-restore
2010 Mar 17
1
constrOptim - error: initial value not feasible
Hello at all, working with a dataset I try to optimize a non-linear function with constraint. test<-read.csv2("C:/Users/Herb/Desktop/Opti/NORM.csv") fkt<- function(x){ a<-c(0) s<-c(0) #Minimizing square error for(j in 1:107){ s<-(test[j,2] - (x[1] * test[j,3]) - (x[2] * test[j,4]) - (x[3]*test[j,5]) - (x[4]*test[j,6]) - (x[5]*test[j,7]))^2 a<- a+s} a<-as.double(a)
2005 Apr 01
1
plotCI error when trying to omit upper or lower bars (PR#7764)
Full_Name: Volker Franz Version: 2.0.1 (2004-11-15) OS: Mac OSX / Debian Submission from: (NULL) (84.58.8.232) Hi there, the new version of plotCI (Version: 2.0.3 of gplots) produces errors if the upper or lower error bars should be omitted by passing NULL as an argument. Older versions of plotCI had no problem with this. Here is an example: library(gplots) means <- c(1,2,3,4,5) upperw
2013 Sep 05
0
Pronósticos con modelos robusto de series de tiempo
este ha sido bastante bueno f52<-scan("f52.txt") sb<-f52[1:200]; sp<-f52[201:245]; sb.ts <- ts(sb, start=c(2008, 1), frequency=52) sb.ts # is important to see the end of this time series. sp.ts<- ts(sp, start=c(2011, 45), frequency=52) plot(sb.ts,ylab="No. focos") # Main function predAll<-function(x,h,tsname){ # INPUTS: # x: time serie # h:
2011 May 26
1
Plotting device does not show all graphs
Dear All, I am creating 4 plots (files) but I could see only 3. Here is a simple code d=data.frame(age=rnorm(100,40,8),ht=rnorm(100,170,15)) tiff(file=paste("test","%03d",".tif",sep="")) hist.data.frame(d) datadensity(d) par(mfrow=c(1,2),mar=c(3,3,3,3)) boxplot(d$age) hist(age) dev.off() PDF works fine but png and tiff seems to miss the second
2016 Feb 29
4
Juntar dos data.frames eliminando celdas con NA
Hola a todos, Quisiera juntar las informacion de dos data.frames con una union de columnas un tanto especial. La informacion que tengo son datos de captura-recaptura de diferentes individuos, por ejemplo en una base de datos tengo:ID <- c(1,2,3,4)Fate_1 <- c(2,2,2,2)Fate_2 <- c(0,0,0,NA)Fate_3 <- c(0, NA, NA, NA) y en otra base de datos tengo:ID <- c(1,2,3)Fate_1 <- c(0, 0, 0,