Dear r-helpers:
Any ideas how to avoid problem described below?
I am having the same problem when I run R remotly (not from cgi script);
somehow png device wants to talk to X11 and X11 complains...
Best regards,
Ryszard
error msg from batch R process (Linux/R-2.4.0) (executed on Apache server
f
When printing a table it is broken at some point (depending how long are
the associated names)
>>> see example below.
Is there a way to control number of columns being printed for a given
chunk of the table?
Best regards,
Ryszard
> z5
AAA BBB CCC DDD EEE FFF GGG
Consider this:
> y <- matrix(1:8, ncol=2)
> is.matrix(y[-c(1,2),])
[1] TRUE
> is.matrix(y[-c(1,2,3),])
[1] FALSE
> is.matrix(y[-c(1,2,3,4),])
[1] TRUE
It seems like an inconsistent behaviour:
- with 2 or more rows we have a matrix
- with 1 row we do not have a matrix and
- with 0 rows we have a m
g &
done
sleep 3
grep rnorm tmp[12].log
Best regards,
Ryszard
Ryszard Czerminski/PH/[EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
06/09/2004 03:24 PM
To: [EMAIL PROTECTED]
cc:
Subject:[R] how to initialize random seed properly ?
I want to start R p
I want to start R processes on multiple processors from single shell
script
and I want all of them to have different random seeds.
One way of doing this is
sleep 2 # (with 'sleep 1' I am often getting the same number)
...
set.seed(unclass(Sys.time()))
Is there a si
Is it just my installation or bug in 1.9.0 ?
The same thing works fine in 1.8.1
Best regards,
Ryszard
# R-1.9.0
library(pls.pcr)
nr <- 8; ndim <- 2
x <- matrix(rnorm(nr*ndim), nrow=nr)
y <- as.matrix(x[,1])
for (i in 2:ndim) y <- y + x[,i]
y <- y + rnorm(length(y))
m <- pls(x,y,validation='CV')
I am trying to write a function, which would allow to call various methods
and would pass to them extra arbitrary parameters.
My first attempt was to use call() as illustrated below, but apparently
'...' cannot be used in such context.
How can this be achieved ?
Best regards,
Ryszard
> myfun <-
Apparently row names are dropped when I extract
single column from a data frame. Why this behaviour ?
> y <- as.matrix(df[,1:2]); length(row.names(y))
[1] 324
> y <- as.matrix(df[,1:1]); length(row.names(y))
[1] 0
Best regards,
Ryszard
__
[EMAIL PROTE
Any ideas why read.table complains about not correct number of elements in
line
while readLine/strsplit indicate that all lines have the same number of
elements ?
R
> tbl <- read.table('tmp', header = T, sep = '\t')
Error in scan(file = file, what = what, sep = sep, quote = quote, dec =
dec,
I am trying to use prcomp and I am getting this error:
> p <- prcomp(xtr, retx = TRUE, center = TRUE, scale = TRUE, tol = NULL)
Error in La.svd(x, nu, nv, method) : error code 17 from Lapack routine
dgesdd
> dim(xtr)
[1] 301 2439
Does it mean that the matrix is to big ?
R
I would like to use tune() for tuning parameters for svm method, but it is
not clear
to me how to specify a kernel.
I am trying to use something like this:
> obj <- tune(svm, Species~., data = iris, ranges = list(kernel =
c('radial', 'linear')))
Error in pmatch(x, table, duplicates.ok) :
Hi Erin,
CLARIFICATION: I am looking for function which can calculate distances
between
rows in two different matrices (not in the same matrix as dist).
Of course I can get the desired result by using rbind() and fiddling with
indices of the result, which I already did,
but I wonder if there is
Is there a function in R (similar to dist) which would calculate
distances between rows in two different matrices ?
Ryszard
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://
es.
also, if called without crossvalidation it gives the same error:
> m <- pls(x, y, ncomp = 16)
Error in inherits(x, "data.frame") : subscript out of bounds
R
"Liaw, Andy" <[EMAIL PROTECTED]>
12/09/2003 12:50 PM
To: Ryszard Czerminski/PH/[E
When I try to use ncomp parameter in pls procedure I get following error:
> library(pls.pcr)
> m <- pls(x, y, validation = "CV", niter = 68, ncomp = 16)
Error in inherits(x, "data.frame") : subscript out of bounds
Without ncomp parameter everything seems to work OK
> dim(x)
[1] 68 116
> dim(y)
When I use
plot(..., type = "line") then ldw parameter makes a difference...
Because of large number of points overlapping I simply han an impression
before that I am getting thick line...
R
Ryszard Czerminski/PH/[EMAIL PROTECTED]
Sent by: [EMAIL PROTECTED]
11/25/200
How to control line width ?
if I do:
> postscript("IC50-density.eps", width = 4.0, height = 3.0, horizontal =
FALSE, onefile = FALSE, paper = "special", title = "IC50 distribution")
> plot(d$x, d$y, xlab = "-log10(IC50)", ylab = "density")
> lines(d$x, d$y, lwd = 0.1)
> dev.off()
but whatever v
Is there a function in R, which would return index of maximum value
in a vector ?
e.g.
> v <- round(10*rnorm(8))
> v
[1] 6 -3 -6 15 7 9 0 -19
> max(v)
[1] 15
??? index.max(v)
??? 4
__
[EMAIL PROTECTED] mailing list
https://www.stat.math.eth
I have a data frame (df) with colums x, y and z.
e.g. df <- data.frame(x = sample(4), y = sample(4), z = sample(4))
I can extract column z by: df$z or df[3]
I can also extract columns x,y by: df[1:2] or by df[-3].
Is it possible to extract x,y columns in a "symbolic" fashion i.e.
by equivalent of
I am trying to understand what is the difference between linear and
polynomial kernel:
linear: u'*v
polynomial: (gamma*u'*v + coef0)^degree
It would seem that polynomial kernel with gamma = 1; coef0 = 0 and degree
= 1
should be identical to linear kernel, however it gives m
> rng <- list(gamma = 2^(-1:1), cost = 2^(2:4))
> rng
$gamma
[1] 0.5 1.0 2.0
$cost
[1] 4 8 16
> obj <- tune.svm(pIC50 ~ ., data = data, ranges = rng)
Error in tune(svm, train.x = x, data = data, ranges = ranges, ...) :
formal argument "ranges" matched by multiple actual arguments
Ay id
This is quite strange behaviour - at least for R-novice as myself
Consider this:
> testf <- function() { x <-2; sprintf("%s %f", "x =", x); return(x) }
> result <- testf()
> testf <- function() { x <-2; sprintf("%s %f", "x =", x) }
> result <- testf()
> testf()
[1] "x = 2.00"
Apparently
I am trying to produce rather mundane output of the form e.g.
pi, e = 3.14 2.718
The closest result I achieved so far with print() is:
> print (c(pi, exp(1)), digits = 3)
[1] 3.14 2.72
> print(c("pi, e =", pi, exp(1)), digits = 3)
[1] "pi, e =" "3.14159265358979" "2.71828182845905"
I
I am starting to use svm from e1071 and I wonder how exactly
crossvalidation is implemented.
Whenever I run
> svm.model <- svm(y ~ ., data = trainset, cross = 3)
on my data I get dirrerent values for svm.model$MSE e.g.
[1] 0.9517001 1.7069627 0.6108726
[1] 0.3634670 0.9165497 1.4606322
This su
I received a lot of good advice how to remove NaN columns - thank you all
!!!
The simplest mechanism to center/scale and remove NaN columns seems to be
> xdata <- data.frame(A = 3:1, B = 1:3, rep(9, 3))
> xs <- scale(xdata)
> mask <- sapply(as.data.frame(xs), function(x) all(is.nan(x)))
> scaled.
How can I select random subsets (rows!) from a data set ?
If I generate simple data set
> a <- data.frame(x=1:2, y = NaN, z = 2:1)
> a
x y z
1 1 NaN 2
2 2 NaN 1
I can select random subsets (colums) very easily using sample function:
> sample(a, 2)
z y
1 2 NaN
2 1 NaN
I expected that us
Nice!
I noticed that in generated structure it has two attributes
attr(,"scaled:center") and attr(,"scaled:scale")
How can I access them ?
R
Giovanni Petris <[EMAIL PROTECTED]>
10/24/2003 02:50 PM
Please respond to Giovanni Petris
To: Ryszard Czer
It is minor thing, but how can I avoid converting "_" to "." ?
e.g. I have a data set "test.csv"
A,A_B,A_C,C,D
X,11,0,13,14
Y,21,0,23,24
and when I read it all underscores are converted to dots (:<)
> d <- read.csv("test.csv")
> d
A A.B A.C C D
1 X 11 0 13 14
2 Y 21 0 23 24
Ryszard
How can I remove columns with NaN entries ?
Here is my simple example:
> data <- read.csv("test.csv")
> xdata <- data[3:length(data)]
> xs <- lapply(xdata, function(x){(x - mean(x))/sqrt(var(x))})
> x <- data.frame(xs)
> x
C D EF
1 -0.7071068 N
29 matches
Mail list logo