search for: dim1

Displaying 20 results from an estimated 25 matches for "dim1".

Did you mean: dim
2012 Dec 10
3
equivalent of group command of the egen function in Stata
Dear R listers, I am trying to create a new variable that uniquely identifies groups of observations in a dataset. So far I couldn't figure out how to do this in R. In Stata I would simply type: egen newvar = group(dim1, dim2, dim3) Please, find below a quick example to show what I am dealing with: I have a dataset with 4 variables: var <- runif(50) ## a variable that I want to group dim1 <- factor(rep(1:3, length.out= 50), labels = c("x","y","z") ) ## 3 variables that shoul...
2010 Feb 10
2
system.time provides inaccurate sys.child (PR#14210)
...-lm */ #include <stdio.h> #include <stdlib.h> #include <math.h> double alpha, beta; int size = 1000; #define WORK_create_matrix(TYPEOFMATRIX) \ \ TYPEOFMATRIX ** m_create_##TYPEOFMATRIX##_matrix ( \ int dim1, int dim2, int line, const char*file) \ { \ TYPEOFMATRIX **p; \ int i; \ \ p = malloc (si...
2011 Aug 17
1
multinomRob - error message
...18580836 0.3218897 0.05659316 D4 2182 9208 7288 10654 2951 5205 0.08227831 0.2591124 0.19605699 D5 6129 13909 12691 15560 3129 12551 0.10438878 0.2362780 0.23772964 D6 3027 13517 4702 17899 5299 5758 0.10507522 0.2034102 0.07564233 PLR05 UDC05 MCG05 dim1 dim2 dim3 D1 0.3006495 0.08555836 0.12254194 0.4327918 -0.37563170 0.23139759 D2 0.4879385 0.09903729 0.05058832 1.2723817 0.03128996 -0.10629471 D3 0.2296300 0.07822276 0.12785602 -0.8002237 -0.12194377 0.18147181 D4 0.3051325 0.06789533 0.08952449 0.4321835 0.11445829 0.2463...
2010 Jan 20
1
Change an array into a dataset of four variables, dim1, dim2, dim3 and its elements
Hi, See my example below. a<-array(1:12,c(2,3,2)) > a , , 1 [,1] [,2] [,3] [1,] 1 3 5 [2,] 2 4 6 , , 2 [,1] [,2] [,3] [1,] 7 9 11 [2,] 8 10 12 I want to get a result something like dim1 dim2 dim3 elements 1 1 1 1 2 1 1 3 2 2 1 2 I tried the data.frame and expand.grid functions, but the results are not what i want. I think there must be an easy method to do it. Anybody can tell me that function or method? Thanks. .....
2001 Dec 31
2
Extracting/setting elements from/in a matrix/array
Dear all, I had to extracts/set elements from/in a matrix. Let say I have two vectors dim1 and dim2 of indices in the respective two dimensions of a matrix: I want to extract all the corresponding elements. I the case of a nxn matrix, dim1 <- 1:n and dim2 <- 1:n would extract the diagonal. I know one way would be to use the functions 'row' and 'col', but the matrix...
2010 Nov 08
1
unknown dimensions for loglm
....10, .02) d2.c1 <- rnorm(20, .09, .02) d2.c2 <- rnorm(20, .09, .02) d3.c1 <- rnorm(20, .11, .02) d3.c2 <- rnorm(20, .11, .02) group1 <- cbind(1, d1.c1, d2.c1, d3.c1) group2 <- cbind(2, d1.c2, d2.c2, d3.c2) colnames(group1) <- colnames(group2) <- c("group", "dim1", "dim2", "dim3") combined <- rbind(group1, group2) combined[,2:4] <- combined[,2:4] > .1 ctables <- xtabs(~., data = combined) loglm(~group+dim1+dim2+dim3, data=ctables) Call: loglm(formula = ~group + dim1 + dim2 + dim3, data = ctables) Statistics:...
2012 Dec 07
1
points3d and ordirgl
Hello all, I have been using the function ordirgl to plot 3D dynamic ordinations. The ordirgl function works just fine. IN fact, I was even able to write a function that allows me to identify points in the 3D plot: identify.rgl<-function(env_var,ord,dim1,dim2,dim3) { tmp<-select3d(button="left") tmp.keep<-tmp(ord[,dim1],ord[,dim2],ord[,dim3]) env_var[tmp.keep=="TRUE"] } where env_var = a variable to be identified (e.g. plot IDs as in > row.names(dataframe)) ord = ordination points or scores cre...
2012 Feb 25
5
which is the fastest way to make data.frame out of a three-dimensional array?
foo <- rnorm(30*34*12) dim(foo) <- c(30, 34, 12) I want to make a data.frame out of this three-dimensional array. Each dimension will be a variabel (column) in the data.frame. I know how this can be done in a very slow way using for loops, like this: x <- rep(seq(from = 1, to = 30), 34) y <- as.vector(sapply(1:34, function(x) {rep(x, 30)})) month <- as.vector(sapply(1:12,
2011 Aug 17
4
How to use PC1 of PCA and dim1 of MCA as a predictor in logistic regression model for data reduction
Hi all, I'm trying to do model reduction for logistic regression. I have 13 predictor (4 continuous variables and 9 binary variables). Using subject matter knowledge, I selected 4 important variables. Regarding the rest 9 variables, I tried to perform data reduction by principal component analysis (PCA). However, 8 of 9 variables were binary and only one continuous. I transformed the data by
2007 Dec 09
1
List comprehensions for R
...aracter(lapply(gens, function(g) g[[2]])) seqs <- lapply(gens, function(g) g[[3]]) .LC <- comprehend(expr, vars, seqs) ## Provided the result is rectangular, convert it to a vector or array ## TODO: Extend to handle .LC structures more than 2-deep. if(!length(.LC)) return(.LC) dim1 <- dim(.LC[[1]]) if(is.null(dim1)){ lengths <- sapply(.LC, length) if(all(lengths == lengths[1])){ # rectangular .LC <- unlist(.LC) if(lengths[1] > 1) # matrix dim(.LC) <- c(lengths[1], length(lengths)) } else { # ragged # leave .LC as a list...
2006 Dec 17
2
question
...from my data ? I'm sorry, i'm new with R and I can't find answer in packages doc. best regards, Claire Pujoll Paris, France library(marray) library(limma) ....... Rawdata <- read.GenePix(targets=Macro_Mono_targets,skip=107) design<- cbind(individual=c(0,0,1,1,2,2,3,3,4,4,5,5), dim1=c(1,0,1,0,1,0,1,0,1,0,1,0),dim2=c(0,1,0,1,0,1,0,1,0,1,0,1)) fit <- lmFit(normdata@maM, design) contrast.matrix<-makeContrasts(dim1vsdim2=dim2-dim1, levels=design) fit2 <- contrasts.fit(fit,contrast.matrix) fiteb <- eBayes(fit2) Toptable <- topTable(fiteb,number = 10600,genelist=maG...
2011 May 10
3
metaMDS and envfit: Help reading output
...ot;,k=3,trymax=20) >Predictors<-as.data.frame(read.csv("Predictors.csv",header=TRUE, sep = ",")) >Fish.fit <- envfit(Fish.mds$points, Predictors, k=3, 1000, na.rm = TRUE) >Fish.fit The output of Fish.fit was as follows (table truncated): Dim1 Dim2 r2 Pr(>r) DrainArea -0.5923233 -0.8057004 0.7674 0.000999 *** Flow -0.5283236 -0.8490431 0.7847 0.000999 *** StrmWidth -0.6993457 -0.7147836 0.6759 0.000999 *** Gradient 0.4541225 0.8909392...
2007 Dec 19
3
array addition
Hi suppose I have two arrays x1,x2 of dimensions a1,b1,c1 and a2,b2,c2 respectively. I want x = x1 "+" x2 with dimensions c(max(a1,a2), max(b1,b2),max (c1,c2)) with x[a,b,c] = x1[a1,b1,c1] + x2[a2,b2,c2] if a <=min(a1,a2) , b<=min (b1,b2), c<=min(c1,c2) and the other bits either x1 or x2 or zero according to whether the coordinates are "in range" for
2012 Apr 05
0
Multi part problem...array manipulation and sampling
...,162,] is the index that represents whether a survey had been conducted or not...sitesurvey total OK, here is where I need help; Step 1) I need to extract from new.mydata1 the rows where [,162,] != NA....this will create a ragged array where the number of counts per sitesurvey varies outdata (dim1 varies from 1,22...ragged, 162,56). Step 2) from the extracted list, I would like to randomly select n rows (say for example, 3) outdata (dim1=2 or 3 counts(samples), dim2=162, dim3=56) Step 3) I need to sum the values from the columns of dimension 1 from step 2 s outdata (dim1=1 (column sums),...
2011 Feb 05
1
different results in MASS's mca and SAS's corresp
...68229 0.0357782553 16 -0.003048803 0.0128157261 17 -0.051281437 0.0278941743 18 -0.051819085 0.0004327598 19 -0.072814626 0.0195622280 20 -0.072814626 0.0195622280 And in SAS's corresp output: Row Coordinates Dim1 Dim2 1 1.0607 -0.8155 2 0.7706 0.6346 3 1.0703 -1.3067 4 1.0703 -1.3067 5 0.2308 0.9000...
2019 May 14
3
Unir coordenas en un plano mediante linea
Buenos días -- Francisco Maturana Miranda Dr. Planificación territorial, urbanismo y dinámicas del espacio Profesor Asociado, Departamento de Geografía Universidad Alberto Hurtado www.fmaturana.cl [[alternative HTML version deleted]]
2004 Jul 16
1
labels for 3d Plots
High! How can I add variable labels (rownames for instance) to a plot created with ‚clouds’ ( clouds(dim3~dim1*dim2)) – package lattice? Thanks in advance! Martina Renninger [[alternative HTML version deleted]]
2007 Aug 08
0
Creating netcdf from table
...coordinates but other values, i.e. time series. Now I want to create a NetCDF file for, which is much easier to handle than 52 tables. I tried the following for the first dataset (i.e first week): W01<-read.table("RN_weekly/KW01_RN.dat") long<-W01$V1 lat<-W01$V2 RN01<-W01$V3 dim1 <- dim.def.ncdf( "EW","degrees", as.double(long)) dim2 <- dim.def.ncdf( "SN","degrees", as.double(lat)) varz <- var.def.ncdf("Radon","Bq/m2/h1", list(dim1,dim2), -1, longname="Radon flux rate") nc.rn <- c...
2010 Dec 27
2
Finding indexes of minum and maximum elements of an array
Hello there I wish to get the "coordinates" of the minimum element of an array. For example, if the array were > H = array(c(8:5,1:4),dim=c(2,2,2)) > H , , 1 [,1] [,2] [1,] 8 6 [2,] 7 5 , , 2 [,1] [,2] [1,] 1 3 [2,] 2 4 then > min(H) [1] 1 and > max(H) [1] 8 Say "idx" were the function I'm looking for. Then, what
2003 Sep 25
1
apply on a 4D array
...850 0.7172834 h3 0.8941212 0.7257939 0.5631331 0.5815922 h4 0.8487089 0.6284291 0.4226977 0.4107244 , , a1, w2................................ I thought it would be something along the lines of apply(4Darray, c(1,2,3), function(x) x*3Darray). But this returns the results in the form of 64rows by dim1 by dim2 by dim3. , , i4, a4 h1 h2 h3 h4 [1,] 8.05058486 6.881337e+00 5.579569e+00 3.940329195 [2,] 0.19306289 2.185652e-01 2.347175e-01 0.219540239 . . . [63,] 0.00000000 1.300468e-01 2.430320e-01 0.395577205 [64,] 0.00000000 0.000000e+...