similar to: constructing nxn matrices involving calculations& conditions based on other tables

Displaying 11 results from an estimated 11 matches similar to: "constructing nxn matrices involving calculations& conditions based on other tables"

2009 Sep 19
1
Converting matrices into row vectors and saving as ASCII text
Hi I have some data with these dimensions: 5 3 100 which correspond to the x, y, and time dimensions, for a variable, p. I need the data in this format: 100 rows (1 row per time unit), and 15 values in each row. I have attempted to reshape my data >dim(data) 5 3 100 >attr(data,'dim')<-c(dim(data)[3],dim(data)[1]*dimdata[2]) So I get data with 100 rows, 15 columns. I need
2004 Jun 23
1
converting apply output
Hi - platform powerpc-apple-darwin6.8 status major 1 minor 9.0 year 2004 I am trying to deal with the output of apply(). As indicated, when each call to 'FUN' returns a vector of length 'n', then 'apply' returns an array of dimension 'c(n, dim(X)[MARGIN])'. However, I would like this to be a list in the same format as is produced when 'FUN'
2002 Jul 01
1
chi square residuals
dear list, I'm a newbie with R but it seems very interesting to me. First, to train myself and students, I'd like to use it for teaching labs next year. one of my labs deals with the barn owl predation in my region. tudents have to work on a contingency table tytogrp : station1 station2 station3 ... n1,1 n1,2 n1,3 ... n2,1 n2,2 n2,3 ...
2009 Feb 11
4
Efficent way to create an nxn upper triangular matrix of one's
The code below create an nxn upper triangular matrix of one's. I'm stuck on finding a more efficient vectorized way - Thanks. --Dale n <- 9 data <- matrix(data=NA, nrow=n, ncol=n) data for (i in 1:n) { data[,i] <- c(rep(1,i), rep(0,n-i)) } data
2002 Mar 17
5
compute variance of every column in a matrix without a loop
Is it possible to compute the variance of every column in a matrix without a loop? -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
2017 Feb 17
2
fechas
Hola a todos. El otro día, al rescatar unos datos de una estación meteorológica, me percate que la fecha de estos traía un error bien raro, la fecha correcta debía ser 27/4/2014.Sin embargo, el abrir la planilla, los valores de fechas se invirtieron a "4/27/2014" Yo necesito los valores en formato y-m-d, por ende intenté hacerlo en Excel, sin embargo me encontré con la sorpresa que esa
2008 Jun 18
1
operations on all pairs of columns from two matrices
m1 <- matrix(rnorm(40), ncol=4) m2 <- matrix(rnorm(40), ncol=4) I would like to subtract first column of m1 from all columns of m2, subtract 2nd of m1 from all columns of m2, and so on. Obviously, I am not using the appropriate function outer(m1, m1, "-"), since the first column isn't all 0s. _________________________________________________________________
2010 Apr 13
2
sensitivity analysis, input factors
Hi, I'm trying to conduct sensitivity analysis in R using the 'sensitivity' package. Although the description of functions seem straightforward, I can?t succeed. The definition of input factors can be the problem. library(sensitivity) #A simple model with 4 input factor to test the morris function: model01=function(a1,a2,a3,a4) { Z<-numeric(10) Z[1]<-runif(1)
2008 Sep 16
2
casting a character vector as an object
Greetings, I need to compare the ratios of vector sizes like this: length(object1) / length(object2) I have many vector objects to compare, so I would like to do it in a loop. I created a loop like this: mat1 <- matrix() for (i in 1:6) { for (j in 1:6) { mat1[i,j] <- length( paste("object",i,sep="")) /
2002 May 11
1
deleting invariant rows and cols in a matrix
Greetings, I couldn't find any existing function that would allow me to scan a matrix and eliminate invariant rows and columns so I have started to write a simple routine from scratch. The following code fails because the array index goes out of bounds for obvious reasons you'll see shortly. Start with some data x <- read.table("myex.dat",header=T) x v1 v2 v3 v4 v5 id 1
2012 Dec 19
2
read.csv reads more rows than indicated by wc -l
When I have a csv file that is more than 6 lines long, not including the header, and one of the fields is blank for the last few lines, and there is an extra comma on of the lines with the blank field, read.csv() makes creates an extra line. I attached an example file; I'll also paste the contents here: A,apple A,orange A,orange A,orange A,orange A,,, A,, ----- wc -l reports that this file