Displaying 20 results from an estimated 4000 matches similar to: "[R] setClass with a slot of RODBC"
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 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 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.
2019 Jan 10
2
setClass accepts slot-mismatch between slots and prototype arguments
I was installing the 'diffobj' package into TERR and got an error from the
call
StyleSummary <- setClass("StyleSummary",
slots=c(container="ANY", body="ANY", map="ANY"),
prototype=list(
container=function(x) sprintf("\n%s\n", paste0(x, collapse="")),
body=identity,
detail=function(x) sprintf("\n%s\n",
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
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 May 26
0
How to assign RODBC object as R class slots and method signature
HiI have a class which would like to hold a connection to ODBC data connection. The handle to the connection is something like (according to RODBC manual):channel = odbcConnect("DSN",uid="user",pwd="password")However, I would like to make a slot of my "foo" class to hold this object. For example:setClass("foo",
2008 Sep 15
2
S4 coercion responsibility
Should functions or the user be responsible for coercing an S4 object
argument containing the proper object (and thus should below be
considered a bug in the packages or not)?
The example is with RSQLite but the same thing happens with RMySQL, and
other DBI packages.
> library("RSQLite") Loading required package: DBI
> m <- dbDriver("SQLite")
> con <-
2007 Mar 18
2
Lag operator in R does not work
Hi - I'm quite wondering what makes the lag operator does not work for my time series. I have a time series of length about 200000 elements. I would like to have a lag 1 of this time series. I did the following:
logprice = log(price, base=exp(1))
# this is my log price which is a vector of price time series of length 200000
ts_logprice = as.ts(logprice, frequency=1) # convert to time series
2007 Jun 04
2
How to obtain coefficient standard error from the result of polr?
Hi - I am using polr. I can get a result from polr fit by calling
result.plr <- polr(formula, data=mydata, method="probit");
However, from the 'result.plr', how can I access standard error of the estimated coefficients as well as the t statistics for each one of them?
What I would like to do ultimately is to see which coefficients are not significant and try to refit the
2007 Jun 09
1
How to plot vertical line
Hi,I have a result from polr which I fit a univariate variable (of ordinal data) with probit function. What I would like to do is to overlay the plot of my fitted values with the different intercept for each level in my ordinal data. I can do something like:lines(rep(intercept1, 1000), seq(from=0,to=max(fit),by=max(fit)/1000))where my intercept1 is, for example, the intercept that breaks between
2007 Jul 05
2
Question for svm function in e1071
Hi,
Sorry that I have many questions today. I am using svm function on about 180,000 points of training set. It takes very long time to run. However, I would like it to spit out something to make sure that the run is not dead in between. Would you please suggest anyway to do so?
And is there anyway to speed up the performance of this svm function? Thank you.
- adschai
2009 Jun 28
1
Defining class as a member of another class
Hi,
When I define a new class (through setClass), members defined in
representation argument doesn't seem to like a class. For example, if
I do the following:
setClass("NotWork",representation=(x="zoo"))
It seems to me that representation members will take in only primitive
type to R. Is there any way to stuff a class as a member in another
class? Thank you.
- adschai
2007 Aug 13
1
Data structure in R
Hi,
I have a question around how to build data structure in R. I have to implement a tree structure of data. I'm wondering if R already has something like a tree where I can extend from or I need to start from scratch. If so, what would be the most effective way to represent parent and child node relationship? I realize that R is not based on pointer so it's quite a different paradigm for
2007 Apr 09
1
Dealing with large nominal predictor in sem package
Hi,
I am using tsls function from sem package to estimate a model which includes large number of data. Among its predictors, it has a nominal data which has about 10 possible values. So I expand this parameter into 9-binary-value predictors with the coefficient of base value equals 0. I also have another continuous predictor.
The problem is that, whenever I run the tsls, I will get 'System
2007 Jun 27
1
levelplot in lattice
Hi,
I'm new to lattice. So please kindly be patient with me.
I'm trying to arrange groups of levelplots into 3 rows as follows:
Row1: Probabilities as functions of x and y, and conditioned on an event factor vector factor("a","b","c")
Row2: Number of days as functions of x and y, and conditioned on, again the same event
2007 Nov 15
3
kalman filter estimation
Hi,
Following convention below:
y(t) = Ax(t)+Bu(t)+eps(t) # observation eq
x(t) = Cx(t-1)+Du(t)+eta(t) # state eq
I modified the following routine (which I copied from: http://www.stat.pitt.edu/stoffer/tsa2/Rcode/Kall.R) to accommodate u(t), an exogenous input to the system.
for (i in 2:N){
xp[[i]]=C%*%xf[[i-1]]
Pp[[i]]=C%*%Pf[[i-1]]%*%t(C)+Q
siginv=A[[i]]%*%Pp[[i]]%*%t(A[[i]])+R
2007 Apr 15
1
Fit sem model with intercept
Hi - I am trying to fit sem model with intercepts. Here is what I have in my model.
Exogeneous vars: x1 (continous), x2 (ordinal), x3 (ordinal), x4(continuous)
Endogeneous vars: y1 (continuous), y2 (ordinal), y3 (ordinal)
SEM model:
x1 -> eta1; x2 -> eta1; x3 -> eta2; x4 -> eta2; eta1 -> y1, eta1 -> y2, eta2 -> y2, eta2 -> y3
However, in these arrow models, I
2007 Apr 21
1
Fitting multinomial response in structural equation
Hi - I am confronting a situation where I have a set of structural equation and one or two of my responses are multinomial. I understand that sem would not deal with the unordered response. So I am thinking of the following two ways:
1. Expanding my response to a new set of binary variables corresponding to each label of my multinomial response. Then use each of these as a separate response in my
2007 Aug 11
1
R Weka and cobweb
Hi,
I never use cobweb before and I'm quite new to this. I have a couple of questions around the cobweb implementation in R Weka. If you could supply answer or insight, I would really appreciate.
1. From Fisher's paper in 1987, it seems that Cobweb only deals with nominal data. In R Weka cobweb, is it allowed to accommodate real/continuous value?
2. My understanding is that Cobweb