Re: [R] Data formart

2014-10-09 Thread Frederic Ntirenganya
Hi Amos, This approach gives a column of NA. On Wed, Oct 8, 2014 at 10:20 PM, Amos B. Elberg wrote: > You can adapt: format(as.Date(paste(Year, sep = "-", ifelse(Year %% 4 == > 0, Start, ifelse(Start > 59, Start - 1, Start))), "%Y-%j"), "%b %d”) > > But 60% of the dates in your data.frame wil

Re: [R] Identifying Values in Dataframe

2014-10-09 Thread PIKAL Petr
Hi Hm. You get row and column number by which. So if you want names why not just use rownames or colnames. Something like rownames(data)[sel[,1]] colnames(data)[sel[,2]] shal give you appropriate row and column names. Regards Petr From: Patzelt, Edward [mailto:patz...@g.harvard.edu] Sent: Mon

Re: [R] Data formart

2014-10-09 Thread Amos B. Elberg
The code changes a single row; that's why I said you'd have to adapt it to your application. > On Oct 9, 2014, at 3:10 AM, Frederic Ntirenganya wrote: > > Hi Amos, > > This approach gives a column of NA. > >> On Wed, Oct 8, 2014 at 10:20 PM, Amos B. Elberg >> wrote: >> You can adapt: f

[R] Gaussian mixture model based clustering

2014-10-09 Thread Alexandra Posekany
Hey everybody, I am looking for a R implementation of uni- and multivariate GMM clustering which is both fast and can provide me with estimates of the respective components' means and covariance matrices, not just the observations' labels for the components which I am not interested in. As it is me

Re: [R] Changing date format

2014-10-09 Thread Jim Lemon
On Wed, 8 Oct 2014 04:49:02 PM Frederic Ntirenganya wrote: > The idea is that I want the non-leap years to be 366 days instead of being > 365 days. ie. Each year must have 366 days. > > for example: in the column Start2, Apr 18 will be Apr 17. > > > head(Samaru) > > Year Start End Length Star

Re: [R] How can I overwrite a method in R?

2014-10-09 Thread Duncan Murdoch
On 09/10/2014, 2:14 AM, Tim Hesterberg wrote: > How can I create an improved version of a method in R, and have it be used? > > Short version: > I think plot.histogram has a bug, and I'd like to try a version with a fix. > But when I call hist(), my fixed version doesn't get used. To be clear, we

Re: [R] Changing date format

2014-10-09 Thread Frederic Ntirenganya
Hi Lemon, I am using the code you sent. It's correct for the leap years. What I want to do is to have both leap and no-leap years to have 366 days. that means the 1st March is day 61 of each year. This will help me to link it with Instat for climatic data analysis. On Thu, Oct 9, 2014 at 11:54 A

Re: [R] Changing date format

2014-10-09 Thread Jim Lemon
On Thu, 9 Oct 2014 12:30:57 PM Frederic Ntirenganya wrote: > Hi Lemon, > > I am using the code you sent. It's correct for the leap years. > What I want to do is to have both leap and no-leap years to have 366 days. > that means the 1st March is day 61 of each year. > This will help me to link it

[R] Event after a package is loaded

2014-10-09 Thread marcel Austenfeld
Hello, i would like to call a self defined R function after a package (not a specific one - library (anyAvailablePackage)) has been loaded into the R environment. I there a general method available in R which can be used for that? Any help is appreciated.   _

Re: [R] Changing date format

2014-10-09 Thread Frederic Ntirenganya
This idea substract 1 for the all column which is not what i want. We know that the leap years have 366 days. I don't need to change anything on them the non-leap years have 365 days. This is what i want to change to be 366 days rather than 365 days. On Thu, Oct 9, 2014 at 1:07 PM, Jim Lemon wr

Re: [R] Event after a package is loaded

2014-10-09 Thread Duncan Murdoch
On 09/10/2014, 6:53 AM, marcel Austenfeld wrote: > Hello, > > i would like to call a self defined R function after a package (not a > specific one - library (anyAvailablePackage)) has been loaded into the R > environment. > I there a general method available in R which can be used for that? No,

Re: [R] Event after a package is loaded

2014-10-09 Thread Frederic Ntirenganya
I don't think the is an appropriate option for that. On Thu, Oct 9, 2014 at 2:32 PM, Duncan Murdoch wrote: > On 09/10/2014, 6:53 AM, marcel Austenfeld wrote: > > Hello, > > > > i would like to call a self defined R function after a package (not a > specific one - library (anyAvailablePackage)) h

Re: [R] How can I overwrite a method in R?

2014-10-09 Thread Hadley Wickham
This is usually ill-advised, but I think it's the right solution for your problem: assignInNamespace("plot.histogram", function(...) plot(1:10), "graphics") hist(1:10) Haley On Thu, Oct 9, 2014 at 1:14 AM, Tim Hesterberg wrote: > How can I create an improved version of a method in R, and have i

Re: [R] Event after a package is loaded

2014-10-09 Thread marcel Austenfeld
Thank you for the fast reply! Best regards Marcel   Gesendet: Donnerstag, 09. Oktober 2014 um 13:54 Uhr Von: "Frederic Ntirenganya" An: "Duncan Murdoch" Cc: "marcel Austenfeld" , r-help@r-project.org Betreff: Re: [R] Event after a package is loaded I don't think the is an appropriate option f

Re: [R] Changing date format

2014-10-09 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Frederic Ntirenganya > Sent: Thursday, October 09, 2014 1:32 PM > To: Jim Lemon > Cc: r-help@r-project.org > Subject: Re: [R] Changing date format > > This idea substract 1 fo

Re: [R] Changing date format

2014-10-09 Thread Frederic Ntirenganya
Hi Pikal, I am not talking about changing calender, I need this in my analysis. On Thu, Oct 9, 2014 at 3:27 PM, PIKAL Petr wrote: > Hi > > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > > project.org] On Behalf Of Frederic Ntirenganya > > Sent: T

Re: [R] Changing date format

2014-10-09 Thread Duncan Murdoch
On 09/10/2014, 8:27 AM, PIKAL Petr wrote: > Hi > >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >> project.org] On Behalf Of Frederic Ntirenganya >> Sent: Thursday, October 09, 2014 1:32 PM >> To: Jim Lemon >> Cc: r-help@r-project.org >> Subject: Re:

Re: [R] maximum likelihood estimation

2014-10-09 Thread Arne Henningsen
Dear Pari On 7 October 2014 10:55, pari hesabi wrote: > HelloI am trying to estimate the parameter of a function by the Maximum > Likelihood Estimation method.If the function is the difference between two > integrals: C<-function(n){integrand3<-function(x) {((2-x)^n)*(exp(ax-2))}cc<- > integr

[R] Bug in myintegrate in Elliptic package

2014-10-09 Thread Luis Felipe Parra
Hello, I was using my integrate today and spend a couple of hours trying to figure out why I was getting some weird results in my code when using myintegrate function to do complex integration, after some time decided just to change the name of the integration dummy variable in the code from 'x' t

Re: [R] cbind in a loop...better way? | summary

2014-10-09 Thread Evan Cooch
Two solutions proposed -- not entirely orthogonal, but both do the trick. Instead of nesting cbin in a loop (as I did originally -- OP, below), 1\ do.call(cbind, lapply(mat_list, as.vector)) or 2\ sapply(mat_list,function(x) as.vector(x)) Both work fine. Thanks to Jeff Laake (2) + David

Re: [R] reading in hexadecimal data - not working with data ending in E

2014-10-09 Thread mark . hogue
Thanks to all for your help. The colClasses option did do the trick. [[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.o

[R] [vegan] Error in as.vector(x, mode) : , cannot coerce type 'builtin' to vector of type 'any' when performing anova on CCA objects

2014-10-09 Thread Tim Richter-Heitmann
Hi there, i have three dataframes, which have the same structure (data.frame, 358 observations of 340 variables, every column is "num"eric), and are basically submatrices of a parental dataset. I can perform a CCA on all of them (with the explanatory dataset being "abio") /cca1_ab <- cca(df1~

[R] Remove from the mailing list

2014-10-09 Thread nabila kazmi
Hi there, Please can you remove me from the mailing list, I keep getting the conversations which are of no use to me. BestKazmi [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-hel

Re: [R] How can I overwrite a method in R?

2014-10-09 Thread C Lin
I posted similar question a while ago. Search for "modify function in a package". In your case, the following should work. source('plot.histogram.R') assignInNamespace('plot.histogram',plot.histogram,ns='graphics') environment(plot.histogram) <- asNamespace('graphics'); Assuming you have your ow

Re: [R] Gaussian mixture model based clustering

2014-10-09 Thread Ranjan Maitra
There are lots! eg: Mclust or EMCluster and many more. Ranjan On Thu, 9 Oct 2014 10:37:45 +0200 Alexandra Posekany wrote: > Hey everybody, > I am looking for a R implementation of uni- and multivariate GMM clustering > which is both fast and can provide me with estimates of the respective > co

[R] jitter function when length(x) = 1

2014-10-09 Thread Ingrid Charvet
Hello, A quick question relating to the documentation of the jitter function: http://127.0.0.1:15714/library/base/html/jitter.html jitter(x, factor = 1, amount = NULL) "If amount is NULL (default), we set a <- factor * d/5 where d is the smallest difference between adjacent unique (apart from f

Re: [R] jitter function when length(x) = 1

2014-10-09 Thread Rui Barradas
Hello, You can see the code for jitter by typing its name at the prompt. Inline. Em 09-10-2014 18:19, Ingrid Charvet escreveu: Hello, A quick question relating to the documentation of the jitter function: http://127.0.0.1:15714/library/base/html/jitter.html jitter(x, factor = 1, amount = NULL

Re: [R] jitter function when length(x) = 1

2014-10-09 Thread David Winsemius
On Oct 9, 2014, at 10:19 AM, Ingrid Charvet wrote: > Hello, > > A quick question relating to the documentation of the jitter function: > http://127.0.0.1:15714/library/base/html/jitter.html > > jitter(x, factor = 1, amount = NULL) > > "If amount is NULL (default), we set a <- factor * d/5 wher

Re: [R] cbind in a loop...better way? | summary

2014-10-09 Thread David L Carlson
Actually Jeff Laake's can be made even shorter with sapply(mat_list, as.vector) David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Evan Cooch Sent: Thursday, October 9, 2014 7:37 AM To: Evan Cooch; r-help@r-project.org Subjec

Re: [R] cbind in a loop...better way? | summary

2014-10-09 Thread Wensui Liu
How about foreach() run in parallel? On Oct 9, 2014 1:54 PM, "David L Carlson" wrote: > Actually Jeff Laake's can be made even shorter with > > sapply(mat_list, as.vector) > > David C > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Be

Re: [R] cbind in a loop...better way? | summary

2014-10-09 Thread Evan Cooch
Thanks! On 10/9/2014 1:52 PM, David L Carlson wrote: Actually Jeff Laake's can be made even shorter with sapply(mat_list, as.vector) David C -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Evan Cooch Sent: Thursday, October 9,

[R] Windows RT

2014-10-09 Thread Ivania Andrade
Hello, I have a 32 GB Surface Windows RT and I am trying to download R, but it's not letting me. Is there a certain way I am suppose to download it? Thank you for any help you may provide. Ivania Andrade [[alternative HTML version deleted]] __

[R] Odd error from mvrnorm?

2014-10-09 Thread John Hodgson
I have tried to generate multivariate normal samples with the following means and co-variances > mu [1] 1.4696642 6.3169666 -3.8702044 0.8411024 -2.6525455 6.1894152 > Sigma [,1] [,2] [,3] [,4] [,5][,6] [1,] 0.00015768570 0.002258112 -0.00

Re: [R] Windows RT

2014-10-09 Thread Jeff Newmiller
That is a baffling description. I don't see how what "something" does to prevent you from transferring a file is related to R. That said, installing could be a problem ... or not. --- Jeff NewmillerTh

Re: [R] Windows RT

2014-10-09 Thread Duncan Murdoch
On 09/10/2014, 12:38 PM, Ivania Andrade wrote: > Hello, > > I have a 32 GB Surface Windows RT and I am trying to download R, but it's > not letting me. Is there a certain way I am suppose to download it? Thank > you for any help you may provide. There's nothing really special about downloading R,

Re: [R] Odd error from mvrnorm?

2014-10-09 Thread peter dalgaard
On 09 Oct 2014, at 18:43 , John Hodgson wrote: > I have tried to generate multivariate normal samples with the following means > and co-variances > > > mu > [1] 1.4696642 6.3169666 -3.8702044 0.8411024 -2.6525455 6.1894152 > > Sigma > [,1] [,2] [,3] [,4]

Re: [R] Windows RT

2014-10-09 Thread David Winsemius
On Oct 9, 2014, at 1:24 PM, Duncan Murdoch wrote: > On 09/10/2014, 12:38 PM, Ivania Andrade wrote: >> Hello, >> >> I have a 32 GB Surface Windows RT and I am trying to download R, but it's >> not letting me. Is there a certain way I am suppose to download it? Thank >> you for any help you may pr

Re: [R] Bug in myintegrate in Elliptic package

2014-10-09 Thread Rolf Turner
(1) The example is not reproducible since we don't have "psi" or know what it is. (2) The package is called "elliptic" *NOT* "Elliptic". The R language (unlike Micro$oft crap) is case sensitive. (3) The code was given in a chaotic manner, making it impossible to copy and paste it into an

[R] agricolae package: doubt about test used in kruskal and order.group function

2014-10-09 Thread Jose Claudio Faria
Hello, Does anyone know which comparison test is applied in the function order.group of the package agricolae? The test is not documented nor in kruskal function or order.group (called by kruskal function). Thanks in advance, ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ Jose Claudio Faria Es

Re: [R] How can I overwrite a method in R?

2014-10-09 Thread Tim Hesterberg
Thank you Duncan, Brian, Hadley, and Lin. In Lin's suggestion, I believe the latter two statements should be reversed, so that the environment is added before the function is placed into the graphics namespace. source('plot.histogram.R') environment(plot.histogram) <- asNamespace('graphics') assi

[R] how to break the loop using sapply?

2014-10-09 Thread PO SU
Dear expeRts,    i  use sapply for loop, and i want to break it when i needed, how to do that?  e.g. sapply( 1:10, function(i) { if(i==5) break and jump out of the function sapply } ) I want to do it because i have to loop 100 times, but i don't know when it will break, that means, it may

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

2014-10-09 Thread Jeff Newmiller
Don't use apply functions if you want to do what you describe. They don't work that way. Use a while control structure. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#.

[R] maximum likelihood estimation

2014-10-09 Thread pari hesabi
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 function. But if a new pdf has a more complicated form like

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

2014-10-09 Thread PO SU
Is that mean while may be more effient than  for in R? as i know, while and for  are all just functions in R. Tks for your suggestion to not use apply that way, but i want to know, if possible, is there any way to break it ? Actually, there is a additional question:   x<- c(3,4,5,6,9)  sapply(

Re: [R] Changing date format

2014-10-09 Thread Frederic Ntirenganya
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 better way of doing this? # day <- function(x){ if(x== 60) { y =

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

2014-10-09 Thread Jeff Newmiller
Is it possible to break it? I already told you that... NO. Also your mention of efficiency is not relevant. Keep in mind that apply functions are not significantly faster than for loops or while loops. They are just compact ways to express your intent. Usually people having speed problems with f

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

2014-10-09 Thread Hervé Pagès
Hi, On 10/09/2014 11:12 PM, PO SU wrote: Is that mean while may be more effient than for in R? as i know, while and for are all just functions in R. Tks for your suggestion to not use apply that way, but i want to know, if possible, is there any way to break it ? As Jeff said, you cannot