[R] netCDF to raster and spatial projection

2014-04-15 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 lo

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

2014-04-15 Thread Xing Zhao
Dear John Sorry I use 3 degree of freedom for cubic spline. After using 4, it is still not 2. I may make some naive mistake, but I cannot figure out. Where is the problem? 4 (cubic on the right side of the *interior* knot 8) + 4 (cubic on the left side of the *interior* knot 8) - 1 (two curves m

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

2014-04-15 Thread arun
Hi, If the two pairs of matrices are in a list: set.seed(42) lst1 <- lapply(1:11, function(x) matrix(sample(40, 20, replace=TRUE), 5,4)) names(lst1) <- paste0("gs", paste0("4.",seq(0,100,by=10))) set.seed(585) lst2 <- lapply(1:11, function(x) matrix(sample(40, 20, replace=TRUE), 5,4)) names

Re: [R] nearest neighbour

2014-04-15 Thread Rolf Turner
Sorry, your communication *was* on-list. I guess my eyes are going! Please ignore the first sentence of my previous post. cheers, Rolf __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guid

[R] Regarding snp data

2014-04-15 Thread Manan Amin
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 to language I am aware of how to do this step. My error am

Re: [R] a question about the output of plot

2014-04-15 Thread meng
Thanks. -- QQ: 1733768559 At 2014-04-15 17:56:01,"Jim Lemon" wrote: >On 04/15/2014 07:51 PM, meng wrote: >> Yes,it works ! >> What's the reason for it? >> >Hi meng, >As I understand it, the lattice graphics system produces plot >objects, not actual output on a graphic device. This is in

Re: [R] nearest neighbour

2014-04-15 Thread Rolf Turner
Please keep communications on-list unless there is a genuine reason not to. To answer your question: Yes, you need to convert to ppp format; the nnwhich() function requires its first argument to be of class "ppp". My example showed you how to construct or "estimate" a window if you don't have

Re: [R] Pie charts using plotGooglemaps

2014-04-15 Thread Boris Steipe
Here you go: install.packages("plotrix") library(plotrix) ?floating.pie dat<- data.frame(x=c(19.9437314, 20.2214171, 20.0955891, 20.9506636), y=c(40.7086377, 41.4924336, 39.9481364, 40.6447347), City=c(120,1, 4, 10), Village=c(425, 1, 4, 15)

Re: [R] using for loop for data frame

2014-04-15 Thread Rui Barradas
Hello, Inline. Em 15-04-2014 18:02, Monaly Mistry escreveu: Hi, I have a data frame with 15 different years and each year has a different sample size. I'm having trouble writing a for loop to have a t-test done for each year for two of the columns. Thus far I have been able to loop over the

Re: [R] generic function-method arguments accessible by tab-key

2014-04-15 Thread Robert Bauer
found the solution: v <- function(x, ...) UseMethod("v") setMethod('v', signature(x='character'), function(x, ...) v.print(x, ...)) setMethod('v', signature(x='numeric'), function(x, ...) v.numeric(x, ...)) v.print <- function(x,y=x,z=x) print(paste(x,y,z)) v.numeric <- function(x,u=3*x) print(u

Re: [R] lm predictions for rows with missing y values

2014-04-15 Thread Rui Barradas
Hello, I believe you want na.action = na.exclude. lmnew <- lm(newy ~ newx,newdata,na.action=na.exclude) na.action can not be set to TRUE or FALSE. From the help page ?lm na.action a function which indicates what should happen when the data contain NAs. The default is set by the na.ac

Re: [R] lm predictions for rows with missing y values

2014-04-15 Thread Bert Gunter
Yes. I believe what you're looking for is: See ?predict.lm and what it has to say about the na.action=na.exclude argument to lm. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wis

Re: [R] R - Need Help : Using R's qcc package in .Net Appln

2014-04-15 Thread Jeff Newmiller
This request, like the one from earlier today, is off-topic on R-help, and off-topic on the other mailing lists you cross posted to. It is rude to cross post to multiple mailing lists... pick the appropriate place according to the relevant Posting Guide and stick with it. Not only are you broadc

Re: [R] get element of list with default?

2014-04-15 Thread William Dunlap
I think the following is a trifle faster than the i%in%names(x) version, probably because it only does the name lookup once. (I also don't like to use return() - it is too much like goto.) getElement3 <- function(x, i, default) { i <- match(i, names(x)) if (is.na(i)) { default } el

Re: [R] Trend test for hazard ratios

2014-04-15 Thread David Winsemius
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 to know how the three relate to one another

[R] was: 127.0.0.1:22381/doc/html/index.html hep.start won't start

2014-04-15 Thread Christian Hoffmann
Dear All, I narrowed down my problem to library(tcltk) in .First() which causes the freezing of R and Aquamacs running it. What could make tcltk behave in this way? Christian I am using Aquamacs 3.0a (GNU Emacs 24.3.50.2)with R3.0.3, newly installed: sessionInfo() --- R version 3.0

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

2014-04-15 Thread Zilefac Elvis
Hi AK, Thanks very much. I worked great. Many thanks. Atem. On Tuesday, April 15, 2014 9:20 AM, arun wrote: Hi Atem, May be this works. ### Q1: working directory: Observed #Only one file per Site.  Assuming this is the ### case for the full dataset, then I guess there is no need to average di

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

2014-04-15 Thread Cade, Brian
So I know I must be missing something simple and obvious for the following data manipulation where I have (in this example) 11 pairs of matrices (gs4.0 to gs4.100 and ps1.0 to ps1.100) from some population simulations (all with same dimensions) where I want to get some summary statistics on the pro

[R] lm predictions for rows with missing y values

2014-04-15 Thread Mast, Brent D
Hi. I'm trying to produce lm fitted values and standard errors for cases with missing y values. I know how to compute these myself with matrix algebra, but I'm wondering if there is an appropriate na.action in the lm function to do this. Here is some simple code where I use na.action=NULL with

Re: [R] get element of list with default?

2014-04-15 Thread Spencer Graves
Thanks to Marc Schwartz and Hadley Wickham: Based on their comments, I think I'll add a combination of Hadley's code and getElement{base} Ecfun in a form like getElement2(object, name, default). Best Wishes, Spencer On 4/15/2014 9:33 AM, Hadley Wickham wrote: You really

Re: [R] Pie charts using plotGooglemaps

2014-04-15 Thread DrunkenPhD
Sorry Jim not for my beginner level :((( So if my data are like this : x y City Village 19.9437314 40.7086377 120 425 20.2214171 41.4924336 1 1 20.0955891 39.9481364

[R] using for loop for data frame

2014-04-15 Thread Monaly Mistry
Hi, I have a data frame with 15 different years and each year has a different sample size. I'm having trouble writing a for loop to have a t-test done for each year for two of the columns. Thus far I have been able to loop over the years but the output is the same t-test 15 times. I'm new to wr

Re: [R] nearest neighbour

2014-04-15 Thread Monaly Mistry
Hi Rolf, Thank you very much, I just have one other question, do I need to change the data frame into ppp format? I've tried using as.ppp but get the following error message: Error: x,y coords given but no window specified Best, Monaly. On Thu, Apr 3, 2014 at 9:23 PM, Rolf Turner wrote: >

[R] R - Need Help : Using R's qcc package in .Net Appln

2014-04-15 Thread antony romar
Hi, I am very much interested in using R. I have a query: 1.I have .Net Application from which am trying to invoke R libraries from R.NET(Libraries provided in Codeplex)2. R uses a Package called qcc(qualityChart Controls) which has a function mqcc() with set of parameters passed to it. After

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

2014-04-15 Thread arun
Hi Atem, May be this works. ### Q1: working directory: Observed #Only one file per Site. Assuming this is the ### case for the full dataset, then I guess there is no need to average dir.create("final") lst1 <- split(list.files(pattern = ".csv"), gsub("\\_.*", "", list.files(pattern = ".csv")))

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

2014-04-15 Thread John Fox
Dear Xing, > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Xing Zhao > Sent: Tuesday, April 15, 2014 1:18 PM > To: John Fox > Cc: r-help@r-project.org; Michael Friendly > Subject: Re: [R] The explanation of ns() with df =2 >

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

2014-04-15 Thread David Winsemius
On Apr 15, 2014, at 2:09 AM, Pavneet Arora wrote: > As a result, the pdf takes forever to load and doesn?t let me print, as it > runs out of memory. I was wondering if there is a way if I can save each > plot as jpeg and then export it on pdf. Will that make it quicker in > loading? If so, how

Re: [R] Trend test for hazard ratios

2014-04-15 Thread mkleber74
Hi Terry, thank you for your suggestion. I tried to do it the way that you described. I fitted my Cox model with strata and I get coefficients and P values for my ZlnGalectin in the different strata (see summary below). So am not so familiar with R so please excuse my perhaps stupid questions but

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

2014-04-15 Thread Paul Smith
Dear All, How to test whether the correlation in the matrix of correlation of a two-equations SUR model fitted by package systemfit are significant? Thanks in advance, Paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-h

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

2014-04-15 Thread Xing Zhao
Dear Michael and Fox Thanks for your elaboration. Combining your explanations would, to my understanding, lead to the following calculation of degree of freedoms. 3 (cubic on the right side of the *interior* knot 8) + 3 (cubic on the left side of the *interior* knot 8) - 1 (two curves must be co

Re: [R] Displaying "<=" in axis values

2014-04-15 Thread David Winsemius
On Apr 15, 2014, at 9:19 AM, Boris Steipe wrote: > The following works for me: > > x <- rnorm(10) > plot(x, xaxt="n") > axis(side=1, at=axTicks(1),lab=c("≤ a","≥ b","≈ c","≠ d","= e")) > > (In case the characters get mangled in transition: > I have used le, ge, approx. equal, ne, and equal in t

Re: [R] system()

2014-04-15 Thread Rui Barradas
Hello, Thanks, and sorry for the bug. I used what the op was using [system()] without checking if it worked. shell() worked in Windows 7/R 3.1.0. sessionInfo() R version 3.1.0 (2014-04-10) Platform: x86_64-w64-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=Portuguese_Portugal.1252 LC_CTYPE=Port

Re: [R] a question about the output of plot

2014-04-15 Thread Richard M. Heiberger
Please see R FAQ 7.22 7.22 Why do lattice/trellis graphics not work? == The most likely reason is that you forgot to tell R to display the graph. Lattice functions such as `xyplot()' create a graph object, but do not display it (the same is true of *ggp

Re: [R] get element of list with default?

2014-04-15 Thread Hadley Wickham
You really want to use the names of the list since lists can contain null. I'd recommend something more like: getElement <- function(x, i, default) { if (i %in% names(x)) return(x[[i]]) default } Hadley On Tue, Apr 15, 2014 at 10:53 AM, Spencer Graves wrote: > Hello: > > > Do you kno

Re: [R] get element of list with default?

2014-04-15 Thread Marc Schwartz
On Apr 15, 2014, at 11:22 AM, Marc Schwartz wrote: > On Apr 15, 2014, at 10:53 AM, Spencer Graves > wrote: > >> Hello: >> >> >> Do you know of a simple function to return the value of a named element >> of a list if that exists, and return a default value otherwise? >> >> >> It's

Re: [R] Displaying "<=" in axis values

2014-04-15 Thread Boris Steipe
... and obviously, if you want the original values: x <- rnorm(10) plot(x, xaxt="n") axis(side=1, at=axTicks(1),labels=paste("≤", axTicks(1))) B. On 2014-04-15, at 12:19 PM, Boris Steipe wrote: > The following works for me: > > x <- rnorm(10) > plot(x, xaxt="n") > axis(side=1, at=axTicks(1),

Re: [R] get element of list with default?

2014-04-15 Thread Marc Schwartz
On Apr 15, 2014, at 10:53 AM, Spencer Graves wrote: > Hello: > > > Do you know of a simple function to return the value of a named element > of a list if that exists, and return a default value otherwise? > > > It's an easy function to write (e.g., below). I plan to add this to t

Re: [R] Displaying "<=" in axis values

2014-04-15 Thread Boris Steipe
The following works for me: x <- rnorm(10) plot(x, xaxt="n") axis(side=1, at=axTicks(1),lab=c("≤ a","≥ b","≈ c","≠ d","= e")) (In case the characters get mangled in transition: I have used le, ge, approx. equal, ne, and equal in this example) Cheer,s B. On 2014-04-15, at 11:58 AM, Dennis Fis

Re: [R] Displaying "<=" in axis values

2014-04-15 Thread Bert Gunter
Show us your code. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 "Data is not information. Information is not knowledge. And knowledge is certainly not wisdom." H. Gilbert Welch On Tue, Apr 15, 2014 at 8:58 AM, Dennis Fisher wrote: > R 3.0.2 > OS X > > Colleagues >

[R] Displaying "<=" in axis values

2014-04-15 Thread Dennis Fisher
R 3.0.2 OS X Colleagues In a graphic, the x-axis values 2, 4, 6, 8, 10, 12 I would like to present these as: ≤ 2, ≤ 4, ≤ 6, ≤8, ≤ 10, ≤ 12 I have tried to accomplish this with expression and bquote without success. Can someone provide the appropriate code?

[R] get element of list with default?

2014-04-15 Thread Spencer Graves
Hello: Do you know of a simple function to return the value of a named element of a list if that exists, and return a default value otherwise? It's an easy function to write (e.g., below). I plan to add this to the "Ecfun" package unless I find it in another CRAN package.

Re: [R] Trend test for hazard ratios

2014-04-15 Thread Göran Broström
On 04/15/2014 05:00 AM, r-help-requ...@r-project.org wrote: Hello, I have the following problem. I stratified my patient cohort into three ordered groups and performed multivariate adjusted Cox regression analysis on each group separately. Now I would like to calculate a p for trend across the h

Re: [R] R tool support

2014-04-15 Thread Jeff Newmiller
This request is off-topic per the Posting Guide, which you seem not to have read (this question is clearly a development question, and you are posting using HTML email format which is not supported on this list). Please note that that .NET is not one of the development environments supported by

Re: [R] Trend test for hazard ratios

2014-04-15 Thread Therneau, Terry M., Ph.D.
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 to know how the three relate to one another. Say that "group" is your strata variable, trt the variable of inte

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

2014-04-15 Thread John Fox
Dear Xing Zhao, To elaborate slightly on Michael's comments, a natural cubic spline with 2 df has one *interior* knot and two boundary knots (as is apparent in the output you provided). The linearity constraint applies beyond the boundary knots. I hope this helps, John ---

Re: [R] error when installing package after installing R-3.1.0 on windows

2014-04-15 Thread Uwe Ligges
On 15.04.2014 03:25, Linda Peng wrote: Hi, I encountered following error" Warning in install.packages("xlsx") : 'lib = "C:/Program Files/R/R-3.1.0/library"' is not writable". This is right after I installed R-3.1.0 on windows after previous R-2.15.2 which is still existing. If you want

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

2014-04-15 Thread Uwe Ligges
You have > 1e6 observations and your lines() have these many segments, try to plot the sensity only with few hndreds of segemnts. Best, Uwe Ligges On 15.04.2014 12:27, Pavneet Arora wrote: Hello All, I have multiple plots that I want to save it a single file. At the moment, I am saving as pd

Re: [R] Some questions :How to use Friedman'Test in R

2014-04-15 Thread Uwe Ligges
On 15.04.2014 12:58, 韩红静 wrote: Dear R users: I'm trying to program the Friedman'test(),but I meet some problemes. I am reading the data below with s1=read.table("1express.txt",header=T) Then,I get the datas1B1AD1X1544766544667659886677646678777667977877

Re: [R] Error message in R

2014-04-15 Thread Uwe Ligges
On 15.04.2014 14:03, mark.l...@hauck-aufhaeuser.de wrote: Hello, we get at a users individual following error: java.lang.OutOfMemoryError: unable to create new native thread Can you please tell me how I can fix this? You are using the xlsx package? Increase the java heap size, I find a sol

Re: [R] help

2014-04-15 Thread Charles Determan Jr
Kafi, I'm not sure why you contacted me directly so I have also forwarded this to the r-help list. I am unsure as to what your problem is. At first glance, I noticed you are missing a parentheses in the WL3 line near the end but that is just after a quick scan of your code. Please be more speci

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

2014-04-15 Thread Michael Friendly
No, the curves on each side of the know are cubics, joined so they are continuous. Se the discussion in \S 17.2 in Fox's Applied Regression Analysis. On 4/15/2014 4:14 AM, Xing Zhao wrote: Dear all I understand the definition of Natural Cubic Splines are those with linear constraints on the en

[R] R tool support

2014-04-15 Thread Vijayakumar Chinnamuthu
Hi, We are using on R tool for our one of the project and looking for some technical support. Could you please help us. Flow: 1. We have C#.Net Application which uses R.NET Dll's for invoking R 2. R internally uses qcc package (mqcc function) for plotting the chart. Requirement: 1. We

[R] Error message in R

2014-04-15 Thread mark.link
Hello, we get at a users individual following error: java.lang.OutOfMemoryError: unable to create new native thread Can you please tell me how I can fix this? Thank you very much Sincerely yours Mark Link Applikationsmanagement Hauck & Aufhäuser Privatbankiers KGaA Kaiserstraße 24 60311

[R] Some questions :How to use Friedman'Test in R

2014-04-15 Thread 韩红静
Dear R users: I'm trying to program the Friedman'test(),but I meet some problemes. I am reading the data below with s1=read.table("1express.txt",header=T) Then,I get the datas1B1AD1X15447665446676598866776466787776679778777886868655786777888555777767

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

2014-04-15 Thread Pavneet Arora
Hello All, I have multiple plots that I want to save it a single file. At the moment, I am saving as pdf. Each plot has a qqnorm, qqline, tiny histogram in the top left graph with its density drawn top of it and the normal superimposed on the histogram. As a result, the pdf takes forever to lo

[R] Save multiple plots as pdf or jpeg

2014-04-15 Thread Pavneet Arora
Hello All, I have multiple plots that I want to save it a single file. At the moment, I am saving as pdf. Each plot has a qqnorm, qqline, tiny histogram in the top left graph with its density drawn top of it and the normal superimposed on the histogram. As a result, the pdf takes forever to lo

Re: [R] Read.table mucks up headers

2014-04-15 Thread Pavneet Arora
Thank you Milan, the fileEncoding bit worked perfectly. From: Milan Bouchet-Valat To: Jeff Newmiller Cc: Pavneet Arora/UK/RoyalSun@RoyalSun, r-help@r-project.org, pavnee...@yahoo.co.uk Date: 14/04/2014 18:03 Subject:Re: [R] Read.table mucks up headers Le lundi 14 avr

Re: [R] generic function-method arguments accessible by tab-key

2014-04-15 Thread Robert Bauer
just a note i liked to add: so the idea is just to have the optional arguments y and z showing up in the the v-function call using the tab-key -- View this message in context: http://r.789695.n4.nabble.com/generic-function-method-arguments-accessible-by-tab-key-tp4688793p4688794.html Sent from

[R] generic function-method arguments accessible by tab-key

2014-04-15 Thread Robert Bauer
Hi, I have the following problem: I wrote a Generic Function that comes with a bunch of different methods and even more arguments. It's kind like this: if ( !isGeneric("v") ) { setGeneric("v", function(x, ...) standardGeneric("v")) } setMethod('v', signature(x='character'),

Re: [R] a question about the output of plot

2014-04-15 Thread meng
Yes,it works ! What's the reason for it? Many thanks! -- QQ: 1733768559 At 2014-04-15 14:36:41,"Jim Lemon" wrote: >On 04/15/2014 11:46 AM, meng wrote: >> Hi all: >> I met a question about the output of plot. >> I want to output 3 plots. >> Method1: by function histogram{lattice} >> Me

Re: [R] program

2014-04-15 Thread PIKAL Petr
Hi No attachment allowed. Well, some yes but not many. Do not expect somebody will go through great deal of code. Try instead locate source of problems yourself. If you are lucky you will find it out without intervence of others, if not you will be able to post more straight question which can

Re: [R] a question about the output of plot

2014-04-15 Thread Jim Lemon
On 04/15/2014 07:51 PM, meng wrote: Yes,it works ! What's the reason for it? Hi meng, As I understand it, the lattice graphics system produces plot objects, not actual output on a graphic device. This is in aid of having an object that can be modified or stored rather than an image that cannot.

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

2014-04-15 Thread PIKAL Petr
Hi better to use dput for presenting data as it is directly usable by anybody. So I did not test it. Try to get names for appropriate columns nn<-names(d) and use get s=survfit(Surv(get(nn[2]), get(nn[3]))~get(nn[1]), data=d) It works with lm and shall work with survit too. Regards Petr >

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

2014-04-15 Thread Xing Zhao
Dear all I understand the definition of Natural Cubic Splines are those with linear constraints on the end points. However, it is hard to think about how this can be implement when df=2. df=2 implies there is just one knot, which, according the the definition, the curves on its left and its right

Re: [R] hetglm() and robust standard errors

2014-04-15 Thread Achim Zeileis
On Mon, 14 Apr 2014, ChrisR wrote: Hi everyone, I am using the hetglm() command from the package 'glmx' (0.1-0). It seems that hetglm() is incompatible with the robust standard errors estimator provided in the 'AER' package: coeftest(mymodel,vcov=vcovHC) Any suggestions how I could obtain robust