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, Brije

Re: [R] Computing growth rate

2016-12-15 Thread Brijesh Mishra
R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Berend >> Hasselman >> Sent: Thursday, December 15, 2016 1:18 PM >> To: Brijesh Mishra >> Cc: r-help mailing list >> Subject: Re: [R] Computing growth rate >> >> >> > On 15 Dec 2016, at

Re: [R] Computing growth rate

2016-12-15 Thread Brijesh Mishra
rsion 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 Mishra escreveu: >> >> Hi, >&g

Re: [R] Computing growth rate

2016-12-15 Thread Brijesh Mishra
way to restrict such calculations co_code1 wise? Many thanks, Brijesh On Thu, Dec 15, 2016 at 5:48 PM, Berend Hasselman wrote: > >> On 15 Dec 2016, at 04:40, Brijesh Mishra wrote: >> >> Hi, >> >> I am trying to calculate growth rate (say, sales, though it is to

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 reading it

[R] Computing growth rate

2016-12-14 Thread Brijesh Mishra
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 simply, I have created this short dataframe (original df id much bigger) df1<-data.frame(co_code1

Re: [R] Frequency of a character in a string

2016-11-14 Thread Brijesh Mishra
?nchar in the base R should also help... On Mon, Nov 14, 2016 at 2:26 PM, Ismail SEZEN wrote: > > > On 14 Nov 2016, at 11:44, Ferri Leberl wrote: > > > > > > Dear All, > > Is there a function to count the occurences of a certain character in a > string resp. in a vector of strings? > > Thank yo