[R] Bar plot in R with more than 2 factors

2014-10-10 Thread Franklin Mairura
Please help, it possible to make an r means barplot in R using base, where there are more than 2 factors and not with lattice, Franklin. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/lis

Re: [R] how to break the loop using sapply?

2014-10-10 Thread PO SU
OK,  it  seems that i misunderstand something,  i forget how and when i pick up the monition in my mind that " as possible as avoid using for loop". TKS for all your suggestions! But i still want the way to break sapply, if not exsits now, create it . such as:  sapply<-function(...){ out<-FA

Re: [R] Bar plot in R with more than 2 factors

2014-10-10 Thread Jim Lemon
On Thu, 9 Oct 2014 11:18:43 PM Franklin Mairura wrote: > Please help, it possible to make an r means barplot in R using base, where > there are more than 2 factors and not with lattice, Franklin. > Hi Franklin, Have a look at the barNest function in the plotrix package. Jim

Re: [R] Changing date format

2014-10-10 Thread PIKAL Petr
Hi But It is not doing what you wanted. It does not extend 365 days year to 366 days. Instead it will incorrectly rename all days after 28th February in non leap years > format(strptime(59, format = "%j"), "%d-%b") [1] "28-II" > format(strptime(60, format = "%j"), "%d-%b") [1] "01-III" > forma

[R] Count number of Fridays in a month

2014-10-10 Thread Abhinaba Roy
Hi R helpers, I want to write a function which will 1. Count the number of fridays in the current month ( to extract month from given date) and also the number of fridays in the preceeding month 2. Calculate the ratio of the number of fridays in current month to the number of fridays in the prec

Re: [R] Count number of Fridays in a month

2014-10-10 Thread Duncan Murdoch
On 10/10/2014, 7:28 AM, Abhinaba Roy wrote: > Hi R helpers, > > I want to write a function which will > > 1. Count the number of fridays in the current month ( to extract month from > given date) and also the number of fridays in the preceeding month > > 2. Calculate the ratio of the number of f

Re: [R] how to break the loop using sapply?

2014-10-10 Thread Jeff Newmiller
Doing as much as possible with vectors instead of loops of a good thing. Fooling yourself that apply functions are vectorized is, well, not a good thing. If you want to write a function to use instead of sapply, fine, but don't call it *apply because those functions always give you one result fo

Re: [R] Count number of Fridays in a month

2014-10-10 Thread Abhinaba Roy
Hi Duncan, I have converted the string to a POSIXIt object using > strptime('31-may-2014',format="%d-%b-%Y") But could not figure out the way forward. Could you please elaborate a bit? On Fri, Oct 10, 2014 at 5:14 PM, Duncan Murdoch wrote: > On 10/10/2014, 7:28 AM, Abhinaba Roy wrote: > > Hi

Re: [R] Count number of Fridays in a month

2014-10-10 Thread Duncan Murdoch
On 10/10/2014 8:10 AM, Abhinaba Roy wrote: Hi Duncan, I have converted the string to a POSIXIt object using > strptime('31-may-2014',format="%d-%b-%Y") But could not figure out the way forward. Could you please elaborate a bit? Try this: ?POSIXlt Duncan Murdoch On Fri, Oct 10, 2014 at

Re: [R] Count number of Fridays in a month

2014-10-10 Thread Barry Rowlingson
Or try this: fridays <- function(the_day){ require(lubridate) day(the_day) = 1 the_month = seq(the_day, the_day+months(1)-days(1),1) sum(wday(the_month) == 6) } That returns the number of Fridays in the month of a Date object given as arg: > fridays(as.Date("2012-01-01")) [1] 4 >

Re: [R] maximum likelihood estimation

2014-10-10 Thread Arne Henningsen
On 10 October 2014 08:04, pari hesabi wrote: > Hello,As an example for Exponential distribution the MLE is got by this > structure:t <- rexp(100, 2)loglik <- function(theta){ log(theta) - theta*t}a > <- maxLik(loglik, start=1)print(a)Exponential distribution has a simple > loglikelihood functio

[R] (no subject)

2014-10-10 Thread Tasnuva Tabassum
I want to get rid of this thread. what to do? [[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-guide.html and

Re: [R] (no subject)

2014-10-10 Thread Sven E. Templer
follow instructions on https://stat.ethz.ch/mailman/listinfo/r-help at "To unsubscribe from R-help, get a password reminder, or change your subscription options enter your subscription email address: " ... On 10 October 2014 16:16, Tasnuva Tabassum wrote: > I want to get rid of this thread. what

Re: [R] Changing date format

2014-10-10 Thread John McKown
On Fri, Oct 10, 2014 at 1:32 AM, Frederic Ntirenganya wrote: Please try to not post in HTML. It is one of the forum "rules". > Dear All, > > The following function gives me what I wanted. > The input of function is one value and this push me to use sapply function > to call it. > > Is there a be

[R] Maximum likelihood Estimation

2014-10-10 Thread Parvin Dehghani
maximum likelihood estimation pari hesabi 6:04 AM To: r-help@r-project.org Hello, As an example for Exponential distribution the MLE is got by this structure: t <- rexp(100, 2) loglik <- function(theta){ log(theta) - theta*t} a <- maxLik(loglik, start=1) print(a) Exponential distribution has

Re: [R] Count number of Fridays

2014-10-10 Thread jim holtman
Here is one way of doing it: > require(lubridate) > now <- as.Date('2014-10-10') # some date > # get first of month > first_mon <- now - day(now) + 1 > # create sequence of days in the month so you can count Fridays > x <- seq(first_mon, by = '1 day', length = days_in_month(first_mon)) > first_f

Re: [R] Count number of Fridays in a month

2014-10-10 Thread Gabor Grothendieck
On Fri, Oct 10, 2014 at 7:28 AM, Abhinaba Roy wrote: > Hi R helpers, > > I want to write a function which will > > 1. Count the number of fridays in the current month ( to extract month from > given date) and also the number of fridays in the preceeding month > > 2. Calculate the ratio of the numb

[R] How to remove the second line generated by addHeader function in the rtf package

2014-10-10 Thread Zhiqiu Hu
Dear friends, The addHeader function in the rtf package always generates two rows of texts even if a subtitle was not specified. Is there any way to stop the function from generating the second blank line? FYI, I cannot use the other functions, such as the addParagram and the addText, because the

Re: [R] Count number of Fridays in a month

2014-10-10 Thread PO SU
In my Impression, there seems  exsits a function (let just call weekday) which can return a POSIXlt format date 's weekday. That means,  weekday( 31-may-2014 ) may return the right weekday maybe 5, so  a clumsy method is start to judge from 1-may-2014 to 31-may-2014 , you get  a vector x, sum(w

[R] errors in initial values in R2winBUGS

2014-10-10 Thread thanoon younis
Dear all R users I am trying to find the bayesian analysis using R2winBUGS but i have errors in initial values with two groups. the R-code #Initial values for the MCMC in WinBUGS init1<-list(uby1=rep(0.0,10),lam1=c(0.0,0.0,0.0,0.0,0.0,0.0), gam1=c(1.0,1.0,1.0,1.0,1.0,1.0),psd1=1.0,phi1=matrix(data

Re: [R] Count number of Fridays

2014-10-10 Thread Abhinaba Roy
Thanks Jim :) Regards Abhinaba On Fri, Oct 10, 2014 at 9:02 PM, jim holtman wrote: > Here is one way of doing it: > > > > require(lubridate) > > now <- as.Date('2014-10-10') # some date > > # get first of month > > first_mon <- now - day(now) + 1 > > # create sequence of days in the month so y

[R] Problem Invoking System Commands from R

2014-10-10 Thread Matt Borkowski
Hello, First please keep in mind I am not a programmer and know very little about R. I am running the 64bit version of R on a Windows 8.1 machine. I am trying to run a script (which I have successfully run in the past) to download some weather data from a NOAA ftp site. When I attempt to run the