Re: [R] Class balancing ratio

2020-02-05 Thread Bert Gunter
Questions on specialized packages (the ROSE package presumably) may not get answered on this list. If that turns out to be the case, you may wish to contact the package maintainer: Nicola Lunardon . Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking

Re: [R] class of 'try' if error is raised

2019-12-15 Thread Hans W Borchers
Yes, CRAN did accept 'if(inherits(e, "try-error"))'. I remember now, when I used the try-construct the first time, I also saw tryCatch and found it a bit too extensive for my purposes. Will look at it again when needed. Thanks to you and Enrico On Sun, 15 Dec 2019 at 16:03, Bert Gunter wrote: >

Re: [R] class of 'try' if error is raised

2019-12-15 Thread Bert Gunter
See ?try which links you to ?tryCatch for the preferred approach. Alternatively: if(inherits(e, "try-error")) ## should work and satisfy CRAN -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Br

Re: [R] class of 'try' if error is raised

2019-12-15 Thread Enrico Schumann
> "HW" == Hans W Borchers writes: HW> I have been informed by CRAN administrators that the development HW> version of R issues warnings for my package(s). Some are easy to mend HW> (such as Internet links not working anymore), but this one I don't HW> know how to avoid: HW> Err

[R] class of 'try' if error is raised

2019-12-15 Thread Hans W Borchers
I have been informed by CRAN administrators that the development version of R issues warnings for my package(s). Some are easy to mend (such as Internet links not working anymore), but this one I don't know how to avoid: Error in if (class(e) == "try-error") { : the condition has length > 1 I

[R] class-specific Gini metrics for Random Forest?

2015-10-13 Thread Matt Fagan
library(randomForest) data(iris) fit <- randomForest(Species ~ ., data=iris, importance=TRUE); fit.imp<-importance(fit) fit.imp columns 1-3 of fit.imp show the class-specific variable importance for the Mean Decrease Acuracy measure (MDA). Is there a way to calculate class-specific Gini metrics ra

Re: [R] 'class(.) == **' [was 'Call to a function']

2015-06-26 Thread David Winsemius
On Jun 25, 2015, at 11:52 PM, Steven Yen wrote: > Thanks Davis. But actually, the line is legitimate: I didn't say it was illegitimate, only confusing. > > if (inherits(wt,what="character")) wt<-data[,wt] What you are asking for is known in R as non-standard evaluation. Examples include th

Re: [R] 'class(.) == **' [was 'Call to a function']

2015-06-25 Thread Steven Yen
Thanks Davis. But actually, the line is legitimate: if (inherits(wt,what="character")) wt<-data[,wt] because, coming down with wt being characters, the part wt<-data[,wt] then picks up variables data$wt. The call wmean(mydata,wt="weight") actually goes OK. I was hoping to figure out a

Re: [R] 'class(.) == **' [was 'Call to a function']

2015-06-25 Thread David Winsemius
On Jun 25, 2015, at 7:48 PM, Steven Yen wrote: > Thanks to all for the help. I have learned much about "inherit" and "class". > I like to know about one additional option, and that is to use a calling > parameter without the quotation marks, similar to the linear regression > syntax: > > lm(d

Re: [R] 'class(.) == **' [was 'Call to a function']

2015-06-25 Thread Steven Yen
Thanks to all for the help. I have learned much about "inherit" and "class". I like to know about one additional option, and that is to use a calling parameter without the quotation marks, similar to the linear regression syntax: lm(data=mydata,weights=wt) Below is a simple set of codes to ca

Re: [R] 'class(.) == **' [was 'Call to a function']

2015-06-24 Thread Martin Maechler
> Steve Taylor > on Wed, 24 Jun 2015 00:56:26 + writes: > Note that objects can have more than one class, in which case your == and %in% might not work as expected. > Better to use inherits(). > cheers, > Steve Yes indeed, as Steve said, really do! The use

Re: [R] class of strptime() output

2015-01-05 Thread Jeff Newmiller
Because data.frame converts it. I don't know what rationale was originally used to justify including that transformation automatically, but I think it is much better this way than having POSIXlt in the data frame. POSIXlt is itself like a little data frame, and having data frames inside of data

Re: [R] class of strptime() output

2015-01-05 Thread Jinsong Zhao
On 2015/1/5 20:51, David Winsemius wrote: On Jan 5, 2015, at 5:47 PM, Jinsong Zhao wrote: On 2015/1/5 17:28, Ben Bolker wrote: Jinsong Zhao yeah.net> writes: In the following code snippet, # a <- strptime("121114 0510", "%m%d%y %H%M") b <- data.frame(date = a, res = 1:5) class(a) class(b[

Re: [R] class of strptime() output

2015-01-05 Thread David Winsemius
On Jan 5, 2015, at 5:47 PM, Jinsong Zhao wrote: > On 2015/1/5 17:28, Ben Bolker wrote: >> Jinsong Zhao yeah.net> writes: >> >> >>> In the following code snippet, >>> # >>> a <- strptime("121114 0510", "%m%d%y %H%M") >>> b <- data.frame(date = a, res = 1:5) >>> class(a) >>> class(b[1,1]) >>> #

Re: [R] class of strptime() output

2015-01-05 Thread Jinsong Zhao
On 2015/1/5 17:28, Ben Bolker wrote: Jinsong Zhao yeah.net> writes: In the following code snippet, # a <- strptime("121114 0510", "%m%d%y %H%M") b <- data.frame(date = a, res = 1:5) class(a) class(b[1,1]) # I am wondering why the class of a and b[1,1] are not the same. How to make the class

Re: [R] class of strptime() output

2015-01-05 Thread Ben Bolker
Jinsong Zhao yeah.net> writes: > In the following code snippet, > # > a <- strptime("121114 0510", "%m%d%y %H%M") > b <- data.frame(date = a, res = 1:5) > class(a) > class(b[1,1]) > # > I am wondering why the class of a and b[1,1] are not the same. > > How to make the class of a and b[1,1] to b

[R] class of strptime() output

2015-01-05 Thread Jinsong Zhao
Hi there, In the following code snippet, # a <- strptime("121114 0510", "%m%d%y %H%M") b <- data.frame(date = a, res = 1:5) class(a) class(b[1,1]) # I am wondering why the class of a and b[1,1] are not the same. How to make the class of a and b[1,1] to be same? I would really appreciate you for

Re: [R] Class ltraj and function as.ltraj

2014-10-02 Thread Michael Sumner
You don't detail how you detect that 'there are no duplicates', and also provide no proof of this. It's not the usual sense of duplicated(), it needs to be that there are no date-times within a burst (a single animal's trip/journey/trajectory). Can you try this on your datetime and burst id and rep

[R] Class ltraj and function as.ltraj

2014-10-02 Thread tandi perkins
Hello R Help Group: I have been struggling to create an object of class ltraj with the function as.ltraj (adehabitatLT) with my bird data. Regarding my data structure, I have GPS for 10 birds that transmit three times/day, over the course of a year (with missing data). I have a L10.csv file with

Re: [R] Class definition and "contains": No definition was found for superclass

2012-12-10 Thread Martin Morgan
On 12/10/2012 07:01 AM, Johannes Graumann wrote: Hi, What goes wrong when the following error shows up: Error in reconcilePropertiesAndPrototype(name, slots, prototype, superClasses, : No definition was found for superclass “sequencesuperclass” in the specification of class “sequences”

[R] Class definition and "contains": No definition was found for superclass

2012-12-09 Thread Johannes Graumann
Hi, What goes wrong when the following error shows up: > Error in reconcilePropertiesAndPrototype(name, slots, prototype, > superClasses, : > No definition was found for superclass “sequencesuperclass” in the > specification of class “sequences” Has this something to do with recursive class

[R] Class Not found exception from RCosole

2012-11-26 Thread sheenmaria
I tried adding my jars to classpath using #!/usr/bin/Rscript library(rJava) #.jclassPath() .jinit() .jaddClassPath(dir("target\\mavenLib", full.names=TRUE )) .jclassPath() but got in .jnew("com/algoTree/ClientElasticSearch/ElasticSearchLoader") : java.lang.ClassNotFoundException then I t

[R] Class Not found execption

2012-11-26 Thread sheenmaria
I am trying to call a r file named es.r which have lotes of R functions. These R functions are internally calling java functions by using ".jnew()" and ".jcall()". I have added necessary jar's to the Classpath and I am able to run es.r from command prompt . But when I tried to call it

[R] Class Not found execption

2012-11-26 Thread sheenmaria
I am trying to call a r file named es.r which have lotes of R functions. These R functions are internally calling java functions by using ".jnew()" and ".jcall()". I have added necessary jar's to the Classpath and I am able to run es.r from command prompt . But when I tried to call it

Re: [R] Class for time series

2012-10-04 Thread arun
    0.011    19.343  0 #2012-07-06 09:47:21 -0.141  22.510    0.011    19.321  0 #2012-07-06 10:02:21 -0.139  22.372    0.011    19.280  0 A.K. - Original Message - From: Hasan Diwan To: Poizot Emmanuel Cc: r-help@r-project.org Sent: Thursday, O

Re: [R] Class for time series

2012-10-04 Thread Gabor Grothendieck
On Thu, Oct 4, 2012 at 3:07 AM, Hasan Diwan wrote: > Mr. Emmanuel, > > On 4 October 2012 02:43, Poizot Emmanuel wrote: > >> Dear all, >> >> I have a time serie dataset such as the following with data acquired every >> 15 minutes: >> >> DateHeure Profondeur Température Salinité Turbidité Chlor

Re: [R] Class for time series

2012-10-04 Thread Achim Zeileis
On Thu, 4 Oct 2012, Poizot Emmanuel wrote: Dear all, I have a time serie dataset such as the following with data acquired every 15 minutes: DateHeure Profondeur Température Salinité Turbidité Chloration 1 2012-07-06 08:47:22 -0.144 22.4690.011 0.000 0 2 2012-07-06 0

Re: [R] Class for time series

2012-10-04 Thread Hasan Diwan
Mr. Emmanuel, On 4 October 2012 02:43, Poizot Emmanuel wrote: > Dear all, > > I have a time serie dataset such as the following with data acquired every > 15 minutes: > > DateHeure Profondeur Température Salinité Turbidité Chloration > 1 2012-07-06 08:47:22 -0.144 22.4690.011

[R] Class for time series

2012-10-04 Thread Poizot Emmanuel
Dear all, I have a time serie dataset such as the following with data acquired every 15 minutes: DateHeure Profondeur Température Salinité Turbidité Chloration 1 2012-07-06 08:47:22 -0.144 22.4690.011 0.000 0 2 2012-07-06 09:02:21 -0.147 22.4760.011 0.000

Re: [R] Class that wraps Data Frame

2012-09-03 Thread Ramiro Barrantes
] Sent: Friday, August 31, 2012 12:33 PM To: Bert Gunter Cc: David Winsemius; r-help@r-project.org; Ramiro Barrantes Subject: Re: [R] Class that wraps Data Frame I guess there are two issues with data.frame. It comes with more than you probably want to support (e.g., list and matrix- like subsetter

Re: [R] Class that wraps Data Frame

2012-08-31 Thread Martin Morgan
I guess there are two issues with data.frame. It comes with more than you probably want to support (e.g., list and matrix- like subsetter [, the user expecting to be able to independently modify any column). And it comes with less than you'd like (e.g., support for a 'column' of S4 objects). By

Re: [R] Class that wraps Data Frame

2012-08-31 Thread Bert Gunter
To add to what David said ... Of course, there are already S3 "getters" and "setters" methods for data frames ("[.data.frame" and "[<-.data.frame" )*. These could clearly be extended -- i.e. the data.frame class could be extended and appropriate S3 methods written. Whether you use S3 or S4 depends

Re: [R] Class that wraps Data Frame

2012-08-31 Thread David Winsemius
On Aug 31, 2012, at 5:57 AM, Ramiro Barrantes wrote: > Hello, > > I have again a "good practices"/programming theory question regarding > data.frames. > > One of the fundamental objects that I use is the data frame with a particular > set of columns that I would fill or get information from,

[R] Class that wraps Data Frame

2012-08-31 Thread Ramiro Barrantes
Hello, I have again a "good practices"/programming theory question regarding data.frames. One of the fundamental objects that I use is the data frame with a particular set of columns that I would fill or get information from, and an entire system would revolve around getting information from o

[R] Class-attribute and method dispatch for the function-class

2012-08-22 Thread Jonas Rauch
Hi everyone. I played with operator overloading for functions and came upon a few peculiarities. I basically wanted to do something like this: > Ops.function<-function(e1, e2) { > Op <- getMethod(.Generic) >if(missing(e2)) return(function(...) Op(e1(...)) ) >if(is.function(e2)) return(f

Re: [R] class definition

2011-10-01 Thread Uwe Ligges
On 01.10.2011 13:21, Omphalodes Verna wrote: Hi everybody! I have a matrix of class "myClass", for example: myMat<- matrix(rnorm(30), nrow = 6) attr(myMat, "class")<- "myClass" class(myMat) When I extract part of ''myMat'', the corresponding class ''myClass'' unfortunately disappear: myMat

[R] class definition

2011-10-01 Thread Omphalodes Verna
Hi everybody! I have a matrix of class "myClass", for example: myMat <- matrix(rnorm(30), nrow = 6) attr(myMat, "class") <- "myClass" class(myMat) When I extract part of ''myMat'', the corresponding class ''myClass'' unfortunately disappear: myMat.p <- myMat[,1:2] class(myMat.p) Please for a

Re: [R] class weights with Random Forest

2011-09-13 Thread Liaw, Andy
n...@r-project.org] On Behalf Of James Long > Sent: Tuesday, September 13, 2011 2:10 AM > To: r-help@r-project.org > Subject: [R] class weights with Random Forest > > Hi All, > > I am looking for a reference that explains how the > randomForest function in > the randomFo

[R] class weights with Random Forest

2011-09-13 Thread James Long
Hi All, I am looking for a reference that explains how the randomForest function in the randomForest package uses the classwt parameter. Here: http://tolstoy.newcastle.edu.au/R/e4/help/08/05/12088.html Andy Liaw suggests not using classwt. And according to: http://r.789695.n4.nabble.com/R-help-

[R] Class htest with non-numeric p-values

2011-04-20 Thread JiHO
Hi everyone, For some tests, tables of critical values are readily available while the algorithm to compute those critical values is not. In such cases, only a range for the p-value can be evaluated (e.g. 0.05 < p < 0.1) from the table of critical values and the statistic. Is there anyway to incl

Re: [R] Class noquote to matrix

2011-03-30 Thread Mark Ebbert
I knew there had to be a simple solution. Thank you! On Mar 30, 2011, at 3:04 AM, Peter Ehlers wrote: > On 2011-03-29 19:12, Mark Ebbert wrote: >> Hi, >> >> I apologize if the solution is right in front of me, but I can't find >> anything on how to convert a class of 'noquote' to 'matrix'. I've

Re: [R] Class noquote to matrix

2011-03-30 Thread Peter Ehlers
On 2011-03-29 19:12, Mark Ebbert wrote: Hi, I apologize if the solution is right in front of me, but I can't find anything on how to convert a class of 'noquote' to 'matrix'. I've tried as.matrix and I've tried coercing it by 'class(x)<-matrix', but of course that didn't work. I've been using

[R] Class noquote to matrix

2011-03-29 Thread Mark Ebbert
Hi, I apologize if the solution is right in front of me, but I can't find anything on how to convert a class of 'noquote' to 'matrix'. I've tried as.matrix and I've tried coercing it by 'class(x)<-matrix', but of course that didn't work. I've been using the function 'symnum' which returns an ob

Re: [R] Class "coef.mer" into a data.frame?

2011-01-02 Thread Jukka Koskela
Thank you! This was exactly what I was looking for. Jukka Lainaus "David Winsemius" : On Dec 31, 2010, at 2:49 AM, Jukka Koskela wrote: Hello, Could somebody please tell me what am I doing wrong in following? I try extract coefficients (using arm-package) from the lmer frunction, but I

Re: [R] Class "coef.mer" into a data.frame?

2010-12-31 Thread David Winsemius
On Dec 31, 2010, at 2:49 AM, Jukka Koskela wrote: Hello, Could somebody please tell me what am I doing wrong in following? I try extract coefficients (using arm-package) from the lmer frunction, but I get the following warning: a<-data.frame(coef(res)) Error in as.data.frame.default(x[[i]]

[R] Class "coef.mer" into a data.frame?

2010-12-30 Thread Jukka Koskela
Hello, Could somebody please tell me what am I doing wrong in following? I try extract coefficients (using arm-package) from the lmer frunction, but I get the following warning: a<-data.frame(coef(res)) Error in as.data.frame.default(x[[i]], optional = TRUE, stringsAsFactors = stringsAsFact

Re: [R] class changed after execution with sqldf

2010-11-02 Thread Gabor Grothendieck
On Tue, Nov 2, 2010 at 7:01 PM, GL wrote: > > Forgot to mention. This works in the PC implementation of R. The results I'm > seeing here are in Mac OS X with X11 and tcl/tk installed. Could you provide a minimal reproducible example that illustrates the problem. -- Statistics & Software Consul

Re: [R] class changed after execution with sqldf

2010-11-02 Thread GL
Forgot to mention. This works in the PC implementation of R. The results I'm seeing here are in Mac OS X with X11 and tcl/tk installed. -- View this message in context: http://r.789695.n4.nabble.com/class-changed-after-execution-with-sqldf-tp3024592p3024602.html Sent from the R help mailing lis

[R] class changed after execution with sqldf

2010-11-02 Thread GL
When I run sqldf to merge two datasets, it's changing the Date (class date) to a numeric value (class factor). Not sure why. Appreciate any insight. Console output for two datasets and the merged dataset (via sqldf) listed below. > summary(df.aggregate) Date Hour

Re: [R] Class mode text isopen can read can write - too many open connections

2010-10-18 Thread Joshua Wiley
append=TRUE,sep="\n") >                                write(paste("Failed to download:", > paste("CM",sDate1,".zip",sep="")),file = > "Failure-Log.txt",append=TRUE,sep="\n") >                                closeAll

Re: [R] Class mode text isopen can read can write - too many open connections

2010-10-17 Thread Santosh Srinivas
print(paste("Failed to download:", paste("CM",sDate1,".zip",sep="")),file = "Failure-Log.txt",append=TRUE,sep="\n") write(paste("Failed to download:", paste("CM",sDate1,".zip",sep="&qu

Re: [R] Class mode text isopen can read can write - too many open connections

2010-10-17 Thread Joshua Wiley
Hi, Is it a public URL (i.e., that we can try downloading from too)? Do you get the same error now matter where/what you download or just from that one place? Finally, if you are using Windows > XP, are you running R as an administrator (or very sure that the log file or whatever else you are cr

[R] Class mode text isopen can read can write - too many open connections

2010-10-17 Thread Santosh Srinivas
I am downloading data files using RCurl and everything works except till some limit is hit and says too many connections open It is a simple download using URL and I am writing the status in a tryCatch block to a log file. showConnections() description class mode text isopen can read can wr

Re: [R] class "matrix" lost when extracting a row from matrix

2010-09-19 Thread Tobias Verbeke
On 09/19/2010 10:02 AM, h...@wiseadvice.eu wrote: Good morning experts! situation: class(myMatrix)="matrix" class(myMatrix[(1:2),]))="matrix" class(myMatrix[1,])= "character" consequences are far reaching as, for instance colnames(myMatrix[(1:2),]) != colnames(myMatrix[1,]) or names(myMatrix[

[R] class "matrix" lost when extracting a row from matrix

2010-09-19 Thread h...@wiseadvice.eu
Good morning experts! situation: class(myMatrix)="matrix" class(myMatrix[(1:2),]))="matrix" class(myMatrix[1,])= "character" consequences are far reaching as, for instance colnames(myMatrix[(1:2),]) != colnames(myMatrix[1,]) or names(myMatrix[(1:2),]) != names(myMatrix[1,]) My question: 1.

Re: [R] class

2010-07-23 Thread schuster
Hi, Strange, there seems to be different behavior of "old style" classes and S4 classes. This worked just like you expected (but it's not the same thing, no S4 classes) f2=function(x,...) UseMethod("fxy") fxy.default=function(x,...){ print("default") } fxy.X=function(x,...) {

[R] class

2010-07-22 Thread Yuan Jian
Hello,   ###  I created two classes "A" and "B". "A" is the superclass of "B".   setClass("A", representation(s1="numeric"),prototype=prototype(s1=8)) setClass("B",contains="A",representation(s2="character"),prototype=list(s2="hi")) myA=new("A") myB=new("B")     I created functions for "A" and

Re: [R] Class attributes

2009-12-04 Thread David Winsemius
On Dec 4, 2009, at 11:55 AM, Allen L wrote: Dear R forum, I want to replace all the elements in a data frame (dd) which match the character "x" with "0". What's the most elegant way of doing this (there must be an easy way which I've missed)? I settled on the following loop: for(i in 5:

Re: [R] Class attributes

2009-12-04 Thread jim holtman
Here a way of doing it: for (i in 5:12){ # convert to character so you can substitute 'x' a <- as.character(dd[,i]) a[a == 'x'] <- '0' replace with zero dd[,i] <- as.numeric(a) } On Fri, Dec 4, 2009 at 11:55 AM, Allen L wrote: > > Dear R forum, > I want to replace all the eleme

[R] Class attributes

2009-12-04 Thread Allen L
Dear R forum, I want to replace all the elements in a data frame (dd) which match the character "x" with "0". What's the most elegant way of doing this (there must be an easy way which I've missed)? I settled on the following loop: >for(i in 5:12){# These are the column of dd I am

[R] Class correlation with hierarchical clusters

2009-09-23 Thread Jonsson, Pall
Hello R gurus. I have been performing hierarchical clustering of gene expression data. I use the heatmap() function to perform the clustering and overlay classifications by using the ColSideColors parameter. In many cases I have various metadata associated with my samples, which leaves me w

Re: [R] class export in package creation / setClass / namespace?

2009-07-21 Thread L L
Thanks to both Martins, your advice solved the confusion between S3 and S4 classes for the show method. br. Leo On Tue, Jul 21, 2009 at 9:58 AM, Martin Maechler wrote: > > "MartinMo" == Martin Morgan > > on Mon, 20 Jul 2009 18:57:33 -0700 writes: > >MartinMo> L L writes: >

Re: [R] class export in package creation / setClass / namespace?

2009-07-20 Thread Martin Maechler
> "MartinMo" == Martin Morgan > on Mon, 20 Jul 2009 18:57:33 -0700 writes: MartinMo> L L writes: >> Ok, I could solve also the latter problem by defining show.myclass function in >> the zzz.R file and adding the line 'S3method(show,myclass)' into NAMESPACE >> file.

Re: [R] class export in package creation / setClass / namespace?

2009-07-20 Thread Martin Morgan
L L writes: > Ok, I could solve also the latter problem by defining show.myclass function in > the zzz.R file and adding the line 'S3method(show,myclass)' into NAMESPACE > file. Now the package passes all checks. I would have, in NAMESPACE, importFrom(methods, show) exportMethods(show) and

Re: [R] class export in package creation / setClass / namespace?

2009-07-20 Thread L L
Ok, I could solve also the latter problem by defining show.myclass function in the zzz.R file and adding the line 'S3method(show,myclass)' into NAMESPACE file. Now the package passes all checks. The information on how to exactly extend existing methods and include new methods/classes into a packag

Re: [R] class export in package creation / setClass / namespace?

2009-07-20 Thread L L
Thanks, the issue was solved by adding class definitions to the zzz.R file in the R code directory. However, this led to a new problem. The zzz.R now contains class definition: > setClass("myclass", contains = "list") and method definition for the new class, extending the generic 'show': > set

[R] class export in package creation / setClass / namespace?

2009-07-09 Thread L L
Dear all, I have been trying to create an R package. This has been successfull until I tried to define classes. Currently, my procedure is the following: Start R, load the function and class definition >tmp <- function (x) {x} >setClass("rpa", contains = "list", where=topenv(parent.frame())) Us

Re: [R] Class for time of day?

2009-05-22 Thread Gabor Grothendieck
On Fri, May 22, 2009 at 1:55 PM, Stavros Macrakis wrote: > On Fri, May 22, 2009 at 12:28 PM, Gabor Grothendieck > wrote: > >> ...The way this might appear in code is if someone wanted to calculate the >> number of one hour intervals in 18 hours.  One could write: >> >> t18 <- times("18:00:00") >>

Re: [R] Class for time of day?

2009-05-22 Thread Stavros Macrakis
On Fri, May 22, 2009 at 12:28 PM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: ...The way this might appear in code is if someone wanted to calculate the > number of one hour intervals in 18 hours. One could write: > > t18 <- times("18:00:00") > t1 <- times("1:00:00") > as.numeric(t18) /

Re: [R] Class for time of day?

2009-05-22 Thread Gabor Grothendieck
On Fri, May 22, 2009 at 11:01 AM, Stavros Macrakis wrote: > On Fri, May 22, 2009 at 10:03 AM, Gabor Grothendieck > wrote: >> >> Regarding division you could contribute that to the chron package. >> I've contributed a few missing items and they were incorporated. > > Good to know.  Maybe I'll do t

Re: [R] Class for time of day?

2009-05-22 Thread Stavros Macrakis
On Fri, May 22, 2009 at 10:03 AM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: > Regarding division you could contribute that to the chron package. > I've contributed a few missing items and they were incorporated. > Good to know. Maybe I'll do that > Giving an error when it does n

Re: [R] Class for time of day?

2009-05-22 Thread Gabor Grothendieck
You could create a subclass of times with its own print and format methods that printed and formatted hours/minutes/seconds even if greater than one day if that is the main item you need. Regarding division you could contribute that to the chron package. I've contributed a few missing items and th

Re: [R] Class for time of day?

2009-05-22 Thread Stavros Macrakis
On Thu, May 21, 2009 at 8:28 PM, Gabor Grothendieck wrote: > It uses hours/minutes/seconds for values < 1 day and uses days and > fractions > of a day otherwise. > Yes, my examples were documenting this idiosyncracy. > For values and operations that it has not considered it falls back to > the

Re: [R] Class for time of day?

2009-05-21 Thread Gabor Grothendieck
On Thu, May 21, 2009 at 5:04 PM, Stavros Macrakis wrote: > On Wed, May 20, 2009 at 12:28 PM, Gabor Grothendieck > wrote: >> >> There is a times class in the chron package. > > Perfect!  Just what I was looking for. > > On Wed, May 20, 2009 at 12:19 PM, jim holtman wrote: >> >> If you want the ho

Re: [R] Class for time of day?

2009-05-21 Thread Stavros Macrakis
On Wed, May 20, 2009 at 12:28 PM, Gabor Grothendieck < ggrothendi...@gmail.com> wrote: > There is a times class in the chron package. Perfect! Just what I was looking for. On Wed, May 20, 2009 at 12:19 PM, jim holtman wrote: > If you want the hours from a POSIXct, here is one way of doing it

Re: [R] Class for time of day?

2009-05-20 Thread Gabor Grothendieck
There is a times class in the chron package. Times are measured in fractions of a day so 1/24 is one hour. > library(chron) > dt <- Sys.time() > tt <- times(format(dt, "%H:%M:%S")) > tt [1] 12:27:46 > tt + 1/24 [1] 13:27:46 There is an article on dates and times in R News 4/1. On Wed, May 20, 2

Re: [R] Class for time of day?

2009-05-20 Thread jim holtman
If you want the hours from a POSIXct, here is one way of doing it; you can create a function for doing it: > x <- Sys.time() > x [1] "2009-05-20 12:17:13 EDT" > y <- difftime(x, trunc(x, units='days'), units='hours') > y Time difference of 12.28697 hours > as.numeric(y) [1] 12.28697 > It depends o

[R] Class for time of day?

2009-05-20 Thread Stavros Macrakis
What is the recommended class for time of day (independent of calendar date)? And what is the recommended way to get the time of day from a POSIXct object? (Not a string representation, but a computable representation.) I have looked in the man page for DateTimeClasses, in the Time Series Analysi

Re: [R] Class and object problem

2008-12-25 Thread Ben Bolker
Odette Gaston gmail.com> writes: > > Dear all, > > I have a problem with accessing class attributes. > I was unable to solve this > yet, but someone may know how to solve it. My best guess at your immediate problem (doing things by hand) is that you're not using the whole vector. From your e

[R] Class and object problem

2008-12-24 Thread Odette Gaston
Dear all, I have a problem with accessing class attributes. I was unable to solve this yet, but someone may know how to solve it. I'm trying to extract some information from the summary, and Akaike weight has the desired value. Object for a model fitted using the glmmML function from the glmmML pa

Re: [R] R class accessor problem in 2.6 - FIXED

2008-02-12 Thread Joseph Wang
The reason R-swig was not working on 2.6 was that the C code was not setting the S4 flag. On 2.5, R would still treat it as an S4 class, but in 2.6, it is necessary to have this flag set for it to be treated as S4. I've checked in the fix to swig-trunk. There were no C coding changes, just a

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread Gabor Grothendieck
zoo has a NAMESPACE which restricts access to the internals of the package except for explicitly exported items. zoo exports plot.zoo as an S3 method so that the plot generic can find it. It is also possible to simply export a function not specifically as an S3 method in which case it will be visi

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
Gabor, maybe I am not understanding it right. I was thinking for example something like how a call to plot actually calls plot.zoo when zoo is loaded. And a specific call to plot.zoo would not work, etc. One would think that plot and plot.zoo are separate and that one could call the parent as well

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread Gabor Grothendieck
If you believe that certain changes intended only to affect the local environment nevertheless affect the global environment please give a code example. On Feb 6, 2008 12:11 PM, tom soyer <[EMAIL PROTECTED]> wrote: > Thanks Hardley. I see what you mean. You are right, I am not an expert in > oop A

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
Thanks Hardley. I see what you mean. You are right, I am not an expert in oop AND I don't really know how R oo works, so certainly I shouldn't be making any sweeping statement. I was just thinking about the issue of local vs. global, i.e. changes intended for the local environment shouldn't affect

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread hadley wickham
On Feb 6, 2008 10:13 AM, tom soyer <[EMAIL PROTECTED]> wrote: > Thanks Gabor. I guess true oo encapsulation is not possible in R. Before making such a claim, I would encourage you to actually learn what oo means. A couple of good readings are: Structure and Interpretation of Computer Programs. h

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
paring and contrasting the oop > syntex in > > R > > > > with that of Java. For example, the basic class structure in Java is > > like > > > > this: > > > > > > > > public class Bicycle { > > > > > > > >// *the Bicy

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread Jeffrey J. Hallman
"tom soyer" <[EMAIL PROTECTED]> writes: > (1) how do I encapsulate the generics? i.e., if a class has 100 methods, > then does it mean 100 generics would be dumped in the global environment? > Or, is it possible to define a local environment and restrict the generics > from one class to a particula

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread Gabor Grothendieck
t; > > >// *the Bicycle class has one constructor* > > >public Bicycle(int startCadence, int startSpeed, int startGear) { > > >gear = startGear; > > >cadence = startCadence; > > >speed = startSpeed; > > >} > > > > > >//

Re: [R] help with oop in R - class structure and syntex

2008-02-06 Thread tom soyer
has one constructor* > >public Bicycle(int startCadence, int startSpeed, int startGear) { > >gear = startGear; > >cadence = startCadence; > >speed = startSpeed; > >} > > > >// *the Bicycle class has four methods* &g

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Luke Tierney
On Tue, 5 Feb 2008, Barry Rowlingson wrote: > Duncan Murdoch wrote: > >> Another problem is that there are two different class systems in R: >> sometimes calls S3 and S4 (because of the versions of S where they were >> introduced). You were reading about S3. > > There's three different class sys

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Henrik Bengtsson
On Feb 5, 2008 6:06 AM, Barry Rowlingson <[EMAIL PROTECTED]> wrote: > Duncan Murdoch wrote: > > > Another problem is that there are two different class systems in R: > > sometimes calls S3 and S4 (because of the versions of S where they were > > introduced). You were reading about S3. > > There'

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Barry Rowlingson
Duncan Murdoch wrote: > Another problem is that there are two different class systems in R: > sometimes calls S3 and S4 (because of the versions of S where they were > introduced). You were reading about S3. There's three different class systems if you also include the R.oo add-on package[1

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Gabor Grothendieck
; >public Bicycle(int startCadence, int startSpeed, int startGear) { > >gear = startGear; > >cadence = startCadence; > >speed = startSpeed; > >} > > > >// *the Bicycle class has four methods* > >public void setCadence(int newVal

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Gabor Grothendieck
> >public void applyBrake(int decrement) { >speed -= decrement; >} > >public void speedUp(int increment) { >speed += increment; >} > > } > > Could one of the R experts please illustrate the R class syntex for writing > the R equivalent o

Re: [R] help with oop in R - class structure and syntex

2008-02-05 Thread Duncan Murdoch
speed -= decrement; > } > > public void speedUp(int increment) { > speed += increment; > } > > } > > Could one of the R experts please illustrate the R class syntex for writing > the R equivalent of the Java Bicycle class above? The class system in standard R has

[R] help with oop in R - class structure and syntex

2008-02-05 Thread tom soyer
= newValue; } public void applyBrake(int decrement) { speed -= decrement; } public void speedUp(int increment) { speed += increment; } } Could one of the R experts please illustrate the R class syntex for writing the R equivalent of the Java Bicycle class above

[R] R class accessor problem in 2.6

2008-02-03 Thread Joseph Wang
I was able to track down the problem that causes R-Swig to fail in 2.6. In 2.5, I am able to use the set method against '$' and '$<-' to cause expressions like r$d to get dispatched to get and set functions. This no longer seems to work in 2.6, and I was wondering if anyone can give informatio

[R] class weight

2007-10-18 Thread Weiwei Shi
Hi, I am wondering which classification algorithms in R have implemented class weight for imbalanced data prediction? Thanks. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. "Did you always know?" "No, I did not. But I believed..." ---Matrix III ___

Re: [R] Class probabilities in rpart

2007-09-17 Thread Terry Therneau
> The predict.rpart() function from the rpart library allows for > calculating the class probabilities for a given test case instead of a > discrete class label. > How are these class probabilities derived? Is it simply the proportion > of the majority class to all cases in a leaf node? Th

  1   2   >