similar to: Defining class as a member of another class

Displaying 20 results from an estimated 10000 matches similar to: "Defining class as a member of another class"

2009 Aug 30
2
aggregating irregular time series
Hi, I have a couple of aggregation operations that I don't know how to accomplish. Let me give an example. I have the following irregular time series time x 10:00:00.021 20 10:00:00.224 20 10:00:01.002 19 10:00:02:948 20 1) For each entry time, I'd like to get sum of x for the next 2 seconds
2009 Jun 24
2
lapply across using multiple columns
Hi, To set a simple an clear picture of what I'd like to do, here is an example. I would like to calculate mean of column A and B bucketed by factor in column X in a data.frame. lapply or aggregate operates on a single column. I found dapply function in some package which doesn't seem to exist any more. Is there anyway that I can accomplish something like this? Thank you so much in
2009 Aug 30
2
POSIX time conversion doesn't display digit
Hi, I have the following string that I converted to a POSIXct: > a <- "2009-08-24 10:00:00.213" > a.p <- strptime(a,"%Y-%m-%d %H:%M:%OS") > as.double(as.POSIXct(a.p)) [1] 1251122400 I can't seem to get the decimal fraction of .213 out by casting to double or numeric. Is there anyway to make sure that POSIXct spits that out? Thank you. adschai
2009 Jun 21
1
Need help installing xts package
Hi, I am trying to install package xts. I am using OPENSUSE 11 64 bit. When I invoke: install.pacakges("xts",dependencies=T) I received a lot of "ERROR: compilation failed for package" errors when R tries to install xts dependencies. I do not understand this behavior. I notice one thing. It complains. ERROR: compilation failed for package 'Hmisc' ** Removing
2009 Jun 23
1
Smart way to check if a column with certain name exists in a data.frame
Hi, I have a matrix or data.frame (df). When I would like to check if a column named "x" exists, it becomes my habit to do the following: if (length(which(colnames(df)=="x"))>0) Is there any smarter way to do this? Thank you. adschai [[alternative HTML version deleted]]
2009 Aug 12
1
Smart way to sum a column in a matrix across all members in a list
Hi, I have a list that contains about 100 elements. Each element contains the following matrix structure a b 1 1 4 2 2 5 3 3 6 I'd like to sum column b across all elements. I'm thinking of using lapply or sapply but cannot get it to work. Any help would be really appreciated. Thank you. adschai
2007 Aug 13
2
A clean way to initialize class slot of type "numeric" vector
Hi, I have a class definition like this: setClass("foo", representation(members="numeric"), prototype(members=c())) I intend my class to have members, a slot whose value should be a vector of integer. When I initialize this class, I don't have any member yet. So my member is blank. But if I run the above definition into R, it will complain that my slot members is
2007 Jun 02
1
setClass with a slot of RODBC
Hi - I tried to get some answer before but there seems to have no one response. My question is that I have a class like below definition: setClass("DBManager", representation(channel="RODBC")) My purpose of the conn slot is to hold a channel to database connection which is returned by a command like: channel <- odbcConnect("DB", uid="user",
2007 May 25
1
Question about setReplaceMethod
Hi I have the code like I show below. The problem here is that I have a setReplacementMethod to set the value of my class slot. However, this function doesn't work when I call it within another function definition (declared by setMethod) of the same class. I do not understand this behavior that much. I'm wondering how to make this work? Any help would be really appreciated. Thank you.
2009 Oct 30
3
Fast optimizer
Hi, I'm using optim with box constraints to MLE on about 100 data points. It goes quite slow even on 4GB machine. I'm wondering if R has any faster implementation? Also, if I'd like to impose equality/nonequality constraints on parameters, which package I should use? Any help would be appreciated. Thank you. rc
2009 Jun 25
1
Can hist plot % of count instead of raw count?
I do not want to use histogram because I have more control over base graphs that R provide. I'm wondering if hist function provides a parameter that can set y axis as % of count instead of raw count? If not, I'd like to know how I can add text or line on histogram function? I don't like the idea of having to use raw coordinates to set text position. Thank you. adschai [[alternative
2009 Oct 06
2
how to fit time varying coefficient regression model?
Hi - I read through dse package manual a bit. I'm not quite certain how I can use it to estimate a time varying coefficient regression model? I might pick up an inappropriate package. Any suggestion would be greatly appreciated. Thank you. rh
2007 Jun 03
1
[R] setClass with a slot of RODBC
An embedded message was scrubbed... From: David James <daj025 at gmail.com> Subject: Re: [R] setClass with a slot of RODBC Date: Sat, 02 Jun 2007 10:32:47 -0400 Size: 4053 Url: https://stat.ethz.ch/pipermail/r-devel/attachments/20070603/f3583feb/attachment.mht
2010 Aug 12
1
Need help to understand integrate function
Hi, I'm running into a wall when trying to use the integrate function. I have the following setting: powerLaw2 <- function(x,l1,l2,c0,t0) { idx <- which(x <= 0); if (length(idx) > 0) { x[idx] <- 0; } xl <- (-l1+l2)*log(x/t0); L <- log(c0)-l1*log(x)-log(1+exp(xl)); L <- exp(L); return(L); } plCDF2 <- function(x,l1,l2,c0,t0) {
2010 Mar 30
1
Adding RcppFrame to RcppResultSet causes segmentation fault
Hi, I'm a bit puzzled. I uses exactly the same code in RcppExamples package to try adding RcppFrame object to RcppResultSet. When running it gives me segmentation fault problem. I'm using gcc 4.1.2 on redhat 64bit. I'm not sure if this is the cause of the problem. Any advice would be greatly appreciated. Thank you. Rob. int numCol=4; std::vector<std::string>
2009 Jun 25
1
apply on xts
Hi, I do not understand why after I called apply on a function that returns an xts (getIdvAdjSeries) it returns a matrix whose columns are just numeric value of time series in xts instead of a list of xts objects. Basically, I called the following: apply(matrix(tickers,ncol=1),1,FUN=getDivAdjSeries) getDivAdjSeries <- function(ticker) { seriesName <-
2015 Jun 30
2
Defining a `show` function breaks the print-ing of S4 object -- bug or expected?
On 30/06/2015 1:57 PM, Hadley Wickham wrote: > A slightly simpler formulation of the problem is: > > show <- function(...) stop("My show!") > methods::setClass("Person", slots = list(name = "character")) > methods::new("Person", name = "Tom") > #> Error in (function (...) : My show! Just to be clear: the complaint is
2015 Jun 30
2
Defining a `show` function breaks the print-ing of S4 object -- bug or expected?
Hi r-devel If you define a function named `show` or attach a package with an exported `show` function, then printing/vieweing S4 objects breaks. This is probably because the `print` function calls `show`, which is now masked. Example: show <- function() {} > setClass("Person", slots = list(name = "character")) > tom <- new("Person", name =
2007 Aug 19
1
Question on R server and TinnR
Hi - Classic question that I tried to look up online and couldn't find a clear answer. It seems that I can have R to act as a server. But I never know how this works. Would anyone please provide an example or introduction material where I can learn about this? I'm trying to build an environment where computation are distributed/delegated among different servers requested whenever I need.
2007 Aug 20
2
how to collapse a list of 1 column matrix to a matrix?
Hi, I encounter a situation where I have a list whose element is a column matrix. Says, $'1' [,1] 1 2 3 $'2' [,1] 4 5 6 Is there fast way to collapse the list into a matrix like a cbind operation in this case? Meaning, the result should be a matrix that looks like: [,1] [,2] [1,] 1 4 [2,] 2 5 [3,] 3 6 I can loop through all elements and do