Re: [R] Fwd: Dynamic regex/sub changes to function

2014-09-22 Thread Rolf Turner
On 23/09/14 12:18, Bert Gunter wrote: Daniel: Do you understand what a parse tree is? Paraphrasing a quote attributed to Feynman: "If you think you understand what a parse tree is, then you don't understand what a parse tree is." :-) cheers, Rolf -- Rolf Turner Technical Editor AN

[R] Confused by dlnorm - densities do not match histogram

2014-09-22 Thread Terran Melconian
Good evening! I'm running into some surprising behavior with dlnorm() and trying to understand it. To set the stage, I'll plot the density and overlay a normal distribution. This works exactly as expected; the two graphs align quite closely: qplot(data=data.frame(x=rnorm(1e5,4,2)),x=x,stat='dens

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Duncan Murdoch
On 22/09/2014, 7:38 PM, Daniel Fuka wrote: > Thanks everyone for the help. I need to step back and refresh my > memory on expressions as I am still unclear as to why I can not > directly edit: > body(nsong)[[2]] > # Which can be located from a grep: > body(nsong)[[grep("fuka",body(nsong))]] > # tho

[R] Fwd: Dynamic regex/sub changes to function

2014-09-22 Thread Bert Gunter
(failed to cc the list) Daniel: Do you understand what a parse tree is? Try this: f <- function(x){ + y <- x^2 + z <- sin(y+2) + } > body(f) { y <- x^2 z <- sin(y + 2) } > as.list(body(f)) [[1]] `{` [[2]] y <- x^2 [[3]] z <- sin(y + 2) > body(f)[[c(3,3,1)]] sin > class(body(f)) [

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
Thanks everyone for the help. I need to step back and refresh my memory on expressions as I am still unclear as to why I can not directly edit: body(nsong)[[2]] # Which can be located from a grep: body(nsong)[[grep("fuka",body(nsong))]] # though I believe class(body(nsong)[[2]]) [1] "=" # is trying

[R] robCompositions: Using impCoda

2014-09-22 Thread Rich Shepard
I need to learn how to apply the methods in robCompositions and have read the package docs. Two of my six data sets of proportions contain missing values (not collected or not present); one set has a single missing value, the other has 3 missing values. So my first task is to learn how to proper

Re: [R] Error in quantile.default(resids) : missing values and NaN's not allowed if 'na.rm' is FALSE

2014-09-22 Thread Ben Bolker
Chad Danyluck gmail.com> writes: > > About a year ago I ran some analyses using lmer. The general syntax was: > > mlm <- lmer(var1 ~ (1|dyad) + > var2 + var3*var4*var5, na.action=na.exclude); > summary(mlm) > > The model ran fine and I saved the output. I've recently turned back to > those an

[R] Error in quantile.default(resids) : missing values and NaN's not allowed if 'na.rm' is FALSE

2014-09-22 Thread Chad Danyluck
About a year ago I ran some analyses using lmer. The general syntax was: mlm <- lmer(var1 ~ (1|dyad) + var2 + var3*var4*var5, na.action=na.exclude); summary(mlm) The model ran fine and I saved the output. I've recently turned back to those analyses, however, the model no longer runs. I get the fo

[R] error in rownames

2014-09-22 Thread Chris Jackson-Jordan
Dear fellow R users, I am trying to run the random forest and Yaimpute packages in R to impute a grid to project in a gis. However, after running the imputation I keep getting an error in the rownames. This sounds simple enough, but I cannot figure out what these rownames are reffering to. Any ide

[R] Plotting boundary lines from shapefiles overtop a map of Canada

2014-09-22 Thread Alain Dubreuil
Hi. I have a requirement to plot a series of points on a map of Canada along with boundaries defining search and rescue (SAR) regions. I have been successful in plotting the map of Canada (Lambert projection) and the points, but I have been unable thus far to plot the SAR regions on top of the

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Duncan Murdoch
On 22/09/2014 11:34 AM, Daniel Fuka wrote: Howdy Duncan, Thanks for the quick reply! I must be missing something simple/obvious. I need to have the "sub()" not return quoted and escaped characters to "just edit the language expression". In my problem, there is a function that is supported from

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
Unfortunately in this specific case the owner/maintainer is a complete idiot and a major jerk... he is.. well.. me in this case. But, this is something I have also been wanting to figure out for some time as it is often the case when a quick and simple regex based "patch" to a function can be usefu

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread William Dunlap
If you really want to continue to use the function in the supported package, then you could try asking the maintainer of the package to make the problematic URL an argument to the function. I thnk that changing the function on the fly, no matter how you do it, is likely to cause problems when the

Re: [R] Using read.csv.sql() to read in specific columns

2014-09-22 Thread David Reiner
That seems right to me. You might want to look into a persistent connection as in Example 10 at https://code.google.com/p/sqldf/#Example_10._Persistent_Connections This will save reloading the DB for every query. You might even want to create a permanent DB as in Example 9. This is one of my

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
Howdy Duncan, Thanks for the quick reply! I must be missing something simple/obvious. I need to have the "sub()" not return quoted and escaped characters to "just edit the language expression". In my problem, there is a function that is supported from a different package. So I always want to use

Re: [R] Dynamic regex/sub changes to function

2014-09-22 Thread Duncan Murdoch
On 22/09/2014 9:16 AM, Daniel Fuka wrote: Howdy, I have searched the lists and can not seem to find a solution to my problem. I need to be able to dynamically modify a string inside a function to build a new function. "sub" replaces with a quoted string... and "parse" of "sub" returns expression

Re: [R] A new environment within the main function

2014-09-22 Thread billy am
Hi Everyone , Thanks for the input. On Mon, Sep 22, 2014 at 6:48 AM, David Winsemius wrote: > > On Sep 21, 2014, at 6:06 AM, billy am wrote: > > Hi Everyone , >> >> I am having an issue with the following code and would need kind >> assistant. >> >> For a specific reason , I would need to cr

Re: [R] splm package: Spatial weights matrix of the 103 Italian provinces

2014-09-22 Thread Millo Giovanni
Hello. The row numbers correspond to the standard Istat codes for Italian provinces, 103-version of course. I.e., 1=Torino, 2=Vercelli, ... I am sending you a correspondence table by separate email. Best, Giovanni > Hello, > > I'm using the spatial weights matrix of the 103 Italian provinces > "

[R] Dynamic regex/sub changes to function

2014-09-22 Thread Daniel Fuka
Howdy, I have searched the lists and can not seem to find a solution to my problem. I need to be able to dynamically modify a string inside a function to build a new function. "sub" replaces with a quoted string... and "parse" of "sub" returns expression... How can I get an unquoted string from a

Re: [R] Data frame which includes a non-existent date

2014-09-22 Thread Frank S.
Thanks Richard! [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-gu

[R] Course Lisbon: Introduction to Linear mixed effects models, GLMM and MCMC with R

2014-09-22 Thread Highland Statistics Ltd
Apologies for cross-posting We would like to announce the following statistics course: Course: Introduction to Linear mixed effects models, GLMM and MCMC with R Location: Lisbon, Portugal Date: 9 - 13 February, 2015 Course website: http://www.highstat.com/statscourse.htm Course flyer:

Re: [R] splm package: Spatial weights matrix of the 103 Italian provinces

2014-09-22 Thread Rui Barradas
Hello, I have no knoledge of that package, but you could try rownames(itaww) colnames(itaww) or ask the package maintainer maintainer("splm") Hope this helps, Rui Barradas Em 22-09-2014 10:16, alfonso.carf...@uniparthenope.it escreveu: Hello, I'm using the spatial weights matrix of the 10

Re: [R] apply block of if statements with menu function

2014-09-22 Thread PIKAL Petr
Hi > -Original Message- > From: r...@openmailbox.org [mailto:r...@openmailbox.org] > Sent: Thursday, September 18, 2014 4:35 PM > To: PIKAL Petr > Cc: r-help@r-project.org > Subject: RE: [R] apply block of if statements with menu function > > On 2014-09-16 12:35, PIKAL Petr wrote: > > > >

[R] splm package: Spatial weights matrix of the 103 Italian provinces

2014-09-22 Thread alfonso . carfora
Hello, I'm using the spatial weights matrix of the 103 Italian provinces "itaww" of the package splm example: library(splm) data(itaww) itaww It is a matrix of 103 rows and 103 columns. Each row (and each column) corresponds to an italian province and I would like to know the row's nam