Displaying 7 results from an estimated 7 matches for "mygrid".
Did you mean:
mgrid
2012 Feb 02
4
The "less than" (<) operator doesnt seem to perform as expected
The example here puzzles me. It seems like the < operator doesn't work as expected.
> l <- 0.6
> u <- seq(0.4, 0.7, 0.1)
> u
[1] 0.4 0.5 0.6 0.7
> mygrid <- expand.grid("l" = l, "u" = u)
> mygrid
l u
1 0.6 0.4
2 0.6 0.5
3 0.6 0.6
4 0.6 0.7
> mygridcollapsed <- mygrid[mygrid$l < mygrid$u, ]
> mygridcollapsed
l u
3 0.6 0.6
4 0.6 0.7
In this little example I expect 'mygridcollapsed' only to ret...
2013 Feb 03
1
Looping through rows of all elements of a list that has variable length
...list varies.
l.long<-list(a,b)
# I need to loop through rows of l.long[[1]] AND of l.long[[2]]
simultaneously
# and do something with both, - see example below.
# Below, I am doing it "manually" by using expand.grid to create all
combinations of rows of 2 elements of 'l.long':
mygrid<-expand.grid(1:nrow(l.long[[1]]),1:nrow(l.long[[2]]))
out<-vector("list",nrow(mygrid))
for(gridrow in 1:nrow(mygrid)){ # gridrow<-1
row.a<-mygrid[gridrow,1]
row.b<-mygrid[gridrow,2]
out[[gridrow]]<-sum(l.long[[1]][row.a,])+sum(l.long[[2]][row.b,])
}
Thank yo...
2010 Sep 30
1
Can this code be written more efficiently?
...hanks in advance
for any help.
I'm using 64-bit R 2.11.1 on Win 7.
####Start Code####
library(e1071)
library(ROCR)
### Create grid of hyperparameters
Gseq <- seq(-15,3,2); G <- rep(2, length(Gseq)); G <- G^Gseq
Cseq <- seq(-5,13,2); C <- rep(2, length(Cseq)); C <- C^Cseq
mygrid <- expand.grid(C=C, G=G)
### Train models
svm.models <- lapply(1:nrow(mygrid), function(i) {
svm(churn.form, data = mytraindata,
method = "C-classification", kernel = "radial",
cost = mygrid[i,1], gamma = mygrid[i,2],
prob...
2010 Nov 01
0
function: colvolve
...it, but I could not figure out how to do it.
I got mydata, which is a dataframe which has 7 locations, each location has
a longitude,latitude and a value.
considering a step of 0.5 degree for longitudes and latitudes, I got 15
points for longitude and 15 points for latitude. Then
I created a grid, mygrid, which has 15 columns for longitudes and 15 rows
for latitudes.
Now I want to have a circle which moves from mygrid[1,1] (column 1, row 1)
all the way to mygrid[15,15] (column 15, row 15), then it sums
the value in each cricle and retruns me a grid where each elements is the
aggregated value inside...
2013 Nov 21
2
overlaying 2D grid on randomly distributed points
Hi, I have a cloud of randomly distributed points in 2-dimensional space and want to set up a grid, with a given grid-cell size, that minimizes the distance between my points and the grid nodes. Does anyone know of an R function or toolbox that somehow addresses this problem? This is a problem of optimizing the location of the grid, not a problem of deciding what should be the grid-cell size,
2009 Feb 06
2
annotating a filled contours plot with a grid of points
Dear R-help members,
I am trying to plot annotate a filled contours plot (with filled.contour)
with a grid of points. I have read ways of annotating it with individual
points but not with grids in another matrix.
Any ideas?
Thank you very much.
Dario
___________________________________
Dario Martin-Benito
CIFOR-INIA
Dpto. Sistemas y Recursos
2009 Mar 19
1
Simple Plot with Grid's Viewport
...h my approach?
__BEGIN__
library(lattice)
library(grid)
test.plot <- function(x,y) {
pushViewport(viewport(layout.pos.col=x, layout.pos.row=y))
pushViewport(viewport(width=0.6, height=0.6));
plot(sin,-pi,2*pi, main= paste(c(i,j),collapse="-") )
}
plotfn <- ("~/Desktop/mygrid.pdf")
pdf(plotfn)
id = 0;
for (i in 1:2) {
for (j in 1:2) {
id = id+1;
cat(i, "-", j, "\n", sep="")
test.plot(i,j);
}
}
dev.off()
__END__
- Gundala Viswanath