Re: [R] Creating "Envelope" around a plot

2015-11-02 Thread WRAY NICHOLAS
Hi Dennis thanks, but I'd already tried something like this -- the dashed lines are parallel to the original plot vector, and not at a fixed maximal distance to the original vector, where for example they would have curves around the peaks. The boundary line points would only be parallel to the

[R] Fwd: Re: Creating "Envelope" around a plot

2015-11-02 Thread WRAY NICHOLAS
> -- Original Message -- > From: WRAY NICHOLAS > To: Duncan Murdoch , r-help > > Date: at > Subject: Re: [R] Creating "Envelope" around a plot > > > Hi Dennis again, I see what

Re: [R] Creating "Envelope" around a plot

2015-11-02 Thread Duncan Murdoch
On 02/11/2015 7:33 AM, WRAY NICHOLAS wrote: Hi I am plotting various strands of information, and I want to create an "envelope" around each line, so that the locus of the envelope is the boundary points no more than a fixed maximum distance from the plotted line, a bit like drawing a larger

Re: [R] Fwd: Re: Creating "Envelope" around a plot

2015-11-02 Thread William Dunlap
Instead of computing the envelopes (of various radii) of paths and seeing if they intersect you could compute distances between paths and seeing if they are smaller than a given distance. Computing the distance between 2 polylines is not difficult, although computing it quickly for very long

[R] dplyr instead of plyr: Help

2015-11-02 Thread Axel Urbiz
Sorry, this is *related* to a recent post, but not the same. I'd appreciate your help in getting the same results with the two methods below (the first using plyr and the second using dplyr. The former works, but not the latter.) ### Sample data set.seed(4) df <- data.frame(pred = rnorm(100),

[R] Locating the starting position of the first number in a string

2015-11-02 Thread Jennifer Sabatier
Hi, So, I've got a vector of strings that look like this: ID <- c("IBBS3_MSM_HN01209","IBBS3_MSM_HN01210","IBBS3_MSM_HN01211", "IBBS3_MSM_HN10212","IBBS3_MSM_HN104213","IBBS3_MSM_HN10214", "IBBS3_MSM_HN44215","IBBS3_MSM_HN44216","IBBS3_MSM_HN44217",

Re: [R] Fwd: Re: Creating "Envelope" around a plot

2015-11-02 Thread William Dunlap
> summing the Euclidean distances between points in the strands > ... if two one strand lies within the "envelope" of another I can set them together Use the max instead of the sum. Bill Dunlap TIBCO Software wdunlap tibco.com On Mon, Nov 2, 2015 at 9:29 AM, WRAY NICHOLAS

Re: [R] Locating the starting position of the first number in a string

2015-11-02 Thread Peter Alspach
Tena koe Jen Not answering your question: if you are after these locations in order to split the IDs in columns, then you might like to consider strsplit; e.g., t(sapply(strsplit(ID, '_'), rbind)) You could then split the last column. You state that there is a 5-digit number at the end. If

Re: [R] Fwd: Re: Creating "Envelope" around a plot

2015-11-02 Thread WRAY NICHOLAS
Hi Bill I have been doing exactly that, ie summing the Euclidean distances between points in the strands Although with small sets of strands this technique allows me to group the strands into various sets, which I can assume are the same, unfortunately once I have a larger number of strands the

[R] Error survreg: Density function returned an invalid matrix

2015-11-02 Thread Israel Ortiz
Hi, I want to perform a survival analysis using survreg procedure from survival library in R for a pareto distribution for a time variable, so I set the new distribution using the following sintax: library(foreign) library(survival) library(VGAM) mypareto <- list(name='Pareto',

[R] estimate reliability and hazard using MOM and Baysian methods

2015-11-02 Thread hms Dreams
Hi, I estimate 3 paramters using MOM and Bayesian methods How can I estimate the reliability(R) and hazard(h) functions?? Is it correct if I estimated R and h like MLE by substitute the estimators and put any value for x in the formula of R and h?? I need help please thank you noor

Re: [R] Locating the starting position of the first number in a string

2015-11-02 Thread Jeff Newmiller
Also not answering your question directly, but may be provide some useful ideas or results: library( gsubfn ) DF <- setNames( data.frame( t( strapply( ID +, "^[^_]+_([A-Z]+)_([A-Z]+)([0-9]+)$" +, c +

[R] replace NA's with row means for specific columns

2015-11-02 Thread Zahra via R-help
Hi there, I am looking for some help replacing missing values in R with the row mean. This is survey data and I am trying to impute values for missing variables in each set of questions separately using the mean of the scores for the other questions within that set. I have a dataset that

Re: [R] estimate reliability and hazard using MOM and Baysian methods

2015-11-02 Thread Bert Gunter
I suggest you seek local assistance. I find your question to be completely incoherent (perhaps others will do better). You also seem to be pretty ignorant of basic statistics. Apologies if I have misunderstood, but if I am close to right in these matters, you will need to find local help, as

Re: [R] What happened to Canada?

2015-11-02 Thread Rolf Turner
On 03/11/15 01:41, Marc Schwartz wrote: On Nov 2, 2015, at 6:00 AM, John Kane wrote: A rather silly question but I went to install a new package this morning and as usual a list of CRAN mirrors appeared but the Canadian ones had disappeared. Is this some peculiarity

Re: [R] What happened to Canada?

2015-11-02 Thread Marc Schwartz
Hi Rolf, See below. > On Nov 2, 2015, at 5:40 PM, Rolf Turner wrote: > > > Thanks for the reply, Marc. > > On 03/11/15 12:09, Marc Schwartz wrote: > > > >> >> Rolf, >> >> What do: >> >> getOption("CRAN") >> >> getOption("repos") >> >> show? > > The

Re: [R] Locating the starting position of the first number in a string

2015-11-02 Thread Boris Steipe
The regular expression you are looking for is \d{5} ... a "digit" repeated five times. Note that you have to escape the escape in an R string. But your example does not conform to the description: you have examples with six digit numbers: IBBS3_MSM_HN104213. If there is length variation, I

Re: [R] replace NA's with row means for specific columns

2015-11-02 Thread Jim Lemon
Hi Zahra, I can't think of an "apply" function that will do this, but: Zdf<-read.table(text="ID A1 A2 A3 B1 B2 B3 C1 C2 C3 C4 b 4 5 NA2 NA 4 5 13 NA c 4 5 1 NA 34 5 13 2

Re: [R] What happened to Canada?

2015-11-02 Thread Rolf Turner
Thanks for the reply, Marc. On 03/11/15 12:09, Marc Schwartz wrote: Rolf, What do: getOption("CRAN") getOption("repos") show? The first shows "NULL", the second shows "http://cran.stat.auckland.ac.nz; Is there any chance that you have something set in ~/.Rprofile

Re: [R] What happened to Canada?

2015-11-02 Thread Morgan, Martin
The first error, about 'unsupported scheme' is saying that you (your R) does not have SSL support (as you tracked down, the problem is trying to read the online repositories using https://, and the 'unsupported scheme' is https). The code then goes on and uses the snapshot of mirrors available

Re: [R] What happened to Canada?

2015-11-02 Thread Marc Schwartz
> On Nov 2, 2015, at 4:36 PM, Rolf Turner wrote: > > > On 03/11/15 01:41, Marc Schwartz wrote: > >> >>> On Nov 2, 2015, at 6:00 AM, John Kane wrote: >>> >>> A rather silly question but I went to install a new package this >>> morning and as

Re: [R] replace NA's with row means for specific columns

2015-11-02 Thread Jim Lemon
Hi again, Small typo in line 5 - should be replace_NAs<-function(x,group_lab=c("A","B","C")) { for(lab in group_lab) { indices<-grep(lab,names(x),fixed=TRUE) na_indices<-is.na(x[indices]) if(any(na_indices)) x[indices][na_indices]<-rowMeans(x[indices],na.rm=TRUE) } return(x) } Jim

Re: [R] Fixed effects estimators doesn't drop or omit

2015-11-02 Thread John Kane
Hi Alex, Welcome to the R-help list. This is of no help with your question but a general suggestion. Including your code was great but it probably would help if you also included some sample data. The best way to supply data is to use dput(). See ?dput or have a look

Re: [R] What happened to Canada?

2015-11-02 Thread Rolf Turner
Thanks Martin. This is illuminating. On 03/11/15 12:30, Morgan, Martin wrote: The first error, about 'unsupported scheme' is saying that you (your R) does not have SSL support (as you tracked down, the problem is trying to read the online repositories using https://, and the 'unsupported

Re: [R] User-defined functions in dplyr

2015-11-02 Thread Axel Urbiz
Actually, the results are not the same. Looks like in the code below (see "using dplyr”), the function create_bins2 is not being applied separately to each "group_by" variable. That is surprising to me, or I'm misunderstanding dplyr. ### Create some data set.seed(4) df <- data.frame(pred =

[R] What happened to Canada?

2015-11-02 Thread John Kane
A rather silly question but I went to install a new package this morning and as usual a list of CRAN mirrors appeared but the Canadian ones had disappeared. Is this some peculiarity of my system (Ubuntu 14.10 with R version 3.2.2) or a new policy for R? John Kane Kingston ON Canada

[R] dplyr instead of plyr: Help

2015-11-02 Thread Axel Urbiz
Sorry, this is *related* to a recent post, but not the same. I'd appreciate your help in getting the same results with the two methods below (the first using plyr and the second using dplyr. The former works, but not the latter.) ### Sample data set.seed(4)df <- data.frame(pred = rnorm(100), y =

Re: [R] dplyr instead of plyr: Help

2015-11-02 Thread Thierry Onkelinx
Please don't post in HTML. It makes your code unreadable. ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie & Kwaliteitszorg / team Biometrics & Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium To call in the

[R] Creating "Envelope" around a plot

2015-11-02 Thread WRAY NICHOLAS
Hi I am plotting various strands of information, and I want to create an "envelope" around each line, so that the locus of the envelope is the boundary points no more than a fixed maximum distance from the plotted line, a bit like drawing a larger rectangle with paralle sides and curved compass

Re: [R] What happened to Canada?

2015-11-02 Thread Marc Schwartz
> On Nov 2, 2015, at 6:00 AM, John Kane wrote: > > A rather silly question but I went to install a new package this morning and > as usual a list of CRAN mirrors appeared but the Canadian ones had > disappeared. > > Is this some peculiarity of my system (Ubuntu 14.10

Re: [R] Fwd: Re: Creating "Envelope" around a plot

2015-11-02 Thread Jim Lemon
Hi Nick, I don't think it will do all that you have described, but the "dispersion" function in the plotrix package will draw an "envelope" around a line if you specify type="l" and fill=. If you pass ulim=, the "envelope" will extend that far from the original line. See the second example on the

Re: [R] What happened to Canada?

2015-11-02 Thread Rolf Turner
On 03/11/15 12:52, Marc Schwartz wrote: Hi Rolf, See below. Martin Morgan's reply seems like it is on point. Indeed. The problem arises from a lack of "libcurl" capabilities. I would follow his logic regarding libcurl and https support, but it would be helpful to know how you

Re: [R] User-defined functions in dplyr

2015-11-02 Thread William Dunlap
dplyr::mutate does not collapse factor variables well. They seem to get their levels from the levels computed for the first group and mutate does not check for them having different levels. > data.frame(group=rep(c("A","B","C"),each=2), value=rep(c("X","Y","Z"),3:1)) %>% dplyr::group_by(group)

Re: [R] User-defined functions in dplyr

2015-11-02 Thread Axel Urbiz
Nice example of the issue Bill. Thank you. Is this a known issue? Plans to be fixed? Thanks again, Axel. > On Nov 2, 2015, at 8:58 PM, William Dunlap wrote: > > dplyr::mutate does not collapse factor variables well. They seem to get > their levels from the levels >