Re: [R] Method Guidance

2022-01-14 Thread Leonard Mada via R-help
Dear Jeff, I am sending an updated version of the code. The initial version assumed that the time points correspond to an integer sequence. The code would fail for arbitrary times. The new code is robust. I still assume that the data is in column-format and that you want the time to the p

Re: [R] Method Guidance

2022-01-13 Thread Bill Dunlap
Suppose your data were represented as parallel vectors "time" and "type", meaning that at time[i] a type[i] event occurred. You didn't say what you wanted if there were a run of "A" or "B". If you are looking for the time span between the last of a run of one sort of event and the first of a run

Re: [R] Method Guidance

2022-01-13 Thread Leonard Mada via R-help
Dear Jeff, My answer is a little bit late, but I hope it helps. jrdf = read.table(text="Time Event_AEvent_B Lag_B 1 1 10 2 0 11 3 0 00 4 1 00 5 0 11 6 0

Re: [R] Method Guidance

2022-01-12 Thread Avi Gross via R-help
, Jan 12, 2022 1:44 am Subject: Re: [R] Method Guidance Hi Jeff, A completely obscure question deserves a completely obscure answer: jrdf<-read.table(text="Time  Event_A    Event_B  Lag_B 1          1        1        0 2          0        1        1 3          0        0        0 4   

Re: [R] Method Guidance

2022-01-12 Thread Jeff Reichman
-project.org Subject: Re: [R] Method Guidance Hello, Here is a base R solution for what I understand of the question. It involves ave and cumsum. cumsum of the values of Event_A breaks Event_B in segments and ave applies a function to each segment. To find where are the times B, coerce to logical and

Re: [R] Method Guidance

2022-01-12 Thread Rui Barradas
Hello, Here is a base R solution for what I understand of the question. It involves ave and cumsum. cumsum of the values of Event_A breaks Event_B in segments and ave applies a function to each segment. To find where are the times B, coerce to logical and have which() take care of it. Data in

Re: [R] Method Guidance

2022-01-11 Thread Jim Lemon
Hi Jeff, A completely obscure question deserves a completely obscure answer: jrdf<-read.table(text="Time Event_AEvent_B Lag_B 1 1 10 2 0 11 3 0 00 4 1 00 5 0 11 6

Re: [R] Method Guidance

2022-01-11 Thread Jeff Newmiller
1) Figure out how to post plain text please. What you saw is not what we see. 2) I see a "table" of input information but no specific expectation of what would come out of this hypothetical function. 3) Maybe you will find something relevant in this blog post: https://jdnewmil.github.io/blog/po

Re: [R] method default for hclust function

2013-12-13 Thread David Carlson
botto Sent: Thursday, December 12, 2013 5:15 PM To: capricy gao; r-help@r-project.org Subject: Re: [R] method default for hclust function Absolute distance is the default distance in hclust. v<-c(1,2,3,4,5,6) dist(v) 2 1 3 2 1 4 3 2 1 5 4 3 2 1 6 5 4 3 2 1 Eliza > Date:

Re: [R] method default for hclust function

2013-12-12 Thread Peter Langfelder
On Thu, Dec 12, 2013 at 3:09 PM, capricy gao wrote: > I could not figure out what was the default when I ran hclust() without > specifying the method. According to help("hclust"), the default method is complete linkage. HTH, Peter __ R-help@r-projec

Re: [R] method default for hclust function

2013-12-12 Thread eliza botto
Absolute distance is the default distance in hclust. v<-c(1,2,3,4,5,6) dist(v) 2 1 3 2 1 4 3 2 1 5 4 3 2 1 6 5 4 3 2 1 Eliza > Date: Thu, 12 Dec 2013 15:09:19 -0800 > From: capri...@yahoo.com > To: r-help@r-project.org > Subject: [R] method default for hclust function > > I c

Re: [R] Method dispatch in S4

2013-08-09 Thread Bert Gunter
Please read the proto vignette before asking further questions about it. It is an alternative to/version of OOP different from S3 and S4. -- Bert On Fri, Aug 9, 2013 at 8:13 AM, Simon Zehnder wrote: > Hi Martin, > > is proto in S3? > > I will take a look first at the simple package EBImage. > >

Re: [R] Method dispatch in S4

2013-08-09 Thread Simon Zehnder
Hi Martin, is proto in S3? I will take a look first at the simple package EBImage. Thank you very much for the suggestions! Best Simon On Aug 9, 2013, at 5:01 PM, Martin Morgan wrote: > On 08/09/2013 07:45 AM, Bert Gunter wrote: >> Simon: >> >> Have a look at the "proto" package for whi

Re: [R] Method dispatch in S4

2013-08-09 Thread Martin Morgan
On 08/09/2013 07:45 AM, Bert Gunter wrote: Simon: Have a look at the "proto" package for which there is a vignette. You may find it suitable for your needs and less intimidating. Won't help much with S4, though! Some answers here http://stackoverflow.com/questions/5437238/which-packages-make-

Re: [R] Method dispatch in S4

2013-08-09 Thread Simon Zehnder
Hi Bert, thank you very much for your suggestion! I will take a look at it soon! Best Simon On Aug 9, 2013, at 4:45 PM, Bert Gunter wrote: > Simon: > > Have a look at the "proto" package for which there is a vignette. You > may find it suitable for your needs and less intimidating. > > Chee

Re: [R] Method dispatch in S4

2013-08-09 Thread Bert Gunter
Simon: Have a look at the "proto" package for which there is a vignette. You may find it suitable for your needs and less intimidating. Cheers, Bert On Fri, Aug 9, 2013 at 7:40 AM, Simon Zehnder wrote: > Hi Martin, > > thank you very much for this profound answer! Your added design advice is >

Re: [R] Method dispatch in S4

2013-08-09 Thread Simon Zehnder
Hi Martin, thank you very much for this profound answer! Your added design advice is very helpful, too! For the 'simple example': Sometimes I am still a little overwhelmed from a certain setting in the code and my ideas how I want to handle a process. But I learn from session to session. In f

Re: [R] Method dispatch in S4

2013-08-08 Thread Martin Morgan
On 08/04/2013 02:13 AM, Simon Zehnder wrote: So, I found a solution: First in the "initialize" method of class C coerce the C object into a B object. Then call the next method in the list with the B class object. Now, in the "initialize" method of class B the object is a B object and the respecti

Re: [R] Method dispatch in S4

2013-08-04 Thread Simon Zehnder
So, I found a solution: First in the "initialize" method of class C coerce the C object into a B object. Then call the next method in the list with the B class object. Now, in the "initialize" method of class B the object is a B object and the respective "generateSpec" method is called. Then, in

Re: [R] method show

2012-11-19 Thread Martin Morgan
On 11/19/2012 04:21 PM, Andrea Spano wrote: Hello the list, As a simple example: rm(list = ls())> setClass("tre", representation(x="numeric"))> setMethod("show", "tre", def = function(object) cat(object@x))[1] "show"> setMethod("summary", "tre", def = function(object) cat("This is a tre of v

Re: [R] method or package to make special boxplot

2012-09-09 Thread Jim Lemon
On 09/09/2012 12:14 AM, Zhang Qintao wrote: Hi, All, I am trying to use R to make the following type of boxplot while I couldn't find a way to do it. My dataset looks like X1 Y1 X2 Y2 SPLIT. The split highlights my experiment details and both x and y are continuous numerical values. I need

Re: [R] method or package to make special boxplot

2012-09-08 Thread Greg Snow
The symbols function allows you to place boxplot symbols at specified x,y coordinates. Would that do what you want? On Sat, Sep 8, 2012 at 8:14 AM, Zhang Qintao wrote: > Hi, All, > > I am trying to use R to make the following type of boxplot while I couldn't > find a way to do it. > > My dataset

Re: [R] method or package to make special boxplot

2012-09-08 Thread David Winsemius
On Sep 8, 2012, at 7:14 AM, Zhang Qintao wrote: > Hi, All, > > I am trying to use R to make the following type of boxplot while I couldn't > find a way to do it. > > My dataset looks like X1 Y1 X2 Y2 SPLIT. The split highlights my > experiment details and both x and y are continuous numeric

Re: [R] method or package to make special boxplot

2012-09-08 Thread John Kane
Please supply some sample data and preferably the code that you have used so far. To supply data the best way is probably to use the dput() function. If your data is 'mydata' simply do : dput(mydata) and paste the results into your email John Kane Kingston ON Canada > -Original Messag

Re: [R] Method dispatch for function call operator?

2011-01-13 Thread Taras Zakharko
Thank you both for very helpful answers. I have indeed missed the help pages about "(" and now the situation is more clear. > You can use this syntax by defining a function `x<-` <- function(...) {} > and it could be an S3 method, but it is a completely separate object from > x. Unfortunately

Re: [R] Method dispatch for function call operator?

2011-01-13 Thread Prof Brian Ripley
The details here are much more appropriate for R-devel, but please check the help pages for "(" and "[", and note - "[" is generic and "(" is not. - the primitive `(` is used to implement constructions such as (x <- pi) and not x(...). The special handling of operators such as "[" is part of th

Re: [R] Method dispatch for function call operator?

2011-01-13 Thread Duncan Murdoch
On 11-01-13 3:09 AM, Taras Zakharko wrote: Dear R gurus, I am trying to create a nicer API interface for some R modules I have written. Here, I heavily rely on S3 method dispatch mechanics and makeActiveBinding() function I have discovered that I apparently can't dispatch on function call

Re: [R] method dispatching vs inheritance/polymorphism (re-post)

2010-04-25 Thread Duncan Murdoch
On 25/04/2010 9:07 AM, Albert-Jan Roskam wrote: Hi, I'm having trouble seeing the added value over functions defined by setGeneric vis-a-vis methods defined by inheritance and polymorphism. setGeneric offers a 'clean' call to a generic function, ie. no need to call new(), so less typing to do

Re: [R] Method dispatch

2010-03-01 Thread Martin Morgan
method in "exportMethods". What did I miss here? Thanks a lot > for your help. > > > > export(MackChainLadder, MunichChainLadder, BootChainLadder, MultiChainLadder) > export(Join2Fits, JoinFitMse, Mse, residCov) > > importFrom(stats, quantile, predict, coef, vcov,

Re: [R] Method dispatch

2010-03-01 Thread Zhang,Yanwei
tFrom(stats, quantile, predict, coef, vcov, residuals, fitted, fitted.values, rstandard) importFrom(methods, show, coerce) importFrom(graphics, plot) #Classes exportClasses(triangles, MultiChainLadder, MultiChainLadderFit, MCLFit, GMCLFit, MultiChainLadderMse)

Re: [R] Method dispatch

2010-03-01 Thread Martin Morgan
On 03/01/2010 01:31 PM, Zhang,Yanwei wrote: > Dear all, > > In a package, I defined a method for "summary" using setMethod(summary, signature="abc") for my class "abc", but when the package is loaded, the function "summary(x)" where x is of class "abc" seems to have called the default summary func

Re: [R] Method for reduction of independent variables

2010-01-13 Thread Daniel Malter
Hi, please read the posting guide. You are not likely to get an extensive answer to your question from this list. Your question is a "please solve/explain my statistical problem for me" question. There are two things problematic with that. First, "statistical", and second "please solve for me." Fi

Re: [R] Method

2009-11-25 Thread yonosoyelmejor
You are right,but I´ll explain,my code creates a time series,after some transformations I need to make a prediction,which predicts 10values using the above,then written in a file,I put the code to see if it looks better: # TODO: Add comment # # Author: Ignacio2 ##

Re: [R] Method

2009-11-25 Thread yonosoyelmejor
s >> Sent: Tuesday, November 24, 2009 12:22 PM >> To: yonosoyelmejor >> Cc: r-help@r-project.org >> Subject: Re: [R] Method >> >> >> On Nov 24, 2009, at 1:44 PM, yonosoyelmejor wrote: >> >> > >> > I use length(myVector),but when i want t

Re: [R] Method

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 3:21 PM, David Winsemius wrote: On Nov 24, 2009, at 1:44 PM, yonosoyelmejor wrote: I use length(myVector),but when i want to use for example exp(x.reconstruida[length(myVector)+1:length(myVector)+9]), I need that function returns the number of last element,would then:

Re: [R] Method

2009-11-24 Thread William Dunlap
Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius > Sent: Tuesday, November 24, 2009 12:22 PM > To: yonosoyelmejor > Cc: r-help@r-project.org > Subject: Re: [R] Method > > > On Nov 24, 2009, at 1:

Re: [R] Method

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 1:44 PM, yonosoyelmejor wrote: I use length(myVector),but when i want to use for example exp(x.reconstruida[length(myVector)+1:length(myVector)+9]), I need that function returns the number of last element,would then: if the last position of my vector is 1440 exp(x.reco

Re: [R] Method

2009-11-24 Thread Sarah Goslee
If the last position of your vector is 1440, what do you expect to get from 1440 + 1??? And you certainly need some parentheses in there if you expect to get a range of values from your vector. Perhaps you need some subtraction? And no, we still can't tell exactly what you want. If this doesn't a

Re: [R] Method

2009-11-24 Thread yonosoyelmejor
I use length(myVector),but when i want to use for example exp(x.reconstruida[length(myVector)+1:length(myVector)+9]), I need that function returns the number of last element,would then: if the last position of my vector is 1440 exp(x.reconstruida[1440+1:1440+9] This is what I need, I hope havin

Re: [R] Method

2009-11-24 Thread Johannes Graumann
myVector <- c(seq(10),23,35) length(myVector) myVector[length(myVector)] it's unclear to me which of the two you want ... HTH, Joh yonosoyelmejor wrote: > > Hello, i would like to ask you another question. Is exist anymethod to > vectors that tells me the last element?That is to say,I have a v

Re: [R] Method

2009-11-24 Thread Karl Ove Hufthammer
On Tue, 24 Nov 2009 10:14:18 -0500 Sarah Goslee wrote: > x <- runif(45) # make a test vector > length(x) # position of the last element > x[length(x)] # value of the last element For the last one, this should be even better: tail(x, 1) But, actually benchmarking this, it turns out

Re: [R] Method

2009-11-24 Thread David Winsemius
On Nov 24, 2009, at 10:20 AM, Keo Ormsby wrote: yonosoyelmejor escribió: Hello, i would like to ask you another question. Is exist anymethod to vectors that tells me the last element?That is to say,I have a vector, I want to return the position of last element. I hope having explained. A

Re: [R] Method

2009-11-24 Thread Sarah Goslee
It isn't entirely clear what you want. Maybe one of these? x <- runif(45) # make a test vector length(x) # position of the last element x[length(x)] # value of the last element Sarah On Tue, Nov 24, 2009 at 5:18 AM, yonosoyelmejor wrote: > > Hello, i would like to ask you another

Re: [R] Method

2009-11-24 Thread Keo Ormsby
yonosoyelmejor escribió: Hello, i would like to ask you another question. Is exist anymethod to vectors that tells me the last element?That is to say,I have a vector, I want to return the position of last element. I hope having explained. A greeting, Ignacio. vect1 <- c(1,2,3) vect1[length(v

Re: [R] method ML

2009-04-14 Thread Luc Villandre
Hi Joe, You're using the lme() function? If so, then adding /method = "ML" / to the argument list should do the trick. Cheers, Luc joewest wrote: Hi I am doing lme models and they are coming out using the REML method, can anyone please tell me how i use the ML method and exactly what i put

Re: [R] method to return rgb values from pixels of an image

2008-11-07 Thread Duncan Murdoch
On 11/7/2008 3:24 AM, Hans-Joachim Klemmt wrote: hello, i am looking for a method to return rgb-values of predifined pixels of jpg images. can anybody help me? See the rimage package, with function read.jpeg. It will read the whole file into a large array, with separate red, green, blue

Re: [R] Method for checking automatically which distribtions fits a data

2008-07-07 Thread Frank E Harrell Jr
--Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of hadley wickham Sent: Monday, July 07, 2008 8:10 AM To: Ben Bolker Cc: [EMAIL PROTECTED] Subject: Re: [R] Method for checking automatically which distribtions fits a data Suppose I have a vector of data. Is there a m

Re: [R] Method for checking automatically which distribtions fits a data

2008-07-07 Thread David Reinke
:10 AM To: Ben Bolker Cc: [EMAIL PROTECTED] Subject: Re: [R] Method for checking automatically which distribtions fits a data >> Suppose I have a vector of data. >> Is there a method in R to help us automatically >> suggest which distributions fits to that data >> (e.g. no

Re: [R] Method for checking automatically which distribtions fits a data

2008-07-07 Thread hadley wickham
>> Suppose I have a vector of data. >> Is there a method in R to help us automatically >> suggest which distributions fits to that data >> (e.g. normal, gamma, multinomial etc) ? >> >> - Gundala Viswanath >> Jakarta - Indonesia >> > > See > > https://stat.ethz.ch/pipermail/r-help/2008-June/166259.h

Re: [R] Method for checking automatically which distribtion s fits a data

2008-07-07 Thread Ben Bolker
Stephen Tucker yahoo.com> writes: > > I don't know that there is a single function, but you can perhaps apply a sequence of available functions - > > For instance, you can use fitdistr() in library(MASS) to estimate optimal parameters for a candidate set > of distributions; then look at each f

Re: [R] Method for checking automatically which distribtions fits a data

2008-07-07 Thread Stephen Tucker
I don't know that there is a single function, but you can perhaps apply a sequence of available functions - For instance, you can use fitdistr() in library(MASS) to estimate optimal parameters for a candidate set of distributions; then look at each fit and also compare the deviance among the f

Re: [R] Method for checking automatically which distribtions fits a data

2008-07-06 Thread ctu
Hi, In my experience, I just plot the data set then figure it out. Maybe you could try this? I really wonder that there is such a R function exists. If yes, please let me know. Thanks Chunhao Tu Quoting Gundala Viswanath <[EMAIL PROTECTED]>: Hi, Suppose I have a vector of data. Is there a met