similar to: How R converts data between objects

Displaying 20 results from an estimated 5000 matches similar to: "How R converts data between objects"

2011 Apr 09
1
For->lapply->parallel apply
Dear all, I would like to ask your help understand the subsequent steps for making my program faster. The following code: Gauslist<-array(data=NA,dim=c(dimx,dimy,dimz)) for (i in c(1:dimz)){ print(sprintf('Creating the %d map',i)); Gauslist[,,i]<-f <- GaussRF(x=x, y=y, model=model, grid=TRUE,param=c(mean,variance,nugget,scale,Whit.alpha)) } creates 100 GaussMaps (each
2011 May 30
0
2D random walk with traps convert C++ code to R code
Hello, I have a C++ code for 2D random walks with traps and I want to convert it in a R code with its syntaxs, can anyone help??????? It's easy for me to adapt the body but I want help with the beginig (variable declaration) and th end exporting the output to a file ( like write.table() or sink() ) Thank you... #include <iostream> #include <math.h>#include
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)
2011 Apr 11
1
Comparing execution times
Dear all, In my 'simple' computer I was running some experiments to help me understand how faster a multicore lapply will be. I thought it might be interesting for some people to look at the results. Even though are not accurate, still might be a good indicator how much improvement there can be. A.Case. The classic: for 1:100 for (i in c(1:dimz)){ print(sprintf('Creating the %d
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
2009 Aug 04
0
Writing a NetCDF file in R
Dear all, I am attempting to convert 10 NetCDF files into a single NetCDF file, due to the data input requirements of a model I hope to use. I am using the ncdf package, version 1.6. The data are global-scale water values, on a monthly basis for 10 years (ie. 120 months of data in total; at present the data are separated by year, with 12 months of data in each file - mrunoff_1986 through to
2009 Aug 05
0
ncdf package problem - put.var.ncdf
Dear all, I am attempting to convert 10 NetCDF files into a single NetCDF file, due to the data input requirements of a model I hope to use. I am using the ncdf package, version 1.6. The data are global-scale water values, on a monthly basis for 10 years (ie. 120 months of data in total; at present the data are separated by year, with 12 months of data in each file - mrunoff_1986 through to
2007 May 21
1
size limit in R?
Hi, Please see the email exchanges below. I am having trouble generating output that is large enough for our needs, specifically when using the GaussRF function. However, when I wrote Dr. Schlather (the author of the GaussRF function), he indicated that there is also a limit imposed by R itself. Is this something that we can overcome? Thank you very much for any assistance you may provde.
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
2010 Jul 28
2
Beginner stucked with raster + geoR package.
Hello everyone. I am trying to build up understanding in R by trying to develop just some simple scenarios. I would like to explain you what I am trying to do and what I did so far. I would like to put inside a RasterLayer (raster package) a Gaussian field (for given covariance) using grf function (geoR package) 1. First I created a Raster Layer object r <- raster() # Default values are
2010 Nov 05
0
NaN, ncdf
Dear All, Can anyone please let me know how exactly ncdf deals with NaN. I am trying to pass in a vector of data that has some NaN in it, into a variable in NetCDF. dimX <- dim.def.ncdf("X","count",(1:6)) dimY <- dim.def.ncdf("Y","count",(1:3)) var1 <-
1998 May 29
0
aov design questions
R developers, I have a first attempt to make an aov function. Eventually I want to build in Error() structure, but first I am trying to get this presentable for balanced data with only a single stratum, just using residual error. I am following R. M. Heiberger's Computation for the Analysis of Designed Experiments, Wiley (1989) I a using a wrapper (aov.bal) to call the
2011 Apr 11
1
Mclapply and print statement
Dear all. I am using the mclapply function to split my code to the many cores my system has. It seems that is working fine. This is the parallel version of lcapply. The only problem that I seem to have is that the printf cannot print messages. The ideal to me is to have fro my function an output of the form Shadowlist<-mclapply(1:dimz, function(i) { print(sprintf('Creating the
2012 Feb 10
0
range and anisotropy with RandomFields
Hello, I am presently trying to get a feel for the various packages out there that allow me to both analyze and simulate random fields. The package RandomFields is nice, but there are still a few aspects of its implementation that are confusing to me and I was hoping someone could help clarify things for me. It could also be that my questions reflect a lack of knowledge pertaining to random
2018 Jun 01
1
rasterize SpatialPolygon object using a RasterBrick object
I am trying to rasterize a SpatialPolygon object by a RasterBrick object. The documentation of the raster::rasterize function explicitly says this is allowed. Here's what I am doing # load the raster package library("raster") # create a raster brick object using the example from the brick function documentation b <- brick(system.file("external/rlogo.grd",
2010 Aug 19
0
2d kriging with anisotropy on an irregular network (RandomFields Package)
Dear List I am using the RandomFields package, and I have a problem when 2d-kriging, with an anisotropy, some values from an irregular network. It works well when : - 2d-kriging, without any anisotropy, some data from an irregular network - 2d-kriging, with and without anisotropy, some data from a regular network - 3d-kriging, with and without anisotropy, some data from a regular network Here is
2010 Mar 14
3
the error in DoSimulateRF function
Hello, I am a graduate student of University of Florida. I am trying to run a process variation model and I am facing the following error. ------------------------------------------------------------- Analysis of geostatistical data For an Introduction to geoR go to http://www.leg.ufpr.br/geoR geoR version 1.6-27 (built on 2009-10-15) is now loaded
2004 Dec 28
1
RandomFields: Controling seed with GaussRF
Hi, I'm using RF to simulate a correlated variable with GaussRF set.seed=1 GaussRF(sim.kfinegrid, grid=F, model="exponential", param=c(0,0.5,0,0.2)) However when I simulate again using the same random seed I get different results. > set.seed=1 > summary(GaussRF(sim.kfinegrid, grid=F, model="exponential", param=c(0,0.5,0,0.2))) Min. 1st Qu. Median Mean 3rd
2009 Feb 21
1
Extracting xy from raster based on raster value
I have a raster (which I called glc), which I read into R as a raster with "raster.create.from.file" from the raster package (R-forge). Values in glc range between 1 and 27 (whole numbers only). I'd like to extract all cells with a value of 1 to create a new raster with only the cells that have a value of 1, or to extract the xy values of all raster cells with a value of 1. Could you
2012 Jun 19
1
R and C pointers
Dear R devel, Apologies for these (most probably trivial) questions, doing my first attempt to call C from R (and actually learning C in the process). I need to pass a matrix to C, and after reading R-exts.pdf (many times), I was unable to find how to handle matrices at C-level... except for, what probably is the answer, that matrices are in fact vectors with dimensions. This is a sample code I