Displaying 20 results from an estimated 27 matches for "dim2".
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 should form...
2011 Aug 17
1
multinomRob - error message
...218897 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.24636903
D5 0.28...
2007 Jan 26
1
Inferring dimensions on bitmap device from par()
Hi,
I am trying to infer the dimension of an opened bitmap (png, jpeg,
bitmap device...) from par() parmeters. From the help on par(), I
found that:
> dim <- c(400, 200)
> png("foo.png", width=dim[1], height=dim[2])
> dim2 <- par("din") * par("cra") / par("cin")
> dev.off()
> dim2
[1] 399.9999 199.9999
I've tried the above on Rv2.4.1 on WinXP and Linux with png() and
jpeg() and the precision is good enough. However, when I turn to the
bitmap() device, I found the following...
2010 Feb 10
2
system.time provides inaccurate sys.child (PR#14210)
...nclude <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 (sizeof(TYPEO...
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
matrixes I have...
2010 Nov 08
1
unknown dimensions for loglm
...lt;- 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:
X^2...
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 created...
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,
2006 Dec 17
2
question
...'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=maGeneTable(normdata),
sort.by=&quo...
2011 May 10
3
metaMDS and envfit: Help reading output
...0)
>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 0.2085 0.01098...
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
2009 Jun 23
1
ask for help xyplot
I want to make such plot using the following data set
plot Mean with Sd(+/-) by Dim group by Lac
here is data
Does anyone know how to plot using xyploy
Thanks,
Aimin
Mean Sd Var Min Max Dim Lac
704 44.00000 NA NA 44.0 44.0 -30 3
703 45.92000 9.5484030 91.1720000 60.0 34.4 -30 4
702 57.40000 NA NA 57.4 57.4 -30
2011 Feb 05
1
different results in MASS's mca and SAS's corresp
...57782553
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]]
2014 Nov 24
0
Error "promise already under evaluation ..."
...385 771 1089.243 771 1156 20019 1000 a
> dim_illegal(x) 0 1 161.480 1 386 2311 1000 a
> sum(x) 10395 15784 16459.454 15785 16169 114333 1000 c
>
> So, my best shot on the original problem would now be to either use:
>
> dim2 <- function(x) dim(x)
> foo <- function(x, dim=dim2(x)) { dim }
>
> or simply avoid the name clash via:
>
> foo <- function(x, dimx=dim(x)) { dimx }
I think you'll find that baseenv()$dim(x) and .BaseNamespaceEnv$dim(x)
are about 25 times faster than base::dim(x). T...
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
...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 <- create.ncdf("rn_weekly.nc",varz)
put.var.ncdf(nc.rn,varz,RN01)
close....
2012 Apr 05
0
Multi part problem...array manipulation and sampling
...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), dim2=162, dim3=56)
Not sure how clear I've explained this, but any suggestions would be really
helpful.
Most appreciatively:
Brian Campbell
--
View...
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