[R] netCDF to raster and spatial projection

2014-04-16 Thread Beatriz R. Gonzalez Dominguez
I've recently started using R for spatial data. I'd be really grateful if you could could help me with this. Thanks! Sorry I don't provide a reproducible example. Please ask me if you have any questions about the data. I've extracted data from a multidimensional netCDF file. This file had

Re: [R] Pie charts using plotGooglemaps

2014-04-16 Thread Endri Raco
Hi Boris, Your code works wonderful but still I need pies plotting over map of a country. For now I get axis where coordinates are shown and it works great. Regards On Wed, Apr 16, 2014 at 12:09 AM, Boris Steipe boris.ste...@utoronto.cawrote: Here you go: install.packages(plotrix)

Re: [R] I can't programe routine comp()

2014-04-16 Thread PIKAL Petr
Hi see in line. From: Endy BlackEndy [mailto:pert...@gmail.com] Sent: Tuesday, April 15, 2014 5:38 PM To: PIKAL Petr Subject: Re: [R] I can't programe routine comp() Dear Pert, thank you for your advise. Unfortunately it does not work as you can see from the commands below.

Re: [R] netCDF to raster and spatial projection

2014-04-16 Thread Frede Aakmann Tøgersen
Hi Beatriz Try to skip this step # Reprojecting into CH1903_LV03 # First, change the coordinate reference system (crs) proj4string(rasterDF1) - +init=epsg:21781 And just do this # Second, reproject the raster rasterDF1.CH - spTransform(rasterDF1,

Re: [R] netCDF to raster and spatial projection

2014-04-16 Thread Bea GD
Hi Frede, Thanks so much for your reply! I've tried what you said but I get the following error: Error in spTransform(rasterDF1, crs(+init=epsg:21781)) : load package rgdal for spTransform methods I've checked search() and rgdal is before sp. search() [1] .GlobalEnvpackage:chron

[R] R regular expression and locales

2014-04-16 Thread Luca Cerone
Hi everybody, I am developing some functions that use regular expressions and grepl, to check whether certain strings match a given pattern or not. In the regular expression I use some shortcuts such as [:alnum:]. Reading the documentation for regular expression there is one sentence that is not

Re: [R] Save multiple plots as pdf or jpeg

2014-04-16 Thread starter
David you mentioned that one can deliver jpegs embedded in other formats like pdf. Do you know which programs can allow me to do that or how I can go on about it? Or does it involve some kind of loop whereby, it saves the plots as jpeg and then collates them into pdf. So it’s a multi-page

Re: [R] Fw: Save multiple plots as pdf or jpeg

2014-04-16 Thread Pavneet Arora
Hello Uwe Can you explain what you mean by try to plot the sensity only with few hundreds of segemnts Do you mean that I should take some kind of sample and do it? And if so what's the best number for the sample and how do i ensure that its not biased? From: Uwe Ligges

Re: [R] Meta-analysis of prevalence at the country level with mgcv/gamm4

2014-04-16 Thread Julien Riou
Hi Michael, Thank you for your input. Actually the idea of using the model to estimate a number of sick people by age group came later in the project, and I missed the issue with the ecological nature of the analysis. Initially, I intended to use the model to predict a single prevalence for each

Re: [R] Pie charts using plotGooglemaps

2014-04-16 Thread Jim Lemon
On 04/16/2014 04:43 AM, DrunkenPhD wrote: Sorry Jim not for my beginner level :((( So if my data are like this : xyCityVillage 19.943731440.7086377120425 20.221417141.492433611 20.095589139.948136444 20.950663640.64473471015 how do I plot for every point(x,y) a pie chart with

[R] Writing a function in a corrrect way

2014-04-16 Thread Ashis Deb
Hi all , I am about to make a package using gWidgets and RGTK, so for that I had put all my codes into a empty function to access it afterward by the function name using liketrade() . Here is the below code example :--- trade-function()

Re: [R] netCDF to raster and spatial projection

2014-04-16 Thread Frede Aakmann Tøgersen
Well no need to have your data. Usually one can find some suitable data in the help for the functions under question. So here is a reproducible example from ?meuse.grid. data(meuse.grid) coordinates(meuse.grid) - ~x+y proj4string(meuse.grid) - CRS(+init=epsg:28992) # see ?meuse for this crs

Re: [R] Pie charts using plotGooglemaps

2014-04-16 Thread Jim Lemon
On 04/16/2014 07:59 PM, DrunkenPhD wrote: Ok this seems to work perfect, Dont want to be boring but what if plotting in real map smth like: hdf - get_map(location = c(20.166065, 41.270679), zoom = 8, maptype = 'roadmap') ggmap(hdf, extent = 'device') I'm not sure that this will work, as ggmap

Re: [R] Pie charts using plotGooglemaps

2014-04-16 Thread Jim Lemon
See inline On 04/16/2014 08:13 PM, DrunkenPhD wrote: No nothing : I tried : hdf - get_map(location = c(20.166065, 41.270679), zoom = 8, maptype = 'roadmap') sampledf-read.table(text=x y City Village 19.9437314 40.7086377 120 425 20.2214171 41.4924336 1 1 20.0955891 39.9481364 4 4

Re: [R] netCDF to raster and spatial projection

2014-04-16 Thread Frede Aakmann Tøgersen
Hi Bea Well the first hit lead me to rasterProject{raster}. Will this suit you? rasterMG.proj - projectRaster(rasterMG, crs=CRS(+init=epsg:21781)) print(rasterMG.proj) class : RasterLayer dimensions : 116, 91, 10556 (nrow, ncol, ncell) resolution : 40.1, 40.1 (x, y) extent :

Re: [R] Pie charts using plotGooglemaps

2014-04-16 Thread Jim Lemon
On 04/16/2014 08:29 PM, Endri Raco wrote: I see function *segmentGoogleMaps* from package *plotGoogleMaps* does exactly what I need with data from dataset *meuse*. When I ran code: coordinates(sampledf)-~x+y # convert to SPDF proj4string(sampledf) - CRS('+init=epsg:28992')# adding Coordinate

Re: [R] Trend test for hazard ratios

2014-04-16 Thread Göran Broström
On 04/15/2014 10:51 PM, David Winsemius wrote: On Apr 15, 2014, at 6:32 AM, Therneau, Terry M., Ph.D. wrote: You can do statistical tests within a single model, for whether portions of it fit or do not fit. But one cannot take three separate fits and compare them. The program needs context

Re: [R] The explanation of ns() with df =2

2014-04-16 Thread John Fox
Dear Xing, My point wasn't that you should add 1 df for a constant to each cubic but that you need not subtract 1 for continuity. I'm sorry that I didn't make that clear. When you use the natural spline in a regression, there's a constant in the model as a separate term with 1 df, which in

Re: [R] netCDF to raster and spatial projection

2014-04-16 Thread Bea GD
Hi Frede, Thanks so much! It seems to work perfectly, exactly what I wanted to do! :) All the best, Bea On 16.04.2014 12:25, Frede Aakmann Tøgersen wrote: Hi Bea Well the first hit lead me to rasterProject{raster}. Will this suit you? rasterMG.proj - projectRaster(rasterMG,

Re: [R] Testing correlation of equation in a SUR model fitted by systemfit

2014-04-16 Thread Arne Henningsen
Dear Paul On 15 April 2014 19:23, Paul Smith phh...@gmail.com wrote: How to test whether the correlation in the matrix of correlation of a two-equations SUR model fitted by package systemfit are significant? You can use a likelihood-ratio test to compare the SUR model with the corresponding

Re: [R] Pie charts using plotGooglemaps

2014-04-16 Thread Endri Raco
I see function * segmentGoogleMaps* from package *plotGoogleMaps* does exactly what I need with data from dataset *meuse*. When I ran code: coordinates(sampledf)-~x+y # convert to SPDF proj4string(sampledf) - CRS('+init=epsg:28992')# adding Coordinate Referent Sys. # Create web map of Point data

Re: [R] Pie charts using plotGooglemaps

2014-04-16 Thread DrunkenPhD
Ok this seems to work perfect, Dont want to be boring but what if plotting in real map smth like: hdf - get_map(location = c(20.166065, 41.270679), zoom = 8, maptype = 'roadmap') ggmap(hdf, extent = 'device') Regards On Wednesday, April 16, 2014 11:51:43 AM UTC+2, Jim Lemon wrote: On

Re: [R] Pie charts using plotGooglemaps

2014-04-16 Thread DrunkenPhD
No nothing : I tried : hdf - get_map(location = c(20.166065, 41.270679), zoom = 8, maptype = 'roadmap') sampledf-read.table(text=x y City Village 19.9437314 40.7086377 120 425 20.2214171 41.4924336 1 1 20.0955891 39.9481364 4 4 20.9506636 40.6447347 10 15,header=TRUE) # make the

[R] Lazy loading of CSV file

2014-04-16 Thread Luca Cerone
Hi, in a package I am developing some functions need to use some external data. I have these data as a set of .csv files that I have placed in the inst/extdata folder. At the moment I have a file db-internal.r where I load all the internal databases that could be used by the functions in my

[R] multiple plots on same sheet in R

2014-04-16 Thread eliza botto
Dear useRs, I drew 12 separate raster maps. I want to combine them in such a way the they appear on the same sheet in R, which will later on be saved. Each row should contain three raster maps, so in total we should have 4 rows with each row containing 3 rasters. I know that mfrow() can do it

Re: [R] multiple plots on same sheet in R

2014-04-16 Thread Pascal Oettli
Hi, Did you have a look at the rasterVis package? Regards, Pascal On Wed, Apr 16, 2014 at 9:33 PM, eliza botto eliza_bo...@hotmail.com wrote: Dear useRs, I drew 12 separate raster maps. I want to combine them in such a way the they appear on the same sheet in R, which will later on be

Re: [R] Lazy loading of CSV file

2014-04-16 Thread Jeff Newmiller
The standard way to put data into a package is to convert it to RDA as described in the Writing R Extensions document. This is faster and more compact than CSV. --- Jeff NewmillerThe .

Re: [R] Lazy loading of CSV file

2014-04-16 Thread Luca Cerone
Hi Jeff, thanks for your reply. I read about it in the documentation and I plan to build the functions to download the csv and convert to rda in the future. At the moment, however, I am looking for a quick and dirty solution to lazy load the files I already have. (I know I could convert them

Re: [R] indexing names for looping across computations done on pairs of matrices

2014-04-16 Thread Cade, Brian
A.K. Wonderful - thank you. The last set of code using sapply(), seq_along(), and get() worked like a charm and was what I was missing. Brian Brian S. Cade, PhD U. S. Geological Survey Fort Collins Science Center 2150 Centre Ave., Bldg. C Fort Collins, CO 80526-8818 email: ca...@usgs.gov

[R] interpreting weight in meta-analysis of proportion

2014-04-16 Thread petretta
Dear all, I use R 3.0 for Windows. I performed a meta-analysis of the prevalence (single proportion) reported in 14 different studyes using the command: res-metaprop(case,n,sm=PFT, comb.fixed=FALSE, comb.random=TRUE, studlab- paste(Study)) print(res) A referee ask a brief explanation

Re: [R] Lazy loading of CSV file

2014-04-16 Thread Luca Cerone
I just found out that the function delayedAssign is what I was looking for. 2014-04-16 16:51 GMT+02:00 Luca Cerone luca.cer...@gmail.com: Hi Jeff, thanks for your reply. I read about it in the documentation and I plan to build the functions to download the csv and convert to rda in the

Re: [R] multiple plots on same sheet in R

2014-04-16 Thread Federico Lasa
see: ?par Does running par(mfrow=c(4,3)) do the job? On Wed, Apr 16, 2014 at 7:33 AM, eliza botto eliza_bo...@hotmail.com wrote: Dear useRs, I drew 12 separate raster maps. I want to combine them in such a way the they appear on the same sheet in R, which will later on be saved. Each

[R] paper on cross-validation pitfalls

2014-04-16 Thread Damjan
Dear All, We have recently published an article on cross-validation pitfalls http://www.jcheminf.com/content/6/1/10/ In the article, amongst other things, we discuss nested cross-validation and variable selection with cross-validation which I am sure is of interest to statistical modelling

Re: [R] Mean not working in function

2014-04-16 Thread arun
Hi, Try: set.seed(48) dat1 - data.frame(matrix(sample(c(NA, 1:20), 4 * 20, replace = TRUE), ncol = 4), fac1 = sample(LETTERS, 20, replace = TRUE)) mysummary - function(dataf) { indx - sapply(dataf, is.numeric) for (name in names(dataf)[indx]) { cat(Variable name: , name, : Mean=, mean(dataf[,

[R] Extracting Width and Length of Each Shape in EPS File

2014-04-16 Thread Muhammad Abdur Rehman Khawaja
Respected Fellows, I need little bit guidance regarding, how Can I Extract/Calculate/Measure width and length of each every shape in .eps file. EPS file is being generated from Adobe Illustrator. I have used grImport Library in R language to import eps file in R environment, but I couldn't

[R] Problems installing packages

2014-04-16 Thread Anton FRANCOIS
Hello, I am woking on ubuntu 13.10 (saucy) And my version() function return: version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 3 minor 1.0 year 2014 month 04 day 10 svn rev 65387 language R version.string R version 3.1.0 (2014-04-10)

[R] plot legend in filled.contour plot with infinite limits

2014-04-16 Thread jlehm
Dear R-users, http://r.789695.n4.nabble.com/file/n4688905/example.jpg I would like to manipulate the legend bar of a filled.contour plot in the same way as it is done in the attached example I found on the web. So, in particular, I would like to limit my z-range and then have triangles at the

[R] Values cells

2014-04-16 Thread Alexsandro Cândido de Oliveira Silva
Hi folks, I’m using the raster package. I need to get the min and max values between the cells of a raster, something like this: [min, max]. How? --- Este email está limpo de vírus e malwares porque a proteção do avast! Antivírus está ativa. [[alternative HTML version deleted]]

Re: [R] Values cells

2014-04-16 Thread Frede Aakmann Tøgersen
Well, if you are using the print method on a raster object what do you get then? Try this: library(raster) Loading required package: sp logo - raster(system.file(external/rlogo.grd, package=raster)) print(logo) class : RasterLayer band: 1 (of 3 bands) dimensions :

[R] Using pre-defined IRT parameters in ltm package

2014-04-16 Thread Luana Marotta
Hi all, I want to estimate scores using IRT when the model parameters are known. I'd like to define my parameters a priori using the ltm package, but haven't found much information on the manual. I appreciate any help on this. Thanks, Luana [[alternative HTML version deleted]]

[R] help incorporating data subset lengths in function with ddply

2014-04-16 Thread Steve E.
Dear R Community, I am having some trouble with a task that I hope you might be able to help with. I have a dataset that includes the time and corresponding stream discharge from numerous storms (example of structure with simplified data below). I would like to produce a field that details the

Re: [R] help incorporating data subset lengths in function with ddply

2014-04-16 Thread Frede Aakmann Tøgersen
Hi Do you seek something like this: mydat - read.table(text= storm,Q_time,Q, duration s1,2008-08-07 21:15:00,0.000,1 s1,2008-08-07 21:16:00,3.020,2 s1,2008-08-07 21:17:00,6.041,3 s1,2008-08-07 21:18:00,9.061,4 s1,2008-08-07 21:19:00,12.082,5 s1,2008-08-07 21:20:00,15.102,6 s1,2008-08-07

Re: [R] Regarding snp data

2014-04-16 Thread David Winsemius
On Apr 15, 2014, at 4:15 PM, Manan Amin wrote: Hello, I have a data file of 108mb with snps data of 0,1,2. I am new in the program and have to do this project. My first step is to get the p value using chisq.test function. I have tried running the function however since I am new

Re: [R] help incorporating data subset lengths in function with ddply

2014-04-16 Thread Steve E.
Hi Frede - Thank you for responding. Not quite what I am after. Notice that I included two data sets in my post, the first is the raw data whereas the second (the desired df) is similar but has a column of sequential numbers in another column at the end - that column of sequential numbers for each

[R] Help in analysis of similarity in Iramuteq

2014-04-16 Thread Ana Karla Silva Soares
I am conducting the analysis of similarity and when I request the 3D graph the following error appears: erreur R None1 none none Can anyone help me? Thank you. Ana Karla S Soares -- Ana Karla Silva Soares Doutoranda em Psicologia Social - UFPB Mestre em Psicologia Social - UFPB Graduada em

Re: [R] Trend test for hazard ratios

2014-04-16 Thread David Winsemius
On Apr 16, 2014, at 4:07 AM, Göran Broström wrote: On 04/15/2014 10:51 PM, David Winsemius wrote: On Apr 15, 2014, at 6:32 AM, Therneau, Terry M., Ph.D. wrote: You can do statistical tests within a single model, for whether portions of it fit or do not fit. But one cannot take three

Re: [R] problem on package survey , function svyglm,

2014-04-16 Thread Thomas Lumley
On Tue, Apr 15, 2014 at 7:07 AM, Milan Bouchet-Valat nalimi...@club.frwrote: Le lundi 14 avril 2014 à 13:59 -0400, Hanze Zhang a écrit : Hi, I want to do logistic regression based on a complex sample design. I used package survey, but when I ran svyglm, an error message came out:

Re: [R] Problems installing packages

2014-04-16 Thread Uwe Ligges
On 16.04.2014 14:59, Anton FRANCOIS wrote: Hello, I am woking on ubuntu 13.10 (saucy) And my version() function return: version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major 3 minor 1.0 year 2014 month 04 day 10 svn rev 65387

Re: [R] Values cells

2014-04-16 Thread MacQueen, Don
I'm pretty sure this is described and not hard to find in the raster package documentation, which you can download from the CRAN package page. In addition, r-sig-geo is generally the best place to ask question related to R's 'geo' packages (which includes raster). -Don -- Don MacQueen Lawrence

Re: [R] Fw: Save multiple plots as pdf or jpeg

2014-04-16 Thread Uwe Ligges
On 16.04.2014 11:00, Pavneet Arora wrote: Hello Uwe Can you explain what you mean by try to plot the sensity only with few hundreds of segemnts Do you mean that I should take some kind of sample and do it? And if so what's the best number for the sample and how do i ensure that its not

Re: [R] Extracting Width and Length of Each Shape in EPS File

2014-04-16 Thread Jeff Newmiller
Have you read the vignettes that accompany that package? You should also read the Posting Guide for this mailing list, as HTML email is not in general a good idea on this list. --- Jeff NewmillerThe

[R] [R-pkgs] Updates to Hmisc, rms, and greport packages

2014-04-16 Thread Frank Harrell
The Hmisc package has had a number of updates/fixes: Changes in version 3.14-4 (2014-04-13) * rcspline.eval: stop new logic for ignoring outer values when there are many ties when there are also many ties on interior values. Added new logic to use interior unique values of x when the

Re: [R] Extracting Width and Length of Each Shape in EPS File

2014-04-16 Thread Paul Murrell
Hi Here is a demonstration that might give you some ideas ... library(grImport) PostScriptTrace(flower.ps, flower.xml) flower - readPicture(flower.xml) grid.newpage() grid.picture(flower) # Extract each path, then look at the 'summary' for the path for (i in 1:flower@summary@numPaths) { bb

[R] xyplot y scale label help

2014-04-16 Thread Ahmed Attia
Hi R usres, I would like to specify y label units in xyplot. I tried the yaxp, but it does not work. Following are my codes; trellis.device(col=F) xyplot(GY~N|S,data = Ahmed, layout=c(5,1,1), xlab=expression(paste(N rate (kg , ha^-1,))), ylab=expression(paste(Biomass yield (Mg ,ha^-1,))),

Re: [R] help incorporating data subset lengths in function with ddply

2014-04-16 Thread Jeff Newmiller
Note that ddply is a heavyweight solution, and as your data gets larger you may find that using it for little things like this hits performance. Also, df is a base function that you might actually want to use someday, and you also introduce confusion in the mind of someone reading your code if

Re: [R] help incorporating data subset lengths in function with ddply

2014-04-16 Thread Jeff Newmiller
Note that the solution you asked for is not robust in the presence of missing data, though Frede's suggestion or something like it would be. --- Jeff NewmillerThe . . Go Live...

[R] ggplot2: using coord_trans for logit - probability

2014-04-16 Thread Michael Friendly
I'm trying to see if how I can use coord_trans() with ggplot2 to transform the Y axis of a plot on the logit scale to the probability scale, as opposed to recalculating everything manually and constructing a new plot. Here is a simple example of the 'base' plot I'd like to transform:

Re: [R] ggplot2: using coord_trans for logit - probability

2014-04-16 Thread Tim Marcella
I think all you have to do is add type=response to your call for the predictions. Does this work for you # get fitted values on the logit scale pred - data.frame(Arthritis, predict(arth.logistic, se.fit=TRUE,type=response)) library(ggplot2) library(scales) # plot on logit

Re: [R] problem on package survey , function svyglm,

2014-04-16 Thread Hanze Zhang
Thank you, guys. I merged strata and fitted my model. On Wed, Apr 16, 2014 at 5:33 PM, Thomas Lumley tlum...@uw.edu wrote: On Tue, Apr 15, 2014 at 7:07 AM, Milan Bouchet-Valat nalimi...@club.frwrote: Le lundi 14 avril 2014 à 13:59 -0400, Hanze Zhang a écrit : Hi, I want to do

Re: [R] ggplot2: using coord_trans for logit - probability

2014-04-16 Thread Tim Marcella
Sorry I jumped the gun. That does not provide you with the same plot as gg2 that you are aiming for. -T On Wed, Apr 16, 2014 at 7:37 PM, Tim Marcella timmarce...@gmail.com wrote: I think all you have to do is add type=response to your call for the predictions. Does this work for you #

[R] Labeling/identifying observations in plot after MclustDR from Mclust

2014-04-16 Thread Mark Manger
Hi, I’m trying to figure out how to label points in a contour plot produced from the output of MclustDR, the dimension reduction function in the Mclust package. The original data frame has row names RRcoarse govtDeficitres_gdp GrossFixedCapForm_UN fuelExports AUS_76

Re: [R] : Quantile and rowMean from multiple files in a folder

2014-04-16 Thread arun
Hi, Use this code after `lst2`. lapply(seq_along(lst2), function(i) { lstN - lapply(lst2[[i]], function(x) { datN - as.data.frame(matrix(NA, nrow = 101, ncol = length(names1), dimnames = list(NULL, names1))) x1 - x[, -1] qt - numcolwise(function(y)

Re: [R] The explanation of ns() with df =2

2014-04-16 Thread Xing Zhao
Dear John, Thanks for your patience, got your idea Best, Xing On Wed, Apr 16, 2014 at 4:11 AM, John Fox j...@mcmaster.ca wrote: Dear Xing, My point wasn't that you should add 1 df for a constant to each cubic but that you need not subtract 1 for continuity. I'm sorry that I didn't make

Re: [R] : Quantile and rowMean from multiple files in a folder

2014-04-16 Thread Zilefac Elvis
Hi AK, Thanks very much. Atem. On Wednesday, April 16, 2014 9:32 PM, arun smartpink...@yahoo.com wrote: Hi, Use this code after `lst2`. lapply(seq_along(lst2), function(i) {     lstN - lapply(lst2[[i]], function(x) {         datN - as.data.frame(matrix(NA, nrow = 101, ncol = length(names1),