Displaying 8 results from an estimated 8 matches for "murphyk".
Did you mean:
murphy
2001 Jul 06
1
installing tree pkg on linux
I am having trouble installing the tree package on linux.
I followed all the steps in section 5.2 of the FAQ
http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html#How%20can%20add-on%20packages%20be%20installed%3f
In particular, I typed 'R CMD INSTALL -l /home/cs/murphyk/R
tree_1.0-2.tar.gz'. This created the files 'LibIndex', 'R.css' and a
subdirectory called 'tree'.
I then created a ~/.Renviron file with the line
'R_LIBS="/home/cs/murphyk/R"'.
Inside R, I typed 'library()' and got back
Packages in library...
2001 Jul 17
3
variable number of variables in data frames
I would like to specify that certain columns in a data frame should be
treated as ordered factors. I know what numbers these columns are, but
not their names.
How do I do this?
For example, if I know columns 1:4 are to be treated as factors, I can
write
dat <- matrix(c(2,1,1,1, 1,1,1,1), 2, 4)
D <- as.data.frame(dat)
# force all variables to be treated as binary
# regardless of the small
2001 Jul 13
0
ordered factors in tree package - bug? (PR#1025)
...ted a regression tree using 4 predictors: 3 are unordered
(binary) predictors, and the last is a date (integer), which I declare
to be an ordered factor. However, the tree treats the date as if it were
un-ordered, splitting into non-consecutive subsets.
My code
dat <- read.table("/home/cs/murphyk/R/Eugene/102.dat", header=TRUE)
dat$machine <- factor(dat$machine)
dat$TIM <- factor(dat$TIM)
dat$lid <- factor(dat$lid)
#dat$date <- factor(dat$date, ordered=TRUE)
dat$date <- ordered(dat$date)
tr <- tree(TRES ~ ., dat)
produces
1) root 100 0.149300 0.2345
2) TIM: 11...
2001 Jul 13
0
ordered factors in tree package - bug?
...ted a regression tree using 4 predictors: 3 are unordered
(binary) predictors, and the last is a date (integer), which I declare
to be an ordered factor. However, the tree treats the date as if it were
un-ordered, splitting into non-consecutive subsets.
My code
dat <- read.table("/home/cs/murphyk/R/Eugene/102.dat", header=TRUE)
dat$machine <- factor(dat$machine)
dat$TIM <- factor(dat$TIM)
dat$lid <- factor(dat$lid)
#dat$date <- factor(dat$date, ordered=TRUE)
dat$date <- ordered(dat$date)
tr <- tree(TRES ~ ., dat)
produces
1) root 100 0.149300 0.2345
2) TIM: 11...
2001 Jul 20
1
frames and formulas
I can build a tree at the command line using
tr <- tree(V4 ~ ., dat)
but I don't know how to build one inside a function - the following does
not work
foo <- function(dummy) {
tr <- tree(V4 ~ ., dummy)
}
tr2 <- foo(dat)
and produces the error
Error in model.frame.default(formula = V4 ~ ., data = dummy) :
Object "dummy" not found
I know the solution has
2001 Jul 24
0
bug in residuals.rpart?
The following code
tr <- rpart(Y ~ ., dat, method="class")
dev <- residuals(tr, "deviance")
produces the following error
Error in log(x) : Non-numeric argument to mathematical function
> .Traceback
[[1]]
[1] "log(yhat)" # line 588 of rpart
[[2]]
[1] "switch(type, usual = as.integer(y != yhat), pearson = (1 -
yhat)/yhat, "
[2] "
2001 Jul 10
0
speeding up aperm/ adding repmat
Hi,
I have noticed that aperm is very slow, and I wondered if there was a
way of speeding it up.
Let me tell you a bit about the context of my problem, because perhaps
I shouldn't be using aperm at all.
The context is probabilistic inference in
graphical models. One of the most fundamental operations is two
compute an element-wise multiplication of two arrays of different
sizes, say A and B.
2001 Jul 27
3
style question: returning multiple arguments - structure or list
I have a question about what is considered good style in R.
I have a function which returns several arguments, say [x,y,z]=f(),
where sometimes I only care about the first few
(so in Matlab, I can write e.g., [x,y] = f()).
In R, there seem to be 2 ways to write this, both unsatisfying (to me):
LIST
f <- function() {
...
list(x=x,y=y,z=z)
}
res <- f()
x <- res$x; y <- res$y; z