[R] Bug in cut.POSIXt

2009-10-15 Thread Vitalie S.
Hello Everyone, Before reporting decided to post here first: tt <- structure(c(1254238817, 1254238859, 1254238969, 1254239080), class = c("POSIXt", "POSIXct"), tzone = "") cut.POSIXt(tt, 2) #Error in `levels<-.factor`(`*tmp*`, v

Re: [R] Completion for proto objects

2009-09-12 Thread Vitalie S.
On Fri, 11 Sep 2009 18:56:36 +0200, Gabor Grothendieck wrote: in the devel version. If that does not help let me know offline and I will try to help you. Thanks Gabor, I solved the problem. Here is the code in case somebody else wants to have full completions for proto objects: # slightl

Re: [R] Completion for proto objects

2009-09-11 Thread Vitalie S.
, with no default What is going on?? My ls.proto works nicely in global env but does not when called from attached packages? Would really appreciate if someone can enlighten me. Thanks a lot. PS: I also tried to modify utils:::specialCompletions directly, did not wok either -

[R] Modify functions in base packages (needed for completion for proto objects)

2009-09-11 Thread Vitalie S.
Hello everyone, I am trying to implement completion for proto objects. Proto extends environment in a hierarchical way. Thus completion should list all the names in all it's parent environments. For "normal" classes defining names.class would do the job, but completion for "environment"

Re: [R] Google's R Style Guide

2009-09-01 Thread Vitalie S.
On Tue, 01 Sep 2009 10:47:36 +0200, Corrado wrote: Thanks Duncan, Spencer, To clarify, the situation is: 1) I have no reasons to choose S3 on S4 or vice versa, or any other coding convention 2) Our group has not done any OO developing in R and I would be the first, so I can set up the s

Re: [R] Google's R Style Guide

2009-08-31 Thread Vitalie S.
On Fri, 28 Aug 2009 16:40:53 +0200, Kevin Wright wrote: On Fri, Aug 28, 2009 at 8:22 AM, Ted Harding wrote: On 28-Aug-09 12:59:24, Esmail wrote: > Perhaps most of you have already seen this? > > http://google-styleguide.googlecode.com/svn/trunk/google-r-style.html > > Comments/Critiques? > >

Re: [R] Best R text editors?

2009-08-31 Thread Vitalie S.
On Mon, 31 Aug 2009 12:25:38 +0200, Jim Lemon wrote: Liviu Andronic wrote: Could someone give a brief and subjective overview of ESS. I notice that many people use it, and many describe it as the tool for the power user. As far as I'm concerned, I've once again looked at Emacs (after couple of

Re: [R] problem with BRugs

2009-08-25 Thread Vitalie S.
This is a BUGS error message that indeed tells you that BUGS cannot truncate that density - not related to R at all. Best, Uwe Ligges Yes, indeed, that does not work in OpenBugs as well. Means that documentation of Open bugs is incorrect (they are using dnorm there). Also "I" works

Re: [R] problem with BRugs

2009-08-25 Thread Vitalie S.
On Tue, 25 Aug 2009 12:13:21 +0200, Uwe Ligges wrote: Vitalie S. wrote: Hello Uwe, Just a related question, OpenBugs is using C and T for Censoring and Truncation. But this does not seem to work with BRugs. I am using this document http://mathstat.helsinki.fi/openbugs/Manuals

Re: [R] [] for R

2009-08-25 Thread Vitalie S.
see ?[ For '['-indexing only: 'i, j, ...' can be logical vectors, indicating elements/slices to select. Such vectors are recycled if necessary to match the corresponding extent. 'i, j, ...' can also be negative integers, indicating elements/slic

Re: [R] problem with BRugs

2009-08-25 Thread Vitalie S.
Hello Uwe, Just a related question, OpenBugs is using C and T for Censoring and Truncation. But this does not seem to work with BRugs. I am using this document http://mathstat.helsinki.fi/openbugs/Manuals/ModelSpecification.html#TheBUGSLanguageStochasticNodes Thanks, Vitalie. On Tue, 25

Re: [R] Problem with passing a string to subset

2009-08-22 Thread Vitalie S.
On Fri, 21 Aug 2009 22:38:09 +0200, baptiste auguie wrote: Try this, mystr <-"c==1" subset(foo, eval(parse(text = mystr)) ) library(fortunes) fortune("parse") # try several times # I prefer this, but there is probably a better way mycond<- quote(c==1) subset(foo, eval(bquote(.(mycond))) )

Re: [R] how to compute this summation...

2009-08-21 Thread Vitalie S.
On Thu, 20 Aug 2009 02:36:38 +0200, kathie wrote: Dear R users, I try to compute this summation, http://www.nabble.com/file/p25054272/dd.jpg where f(y|x) = Negative Binomial(y, mu=exp(x' beta), size=1/alp) http://www.nabble.com/file/p25054272/aa.jpg http://www.nabble.com/file/p25054272

Re: [R] number in R

2009-08-18 Thread Vitalie S.
On Mon, 17 Aug 2009 16:49:53 +0200, Inchallah Yarab wrote: Hi, i export data from an csv file like this : Data <- read.csv2("c:/Art.csv",sep=",") # import data into R Data <- Data [1:5,1:5]# extracting the first 5 rows and columns Data Policy.Number AXA.Entity Country LoB ccy.data 1

Re: [R] help with expression()

2009-08-18 Thread Vitalie S.
On Mon, 17 Aug 2009 12:24:28 +0200, deanj2k wrote: Hello. I have a vector and within that vector is one expression. When I display this vector it comes up as expression(NA_character_, NA_character_, "Null Effect", "Pooled effect", NA_character_, NA_character_, NA_character_, NA_character

Re: [R] re ading transposed data in read.csv

2009-08-15 Thread Vitalie S.
On Sat, 15 Aug 2009 09:20:04 +0200, Dieter Menne wrote: sandsky wrote: I have a data set (csv); e.g., ID samp1 samp2 samp3 samp4 G1 2332 12 87 G2 8545 49 76 G3 1246 39 28 G4 7326 18 13 and

Re: [R] Matrix addition function

2009-08-13 Thread Vitalie S.
On Thu, 13 Aug 2009 15:11:03 +0200, Michael Knudsen wrote: On Thu, Aug 13, 2009 at 11:35 AM, Lina Rusyte wrote: Hi Lina, What function can I use for matrices addition? I couldn’t find any information about it in the manual or in the internet. (A+B suits, when the number of matrixes is s

Re: [R] Validity check when setting slot

2009-08-13 Thread Vitalie S.
Hi, RG> Hi, RG> I'm wondering if the following behaviour is normal: RG> setClass('A', representation(number='numeric'), RG> validity=function(object){ RG> if( obj...@number < -1 ) return("Invalid number"); TRUE}) >> [1] "A" RG> a <- new('A') RG> a >> An

Re: [R] A question regarding R scoping

2009-08-08 Thread Vitalie S.
You have to understand the difference between the lexical scope of a function (which gives the search path for variables) and call stack (which is a path of function calls). This gives an enormous flexibility in programming, perhaps at the cost of confusing some people. See http://cran.r-pr

Re: [R] Completion for custom "$" operator?

2009-08-06 Thread Vitalie S.
Completion should be automatic if you define names() to return the valid names. Thank you Deepayan, that works beautifully. I wonder though; names function for environment objects always returns NULL, but completion still works. Looks tricky. Vitalie. -- _

[R] Completion for custom "$" operator?

2009-08-04 Thread Vitalie S.
Dear UseRs, I declared a `$` method for a S4 class. Can I have ab automatic completion for this operator in R? Lists and environment objects provide this feature by default, but my object is an extension of "function" class which does not have subseting defined. How to be? Thanks for any

[R] Make functions aware of theyr own slots.

2009-06-25 Thread Vitalie S.
Hello, Is there a way to access function's slots from inside the function? I want to make functions slot dependent without recurring to generic function mechanism. Probably this goes a bit against R philosophy, but otherwise I don't really see the use of extending functions in R. Would

Re: [R] S4: Bug in group method defenition ("Compare")

2009-06-16 Thread Vitalie S.
Setting methods for groups ("compare" in this case) does not work properly. Once one method is set ,redefining it or even removing does not change the behavior: Can anyone suggest how to refresh methods "table" for some particular generic? (in the above case "Compare" group generic). For

[R] S4: Bug in group method defenition ("Compare")

2009-06-15 Thread Vitalie S.
Dear UseRs, Setting methods for groups ("compare" in this case) does not work properly. Once one method is set ,redefining it or even removing does not change the behavior: setClass("foo" ,representation(range="numeric") ) #[1] "foo" setMethod("Compare",c(e1="ANY",e2="foo"),

Re: [R] S4: When is validObject issued? (or why S4 is killing me:( ..

2009-06-06 Thread Vitalie S.
setMethod("initialize","test2", function(.Object,...){ .Object<-callNextMethod(.Object,...) validity is checked in the preceeding line .obj...@b<-.obj...@a ## here "b" is initialized ## .Object }) new("test2") Error i

[R] S4: When is validObject issued? (or why S4 is killing me:( ..

2009-06-05 Thread Vitalie S.
Dear UseRs, Does anyone know when exactly the validity is checked in S4? Documentation is silent:(. Here is a small example: setClass("test1",representation(a="numeric")) setMethod("initialize","test1", function(.Object,...){ a<-runif(1) ## here slot "a" is initial

[R] S4: Initialization method called during setClass??

2009-06-05 Thread Vitalie S.
Dear UseRs, A simple class inheritance example: setClass("test",representation(a="numeric")) setMethod("initialize","test", function(.Object,x,...){ print("Initialization!!!") callNextMethod(.Object,a=x,...) }) new("test",x=23) [1] "Initializa

Re: [R] passing arguments to subset from a function

2008-12-17 Thread Vitalie S.
On Wed, 17 Dec 2008 20:07:08 +0100, GOUACHE David wrote: argument which I will pass on to subset() somewhere inside my function. I would use the example of .() function from plyr package in this case: .<-function (...){ structure(as.list(match.call()[-1]), class = "quoted") } myfuncti