Displaying 20 results from an estimated 26 matches for "dimx".
Did you mean:
dim
2011 Mar 30
4
a for loop to lapply
Dear all,
I am trying to learn lapply.
I would like, as a test case, to try the lapply alternative for the
Shadowlist<-array(data=NA,dim=c(dimx,dimy,dimmaps))
for (i in c(1:dimx)){
Shadowlist[,,i]<-i
}
---so I wrote the following---
returni <-function(i,ShadowMatrix) {ShadowMatrix<-i}
lapply(seq(1:dimx),Shadowlist[,,seq(1:dimx)],returni)
So far I do not get same results with both ways.
Could you please help me understand...
2012 Feb 02
1
"shifted" bar chart / battleship curve
What I want to do is create a horizontal bar chart matrix for a set of data that have a common set of variables (e.g., % of As, % of Bs, etc.) listed on the Y-axis and groups (e.g., Classes) on the X-axis. The key here is that the bars for each individual class plot are "centered" rather than left or right-justified. In archaeology plots similar to this are called battleship curves or
2012 Jun 19
1
R and C pointers
...rices at C-level...
except for, what probably is the answer, that matrices are in fact
vectors with dimensions.
This is a sample code I am using at C level:
????????????????????????
# include <R.h>
# include <Rinternals.h>
# include <R_ext/Rdynload.h>
SEXP foo(SEXP x) {
SEXP dimx;
double *px, *pdimx;
PROTECT(dimx = getAttrib(x, R_DimSymbol));
px = REAL(x);
UNPROTECT(1);
return(dimx);
}
????????????????????????
The question is: how to create pointers to dimx (in order to extract
individual values)?
I tried:
pdimx = REAL(dimx);
This is where R complain...
2011 Apr 27
6
Assignments inside lapply
Dear all I would like to ask you if an assignment can be done inside a lapply statement.
For example
I would like to covert a double nested for loop
for (i in c(1:dimx)){
for (j in c(1:dimy)){
Powermap[i,j] <- Pr(c(i,j),c(PRX,PRY),f)
}
}
to something like that:
ij<-expand.grid(i=seq(1:dimx),j=(1:dimy))
unlist(lapply(1:nrow(ij),function(rowId) { return (Powermap[i,j]<-Pr(c(ij$i[rowId],ij$j[rowId]),c(PRX,PRY),f)) }))
as you can see lapp...
2012 Apr 27
3
kiteChart to show real values with scalebar
Dear R-users
I hope someone could help me on this problem.
I want to create a multiple kiteChart showing the real values with a
scalebar on each indicating the scale .
Here are some sample data to show what I want to achieve.
Y <- read.table(textConnection("Sample1 Sample2
60 20
150 50
300
2011 Apr 14
4
Categorical bubble plot
Hi,
I do not have much R experience just the basics, so please excuse
any obvious questions.
I would like to create bubble plot that have Categorical data on the x and y
axis and then the diameter if the bubble the value related to x and y.
Attached to the email is a pic of what I would like to do.
I do hope someone can help me.
--
Regards/Groete/Mit freundlichen Gr??en/recuerdos/meilleures
2010 May 28
4
Matrix interesting question!
hi,
I have been trying to do this in R (have implemented it in Excel) but I have
been using a very inefficent way (loops etc.). I have matrix A (columns are
years and ages are rows) and matrix B (columns are birth yrs and rows are
ages)
I would like to first turn matrix A into matrix B
And then I would like to convert matrix B back again to the original matrix
A. (I have left out details of
2011 Apr 22
1
ggplot
Hello everyone,
I am using ggplot
to plot but I am getting the following error which I do not understand
Error: geom_text requires the following missing aesthetics: label
My code is
dimx<-256
library(ggplot2)
dev.new()
xandy<-expand.grid(seq(1:dimx),seq(1:dimy))
xx<-data.frame(xandy[[1]],xandy[[2]],Powermap=Powermap)
subsetxx<-subset(xx, xx$Powermap>threshold)
ggplot( (subsetxx ) )+
geom_point(aes(x,y,colour=cut(Powermap,c(0,-1,-10,-20,-30,-40,-50,-...
2011 May 30
0
2D random walk with traps convert C++ code to R code
...e <time.h>
#define IA 16807#define IM 2147483647#define AM (1.0/IM)#define IQ 127773
#define IR 2836#define NTAB 32#define NDIV (1+(IM-1)/NTAB)#define EPS 1.2*pow(10,-7)#define RNMX (1.0-EPS)
using namespace std;float rand1(long *idum);
int main(){ long run=10000,adr=-run,x,y,hapa=0,i=0; int dimx=700,dimy=700,nrg=50, M[dimx][dimy]; double rnd,sum=0; long k[run+1],frekuenca;
bool njehsuar[run+1], next; ofstream Txt("EndjeMePengesa2D.txt"); printf("\nProgrami ekzekutohet:\ni=1 ne %d",run); for (i=1;i<=run;i++){
njehsuar[i]=true; k[i]=0; } while (i<nrg){ x=dimx*rand...
2009 Apr 28
1
latticeExtra: useOuterStrips and axis.line$lwd
Hi,
I'm working on some lattice wireframe figures that have two conditioning
factors, and I want the strips labelled on the top and left of the
entire plot, rather than above each individual panel. useOuterStrips()
does this, but it draws internal axis lines, even after I explicitly set
axis.line to 0. Is there a way to use useOuterStrips but without axis
boxes?
I've included a short
2007 Jun 19
3
Controlling text and strip arrangement in xyplot
I've searched the archives and read the xyplot help but can't figure
out the 2 lattice questions below?
Consider:
library(lattice)
DF <- data.frame(x=rnorm(20), y=rnorm(20), g1=rep(letters[1:2], 10),
g2=rep(LETTERS[1:2], each=10),
g3=rep(rep(letters[3:4],each=5),2))
xyplot(y ~ x | g1 + g2, groups=g3, data=DF)
1) Is there a way to get one strip per row and column
2012 Mar 12
1
2 images on one plot
Dear all
with image I can plot only one set of values in one plot.
Do somebody have any insight how to put those 2 matrices into one picture
so that in one cell in image picture are both values from mat[1,1] and
mat2[1,1].
mat<-matrix(1:4, 2,2)
mat2<-matrix(4:1,2,2)
x <-1:2
y <-1:2
image(x, y, mat)
image(x, y, mat2)
The only way I found is to mix x or y for both matrices let
2009 Aug 04
0
Writing a NetCDF file in R
...;- get.var.ncdf(netcdf_1992_temp, "mrunoff")
mrunoff_1993 <- get.var.ncdf(netcdf_1993_temp, "mrunoff")
mrunoff_1994 <- get.var.ncdf(netcdf_1994_temp, "mrunoff")
mrunoff_1995 <- get.var.ncdf(netcdf_1995_temp, "mrunoff")
# Define variable dimensions
dimx <- dim.def.ncdf("Lon", "deg E", as.double(longitude))
dimy <- dim.def.ncdf("Lat", "deg N", as.double(latitude))
month <- dim.def.ncdf("Mon", "Months: Jan 86=1, Dec 95=120)", 1:120)
year <- dim.def.ncdf("Year", "y...
2009 Aug 05
0
ncdf package problem - put.var.ncdf
...get.var.ncdf(netcdf_1992_temp, "mrunoff")
mrunoff_1993 <- get.var.ncdf(netcdf_1993_temp, "mrunoff")
mrunoff_1994 <- get.var.ncdf(netcdf_1994_temp, "mrunoff")
mrunoff_1995 <- get.var.ncdf(netcdf_1995_temp, "mrunoff")
# Define variable dimensions
dimx <- dim.def.ncdf("Lon", "deg E", as.double(longitude))
dimy <- dim.def.ncdf("Lat", "deg N", as.double(latitude))
month <- dim.def.ncdf("Mon", "Months: Jan 86=1, Dec 95=120)", 1:120)
year <- dim.def.ncdf("Year", "y...
2005 Sep 28
7
Plot Data Points in boxplots
Hello,
I would like to plot my data in a fashion similar to a boxplot, but
plot the true data points without a box, just overlay lines of the
summary generated by the boxplot. I have less than 10 observations
within each group, so I think showing the actual data would be more
effective than the box of the boxplot. I have been unable to find a way
to do this.
Here is example data:
>
2011 Oct 15
2
function for handling time
Dear all
I have the following time stamps (in the following format)
MeasurementSet$TimeStamps
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 2011 7 2 13 43 48.718
[2,] 2011 7 2 13 43 54.281
[3,] 2011 7 2 13 43 59.843
[4,] 2011 7 2 13 44 5.390
[5,] 2011 7 2 13 44 10.859
[6,] 2011 7 2 13 44 16.375
[7,] 2011 7 2 13 44
1998 May 29
0
aov design questions
...ass(z) <- c(if (is.matrix(y)) c("maov","mlm"), c("aov","lm"))
}
z$call <- match.call()
z$terms <- mt
if (model)
z$model <- mf
z
}
aov.balanced.fit <- function(x,y,mod.terms,wt=NULL){
x <- as.matrix(x); dimx <- dim(x)
xnames <- dimnames(x)[[2]]
y <- as.matrix(y); dimy <- dim(y)
assn <- attr(x,"assign")
df <- c(table(assn), dimy[1]- dimx[2])
D <- diag(1/diag(t(x) %*% x))
dimnames(D) <- list(xnames,xnames)
coef <- as.numeric(D %*% t(x) %...
2014 Nov 24
0
Error "promise already under evaluation ..."
...395 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). This doesn't seem like
it should be necessary...
Radford
1999 Oct 18
0
Date/time of formation of objects
...John
lls<-function (pat = "")
{
lll <- ls(1, pat = pat)
for (i in 1:length(lll)) {
cat(formatC(eval(parse(t = paste("mode(", lll[i], ")"))),
1, 12), formatC(lll[i], 1, max(nchar(lll)) + 1),
eval(parse(t = paste("dimx(", lll[i], ")"))), "\n")
}
}
where
dimx<-function (dd)
{
if (is.null(dim(dd))) {
length(dd)
}
else {
dim(dd)
}
}
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://ww...
2010 Sep 06
0
How R converts data between objects
...) to force as.matrix to return
the appropriate matrix but this also failed and I only got back a vector again
Could you please let me understand why this might happening?
Best Regards
Alex
P.S Below you will find part of my code.
...................(lines omitted, declarations)
x <- seq(1, dimx, step)
y <- seq(1, dimy, step)
f <- GaussRF(x=x, y=y, model=model, grid=TRUE,param=c(mean, variance, nugget,
scale, alpha))
# image(x, y, f) Displays the matrix
# f is a 2x2 matrix of dimension (x,y)
r <- raster(nrow=dimx, ncol=dimy)
r <- setValues(r,as.matrix(f))
# getValues(r)...