Re: [R] To map population of European countries from Eurostat

2014-02-07 Thread Jon Olav Skoien
Michel, I am no expert on ggplot2 and cannot explain why, but it seems the NAs in map.df.l$value cause some problems. Try to remove them before plotting or examine your code to figure out why you get them. They seem to be on the borders between NUTS2-level objects. Best wishes, Jon On

Re: [R] problem with mahal function Package dismo

2013-08-07 Thread Jon Olav Skoien
Hi Ernesto, I think the issue is that the mahal function treats the arguments differently depending on the class. If you pass the arguments x and p as raster and data.frame/matrix, it will use the values of x at the locations defined in p as training data. If you pass a data.frame, it will

Re: [R] How to make a raster image in R from my own data set

2013-04-26 Thread Jon Olav Skoien
Hi Kristi, it takes a few extra steps to create a raster layer from your example data set, as it is not a gridded map in Lat lon (probably in some projection though). How exactly to do it depends on your data, but here are some hints: 1. If you actually need to read the data set from a

Re: [R] snow: cluster initialization

2013-04-18 Thread Jon Olav Skoien
I dont think this has anything to do with the snow package, you should rather start by checking what is the output of system('nproc') is on your computer, and also whether it is possible to assign this to a variable. I tried on a redhat linux (R 2.15.0) server: ncore = system('nproc') 16

Re: [R] snow: cluster initialization

2013-04-18 Thread Jon Olav Skoien
I also wanted to add the result from my Windows machine (R 3.0.0) to the answer below: ncore = system('nproc') ncore [1] 127 # My machine was not happy about starting a cluster with 127 nodes though. Best wishes, Jon On 18-Apr-13 15:13, Jon Olav Skoien wrote: I dont think this has anything

[R] Create function from string

2013-04-16 Thread Jon Olav Skoien
Dear list, I am trying to create a function from a string, and have so far solved it with eval(parse()). This works well also when using the newly created function as an argument to another function. The trouble starts when I want to use it with parLapply. Below is a much simplified example:

Re: [R] Create function from string

2013-04-16 Thread Jon Olav Skoien
Thanks a lot, that seems to do exactly what I need! Best wishes, Jon On 16-Apr-13 10:21, peter dalgaard wrote: Is this what you are looking for? FUN = eval(bquote(function(x) .(parse(text = fstring)[[1]]))) FUN function (x) x + 2 FUN(3) [1] 5 On Apr 16, 2013, at 09:50 , Jon Olav Skoien

Re: [R] help with kriging interpolation

2013-04-04 Thread Jon Olav Skoien
I am not sure which soil example you refer to (meuse?), but it should anyway be fairly easy to get a single interpolation, just give a single point as the prediction location. The easiest is probably to start with the automap package or the intamap package, where the variogram fitting etc is

Re: [R] Cokriging

2013-03-19 Thread Jon Olav Skoien
Nishani, we do not have access to your data, but I guess the problem is the size of the observation data set. I think the default of predict.gstat is to create one covariance matrix between all observation locations, which would be a 50,000*50,000 matrix in your case. The alternative is to do

Re: [R] Netcdf file in R

2013-02-22 Thread Jon Olav Skoien
I would also suggest the package raster, which usually make it much easier to extract spatial NetCDF-data than direct use of the NetCDF-packages. Bests, Jon On 22-Feb-13 17:14, Marc Schwartz wrote: NetCDF is a binary file format and will be stripped by the list server filters. Don't bother

Re: [R] How to make Ordinary Kriging using gstat predict?

2012-12-19 Thread Jon Olav Skoien
Hi Dimitris, The mistake is that predict.gstat doesnt have a model argument, as you assume. But as the function also accepts arguments through ..., it does not complain about the unused argument. Try instead to put the model argument in the gstat-object as you can see in the example in

Re: [R] Rprof causing R to crash

2012-12-14 Thread Jon Olav Skoien
Uwe, I am unfortunately not able to upgrade to R 2.15.2 right now, but I have seen a similar problem with several older R versions. If you want to test with a shorter script, you can try the lines below. These provoke a crash from a fresh R session on my machine (R 2.15.1 Windows 7):

Re: [R] interpolation to new points between geo coordinates

2012-07-02 Thread Jon Olav Skoien
Jan, There are a lot of packages that can help you, the best one depends on your needs (with or without prediction uncertainty, format of results, different options) and the size of your problem. CRAN has a spatial Task View http://cran.r-project.org/web/views/Spatial.html with a short

[R] Cannot change location of tempdir()

2012-03-08 Thread Jon Olav Skoien
Hi, One of the functions I use needs to write to a temporary file, in the directory given by tempdir(). I want to change this from the standard one, as the file is too large for the drive. However, tempfile() doesnt seem to respect the environment variables when I change them with

Re: [R] Cannot change location of tempdir()

2012-03-08 Thread Jon Olav Skoien
On 08-Mar-12 12:45, Prof Brian Ripley wrote: On Thu, 8 Mar 2012, Jon Olav Skoien wrote: Hi, One of the functions I use needs to write to a temporary file, in the directory given by tempdir(). I want to change this from the standard one, as the file is too large for the drive. However

[R] Suggests/Enhances or .onLoad for S3-methods for optional package

2012-02-13 Thread Jon Olav Skoien
Hi, I am developing a package B that, among other things, also offers some extra S3-methods for functions in package A if the user has installed A. I do not want to list A under Depends of B, as the dependency list of A is rather long, and most potential users of B will not be interested in

[R] Find downstream values in a network

2011-03-02 Thread Jon Olav Skoien
Dear list, I have a data.frame with segments between river junctions and dimensionless predictions of runoff (runoff/area) at some of these junctions. As I want to plot my values on a continuous river network (this data.frame is part of a SpatialLinesDataFrame), I would like to change NA

Re: [R] Cross validation for Ordinary Kriging

2011-01-07 Thread Jon Olav Skoien
Pearl, The error suggests that there is something wrong with x2, and that there is a difference between the row names of the coordinates and the data. If you call str(x2) see if the first element of @coords is different from NULL, as this can cause some problems when cross-validating. If it

Re: [R] Cross validation for Ordinary Kriging

2011-01-07 Thread Jon Olav Skoien
On 1/7/2011 12:40 PM, Jon Olav Skoien wrote: Pearl, The error suggests that there is something wrong with x2, and that there is a difference between the row names of the coordinates and the data. If you call str(x2) see if the first element of @coords is different from NULL, as this can

Re: [R] Prediction error for Ordinary Kriging

2011-01-07 Thread Jon Olav Skoien
Pearl, You find the prediction error as the var1.var column in your result object, i.e., y in your script. For plotting: spplot(y, 2) or spplot(y,var1.var) Jon On 1/5/2011 9:28 PM, pearl may dela cruz wrote: Hi ALL, Can you please help me on how to determine the prediction error for

Re: [R] install.packages() - old version deleted, new version did not install

2010-12-20 Thread Jon Olav Skoien
On 12/17/2010 6:22 PM, Duncan Murdoch wrote: On 17/12/2010 11:13 AM, Jon Olav Skoien wrote: Dear list, (R 2.12.0, Windows 7, 64bit) I recently tried to install a new package (spacetime), that depends on sp among others. I already had the last one installed, but there was probably a newer

Re: [R] install.packages() - old version deleted, new version did not install

2010-12-20 Thread Jon Olav Skoien
On 12/20/2010 1:43 PM, Duncan Murdoch wrote: Jon Olav Skoien wrote: On 12/17/2010 6:22 PM, Duncan Murdoch wrote: On 17/12/2010 11:13 AM, Jon Olav Skoien wrote: Dear list, (R 2.12.0, Windows 7, 64bit) I recently tried to install a new package (spacetime), that depends on sp among others. I

Re: [R] install.packages() - old version deleted, new version did not install

2010-12-20 Thread Jon Olav Skoien
On 12/20/2010 1:30 PM, Uwe Ligges wrote: On 20.12.2010 09:41, Jon Olav Skoien wrote: On 12/17/2010 6:22 PM, Duncan Murdoch wrote: On 17/12/2010 11:13 AM, Jon Olav Skoien wrote: Dear list, (R 2.12.0, Windows 7, 64bit) I recently tried to install a new package (spacetime), that depends

Re: [R] install.packages() - old version deleted, new version did not install

2010-12-20 Thread Jon Olav Skoien
:03 AM, Jon Olav Skoien wrote: [ lots deleted ] Yes, I had it open. In this case it was intentional to give a reproducible example in case something had changed in the new version, in other cases I have had to wait for 2 days before I could reinstall a package. It seems the .dll

[R] install.packages() - old version deleted, new version did not install

2010-12-17 Thread Jon Olav Skoien
Dear list, (R 2.12.0, Windows 7, 64bit) I recently tried to install a new package (spacetime), that depends on sp among others. I already had the last one installed, but there was probably a newer version on CRAN, so the command install.packages(spacetime) also gave me: also installing the

Re: [R] maptools package

2010-11-11 Thread Jon Olav Skoien
On 11/10/2010 11:27 PM, Aleksandr Andreev wrote: OK, that loads the shape file. But now when I do: submap- subset(spb, as.character(spb$Name) == 'Vasilevsky Island') the submap still has the whole city, not just the subset. Is there now a different way of extracting a subset from a map? I

[R] Slow response from Windows Rgui - caused by Word?

2010-08-19 Thread Jon Olav Skoien
Dear list, I quite often experience a delayed response when I type in the console of the RGui of my computer. When typing a command, the text only appears letter-by-letter on the console if I type rather slow (maximum 1-2 letters per second), otherwise it appears some time after I finished

Re: [R] Slow response from Windows Rgui - caused by Word?

2010-08-19 Thread Jon Olav Skoien
. On Thu, Aug 19, 2010 at 4:35 AM, Jon Olav Skoien jon.sko...@jrc.ec.europa.eu wrote: Dear list, I quite often experience a delayed response when I type in the console of the RGui of my computer. When typing a command, the text only appears letter-by-letter on the console if I type rather slow

Re: [R] Missing link(s) in documentation object

2009-09-21 Thread Jon Olav Skoien
Martin Morgan wrote: Jon Olav Skoien wrote: Hi, I want to cross-reference from the documentation of pkg1 to pkg2, which is imported in the NAMESPACE of pkg1, and under Depends in DESCRIPTION of pkg1. According to Writing R extensions, this can be done by: \code{\link{foo}} when foo

[R] Missing link(s) in documentation object

2009-09-18 Thread Jon Olav Skoien
Hi, I want to cross-reference from the documentation of pkg1 to pkg2, which is imported in the NAMESPACE of pkg1, and under Depends in DESCRIPTION of pkg1. According to Writing R extensions, this can be done by: \code{\link{foo}} when foo is an aliased function in the documentation of pkg2.

[R] Dependency between packages for Windows-binaries

2009-06-09 Thread Jon Olav Skoien
Hi, I have already asked a similar question without response (https://stat.ethz.ch/pipermail/r-help/2009-June/200300.html) so I am here reformulating in the hope that someone is able to help. If something is unclear, please ask. I am working on the development of two packages, pkg1 and pkg2

Re: [R] manipulating (extracting) data from distance matrices

2008-07-15 Thread Jon Olav Skoien
Maybe dmat-dist(dat, method=euclidean,upper = TRUE,diag = TRUE) can fix your problem with the triangular matrix? Cheers Jon Michael Rennie wrote: Not really, I'd actually want f[4:6,4:6] to get comparisons of observations 4 to 6 only. And I'm still left with the upper triangular matrix.

Re: [R] problems with variogram

2008-06-04 Thread Jon Olav Skoien
Laura Saltyte wrote: Hello, I have data at 10 locations, in each location there are time series (T=56). Question is: when I’m fitting variogram what happens with those measures in each location? Are they taken as repeated measures? It's very important for my to know this Thanks a lot Hi