Re: [R] Computing growth rate

2016-12-15 Thread PIKAL Petr
Hi Maybe you does not need if or ifelse but just divide by years difference. d2<-ddply(df1,"co_code1",transform, growth=c(NA,exp(diff(log(sales1))/diff(fyear1))- 1)*100) Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Berend >

Re: [R] Computing growth rate

2016-12-15 Thread Brijesh Mishra
Yes, Mr Hasselman. This works like charm now. I also realise where I was making an error. Now I have two very good options to choose from. Spoilt for choices... Many Many Thanks, Brijesh On Thu, Dec 15, 2016 at 7:53 PM, Berend Hasselman wrote: > >> On 15 Dec 2016, at 13:34,

Re: [R] Computing growth rate

2016-12-15 Thread Brijesh Mishra
Dear Mr. Barradas, Thanks a lot for pointing that. I tried that in a few steps- 1. when I evaluated d<-ddply(df1,"co_code1",transform, growth <- ifelse(diff(fyear1)==1, (exp(diff(log(df1$sales1)))-1)*100, NA)) I got the following, i.e., I was not getting the growth column automatically.

Re: [R] Need some help with regular expression

2016-12-15 Thread Steven Nagy
I tried to send this email, but it didn't go through. I guess pictures are not allowed to send through HTML formatted emails? I'm re-sending it again without the picture, just comment there instead as placeholder. Thanks, Steven From: Steven Nagy [mailto:nst...@gmail.com] Sent: Monday,

[R] [R-pkgs] Announcing XGR

2016-12-15 Thread Hai Fang
Dear R users, I am happy to announce that the package 'XGR' (Exploring Genomic Relations available at http://cran.r-project.org/package=XGR) has been on CRAN since this April. Now it gets published in Genome Medicine (see http://dx.doi.org/10.1186/s13073-016-0384-y). Together with its web app,

Re: [R] Computing growth rate

2016-12-15 Thread Brijesh Mishra
Wow, Mr Petr. The placing of diff(fyear1) was very clever indeed. Just to understand the steps intended by you- exp(diff(log(sales1))/diff(fyear1))- 1) = exp(((log(sales1(t)/sales1(t-1)))/(fyear1(t)-fyear(t-1)))-1) = exp(log(sales(t)/sales(t-1))^(1/(delta(fyear1-1 =

Re: [R] Computing growth rate

2016-12-15 Thread Brijesh Mishra
Dear Mr Hasselman, I missed you mail, while I was typing my own mail as a reply to Mr. Barradas suggestion. In fact, I implemented your suggestion even before reading it. But, I have a concern that I have noted (though its only hypothetical- such a scenario is very unlikely to occur). Is there a

Re: [R] Computing growth rate

2016-12-15 Thread Brijesh Mishra
This was ensured while using ddply()... On Thu, Dec 15, 2016 at 6:04 PM, Brijesh Mishra wrote: > Dear Mr Hasselman, > > I missed you mail, while I was typing my own mail as a reply to Mr. > Barradas suggestion. In fact, I implemented your suggestion even > before

Re: [R] WaveletComp with as.POSIXct Showing Error on Date for: 2000-01-01 Format

2016-12-15 Thread MacQueen, Don
Your code is nearly unreadable, probably because you posted in HTML instead of plain text. Plain text is the standard expected on R-help. The only apparent date/time conversion in your code is the use of as.POSIXct(). You are missing a closing quote mark after the date. If I fix that, then on

Re: [R] Need some help with regular expression

2016-12-15 Thread Jeff Newmiller
Actually, the issue of mail formatting is discussed in the Posting Guide, but some key points are: 1) Only a very few types of file attachments are allowed. 2) email processed through the mailing list automatically strips HTML, which often leaves us looking at something full of wacko

Re: [R] data manipulation

2016-12-15 Thread John Kane via R-help
It downloaded a file for me earlier but I am not getting the 404 error and I did not bother to save the download.  Shrug. On Wednesday, December 14, 2016 6:57 AM, John Kane via R-help wrote: xx <- read.csv("http://massey.ac.nz/~pscoperwait/ts/cbe.dat;) gives me

Re: [R] ggplot aestetics: beginner question - I am lost in endless possibilites

2016-12-15 Thread John Kane via R-help
I cannot see how you get that code to run. It certainly does not on my machine and some of the manipulations don't make any sense as far as I can see. I changed variable and data.frame names so I would not have to type so much and read in the data with the "stringsAsFactors = FALSE" option. I

Re: [R] ggplot aestetics: beginner question - I am lost in endless possibilites

2016-12-15 Thread Hadley Wickham
You are going to find your life much easier if you: * Organise your code so it's easier to read * Use a consistent naming scheme for your variables * Learn a bit more about how to modify variables succintly Here's my rewriting of your script to make it easier to see what's going on.

Re: [R] data manipulation

2016-12-15 Thread John Kane via R-help
That should read "now" instead of "not" On Thursday, December 15, 2016 6:49 PM, John Kane wrote: It downloaded a file for me earlier but I am not getting the 404 error and I did not bother to save the download.  Shrug. On Wednesday, December 14, 2016 6:57

Re: [R] Need some help with regular expression

2016-12-15 Thread David Winsemius
> On Dec 15, 2016, at 8:46 AM, Steven Nagy wrote: > > I tried to send this email, but it didn't go through. I guess pictures are > not allowed to send through HTML formatted emails? > I'm re-sending it again without the picture, just comment there instead as > placeholder. >

Re: [R] how to show a plot without overlaying the text on top of the another text?

2016-12-15 Thread Greg Snow
Some tools that might help include spread.labels from the plotrix package, spread.labs from the TeachingDemos package, and dynIdentify/TkIdentify from the TeachingDemos package. On Tue, Dec 13, 2016 at 4:37 PM, Marna Wagley wrote: > Hi R user, > I have created using

Re: [R] Merging two columns of unequal length

2016-12-15 Thread Jim Lemon
Hi Bailey, I may be misunderstanding what you are doing as I can't work out how you get unequal column lengths, but this may help: myval<-matrix(sample(1:365,740,TRUE),ncol=74) mydata<-as.data.frame(cbind(1950:1959,myval)) lakenames<-paste(rep(LETTERS[1:26],length.out=74),

Re: [R] how to show a plot without overlaying the text on top of the another text?

2016-12-15 Thread Jim Lemon
Hi Marna, After a bit of experimenting I came up with the following function that "flags" each point to be labeled an allows the operator to manually place the label for that point: placeLabels<-function(x,y,labels,pointer=TRUE,cex=1,labelcol=par("fg"),

Re: [R] problem installing Rmpi

2016-12-15 Thread Erin Hodgess
At the risk of sounding simplistic, do you have MPI installed, please? On Thu, Dec 15, 2016 at 2:08 AM, Jim Maas wrote: > Can anyone tell me to start looking to fix this, when attempting to install > Rmpi on Ubuntu 16.04, just updated R version to 3.3.2 > > > ** building

Re: [R] ggplot aestetics: beginner question - I am lost in endless possibilites

2016-12-15 Thread Thierry Onkelinx
Here is a solution ggplot(exdatframe2) + geom_tile(aes(x = exdatframeT, y = Name, fill = knownstate), colour = "black", height = 0.5) + scale_fill_discrete(na.value = "white") Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and

Re: [R] Computing growth rate

2016-12-15 Thread Rui Barradas
Hello, That is a very common mistake. if() accepts only one TRUE/FALSE, for a vectorized version you need ?ifelse. Something like the following (untested). growth <- ifelse(diff(fyear1)==1, (exp(diff(log(df1$sales1)))-1)*100, NA) Hope this helps, Rui Barradas Em 15-12-2016 03:40, Brijesh

Re: [R] R studio Problem

2016-12-15 Thread Amelia Marsh via R-help
Thanks a lot Kimmo for your valuable guidance. Hope it works. Regards Amelia On Thursday, 15 December 2016 12:06 PM, K. Elo wrote: Hi! Maybe this helps: http://r.789695.n4.nabble.com/Error-in-normalizePath-path-with-McAfee-td2532324.html Best, Kimmo 15.12.2016,

[R] problem installing Rmpi

2016-12-15 Thread Jim Maas
Can anyone tell me to start looking to fix this, when attempting to install Rmpi on Ubuntu 16.04, just updated R version to 3.3.2 ** building package indices ** testing if installed package can be loaded Error in system2(file.path(R.home("bin"), "R"), c(if (nzchar(arch)) paste0("--arch=", :

Re: [R] R studio Problem

2016-12-15 Thread Martin Maechler
> Amelia Marsh via R-help > on Thu, 15 Dec 2016 08:05:44 + writes: > Sorry Mr Gunter. I didn't realize it. > Regards > Amelia In this case, however, it was only the 'Subject' of Amelia's posting and her own "feeling about" the problem which

Re: [R] R studio Problem

2016-12-15 Thread Amelia Marsh via R-help
Sorry Mr Gunter. I didn't realize it. Regards Amelia On Thursday, 15 December 2016 12:39 PM, Bert Gunter wrote: You may get a reply here, but this is the wrong place for you to post. RStudio is a separate commercial entity and product from the noncommercial R

[R] ggplot aestetics: beginner question - I am lost in endless possibilites

2016-12-15 Thread Dagmar
# Dear all, # I hope someone can help me with this. I am so lost and can't find a solution even though I spent hours on searching for a solution of that tiny problem. # Maybe someone of you could give me hint? #This is my string: exdatframe <- data.frame(Name=c("Ernie","Ernie","Ernie",

Re: [R] R studio Problem

2016-12-15 Thread Amelia Marsh via R-help
Dear Mr Martin, Thanks a lot for this much needed insight. Unfortunately even though my system admin has uninstalled McAfee from my laptop, however, the same problem still exists. After uninstalling MCafee, I have reinstalled Rstudio but of no use. As Mr Gunter has suggested, trying to take

Re: [R] Computing growth rate

2016-12-15 Thread Berend Hasselman
> On 15 Dec 2016, at 04:40, Brijesh Mishra wrote: > > Hi, > > I am trying to calculate growth rate (say, sales, though it is to be > computed for many variables) in a panel data set. Problem is that I > have missing data for many firms for many years. To put it

Re: [R] Computing growth rate

2016-12-15 Thread Berend Hasselman
> On 15 Dec 2016, at 13:34, Brijesh Mishra wrote: > > Dear Mr Hasselman, > > I missed you mail, while I was typing my own mail as a reply to Mr. > Barradas suggestion. In fact, I implemented your suggestion even > before reading it. But, I have a concern that I have

Re: [R] Computing growth rate

2016-12-15 Thread David Stevens
Berend - Unless you need the change in sales year by year, you might consider looking at each company's sales over the years and use regression or other type of trend analysis to get an overall trend... Or, if not, simply divide diff(sales) by diff(fyear1) for each company so at least you get