One can always use the often-overlooked sweep():
a - matrix(2:7,2,3)
b - matrix(1:2,2,1)
sweep(a,1,b)
[,1] [,2] [,3]
[1,]135
[2,]135
best
rksh
On 6 Mar 2006, at 23:10, Michael wrote:
Hi all,
I want to substract vector B from A's each column... how
Hi
If you do not insist on which.max() you can use
which(mat==max(mat), arr.ind=T)
HTH
Petr
On 6 Mar 2006 at 20:55, Michael wrote:
Date sent: Mon, 6 Mar 2006 20:55:20 -0800
From: Michael [EMAIL PROTECTED]
To: R-help@stat.math.ethz.ch
Alex == Alexander Nervedi [EMAIL PROTECTED]
on Mon, 06 Mar 2006 17:31:40 + writes:
Alex Hi All, I have found the function poly(), that
Alex computes orthogonal polynomials. I was wondering if
Alex there are users of this function on the list. What
Alex kind of an
On 06-Mar-06 Michael wrote:
Hi all,
I want to substract vector B from A's each column... how can R do that
smartly without a loop?
A=matrix(c(2:7), 2, 3)
A
[,1] [,2] [,3]
[1,]246
[2,]357
B=matrix(c(1, 2), 2, 1)
B
[,1]
[1,]1
[2,]2
A-B
R.version
_
platform i486-pc-linux-gnu
arch i486
os linux-gnu
system i486, linux-gnu
status
major2
minor1.1
year 2005
month06
day 20
language R
Dear list,
how can I disable lazy-loading in 'install.packages(some packages)'?
I know of the possiblity to
Hi,
I have problems creating a new mapping for a postscript font.
I want to use the font-family TheSans from Luc(as) de Groot.
The font only holds a .PFM file but no .afm file.
The. PFM looks similary to those in grDevices\afm
When i use postcriptFont(), i get an error!
ivalid font metric
Well, yes, you do need an afm file, as it says.
On Tue, 7 Mar 2006, Roland Kaiser wrote:
Hi,
I have problems creating a new mapping for a postscript font.
I want to use the font-family TheSans from Luc(as) de Groot.
The font only holds a .PFM file but no .afm file.
The. PFM looks similary to
Why do you want to?
As from a near-future version of R, you will not be able to do this via R
CMD INSTALL. The recommended place to specify this is in the packages'
DESCRIPTION files, and why do you think you know better than the packages'
authors? (Quite a few packages will not work with it
Hello R-users
Is it possible to fit a three level linear mixed effect model in R?
If anyone has an idea or sample code, i will appreciate it very much if i can
receive it.
I am reading the book by Pinheiro and Bates but have not come across that yet!
Kind regards
I'm a newcomer - obvioulsly I fear. Tried to install RODBC from CRAN
mirror onto mahcine 64bit running suse10.
terminal log below - it failed on ODBC headers sql.h and sqlext.h not
found
di i need anothe rpackage??
can someone help please?
ta v much
Prof R Gott
Durham UNiv, UK
Hm ..., at the risk of seeming facetious, can I suggest
three.layers - lme(response ~ predictors,
random = ~ 1 | one / two / three,
data = very.large.dataset)
??
Cheers
Andrew
On Tue, Mar 07, 2006 at 01:35:19AM -0800, Pryseley Assam wrote:
Hello
Because I get the follwoing message:
---
** R
** data
** demo
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), keep.source) :
there is no package called 'sp'
Execution halted
ERROR: lazy
Ulrich Leopold wrote:
Because I get the follwoing message:
---
** R
** data
** demo
** inst
** preparing package for lazy loading
Error in loadNamespace(i, c(lib.loc, .libPaths()), keep.source) :
there is no package called
Use install.packages(dependencies=TRUE).
It won't load if you disable lazy-loading, so that was not a solution.
On Tue, 7 Mar 2006, Ulrich Leopold wrote:
Because I get the follwoing message:
---
** R
** data
** demo
** inst
**
Hi R-Experts,
How can I show all the relevant measures like mean, median, min. value,
max. value, outlier in a single boxplot diagram?
Suppose I have a data set c(2,4,5,7,12,14,15,13,8,5,23,98,11)
Sumanta Basak.
[[alternative HTML version deleted]]
R Gott wrote:
I'm a newcomer - obvioulsly I fear. Tried to install RODBC from CRAN
mirror onto mahcine 64bit running suse10.
terminal log below - it failed on ODBC headers sql.h and sqlext.h not
found
di i need anothe rpackage??
can someone help please?
The root directory of that
On Tue, 7 Mar 2006, Prof Brian Ripley wrote:
Use install.packages(dependencies=TRUE).
It won't load if you disable lazy-loading, so that was not a solution.
Is this perhaps what happens when a package introduces a dependency
between revisions, so update.packages() is not going to notice a
On Tue, 7 Mar 2006, R Gott wrote:
I'm a newcomer - obvioulsly I fear. Tried to install RODBC from CRAN
mirror onto mahcine 64bit running suse10.
Well, we need to know more than that: see the posting guide for how to
report your platform. It may matter which 64-bit platform.
terminal log
On Tue, 7 Mar 2006, Roger Bivand wrote:
On Tue, 7 Mar 2006, Prof Brian Ripley wrote:
Use install.packages(dependencies=TRUE).
It won't load if you disable lazy-loading, so that was not a solution.
Is this perhaps what happens when a package introduces a dependency
between revisions, so
Hello,
I want to create a plot whit plotMeans.
How can I change the font?
Thanks in advance.
Teresa Boca
__
[[alternative HTML version deleted]]
__
You can always use points()
mat - matrix(rnorm(360),nrow=10)
boxplot(mat~col(mat))
means - apply(mat,2, mean)
points(1:36,means,pch=X,col=red)
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Sumanta Basak
Sent: 07 March 2006 09:55
To:
Sumanta Basak wrote:
Hi R-Experts,
How can I show all the relevant measures like mean, median, min. value,
max. value, outlier in a single boxplot diagram?
Suppose I have a data set c(2,4,5,7,12,14,15,13,8,5,23,98,11)
Your e-mail address suggests this is not a homework
you mean that you want something like:
x - c(2,4,5,7,12,14,15,13,8,5,23,98,11)
sx - summary(x)
boxplot(x)
text(x = 1 - 0.3, y = seq(40, 70, length = 6), paste(names(sx), : ,
sx, sep = ))
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of
We would like to announce the availability of the 'portfolio' package
in R for analysing equity portfolios. Version 0.2-0 is now available
on CRAN. To take a look, you can:
install.packages(portfolio)
...
vignette(portfolio)
and play around. Those who would just like to check out an
Is there a function in R for constrained linear least squares?
I used the matlab function LSQLIN: my aim is to obtain
non-negative regression coefficients which sum 1.
Thanks in advance,
domenico vistocco
___
Yahoo! Mail:
Dear R-users,
I would like to build N tkentry compounds in the same window, with
default text for each. As N is variable I need to construct them in an
iterative way :
library(tcltk)
main-tktoplevel()
tktitle(main)-My Tool
filenames-c(toto,tata,titi)
N-length(filenames)
for (i in 1: N)
Folks,
I know that I can do the following using a loop. That's been a lot
easier for me to write and understand. But I am trying to force myself
to use more vectorized / matrixed code so that eventually I will
become a better R programmer.
I have a dataframe that has some values by Year, Quarter
The manual entry for as.POSIX says this about time zone codes...
Usage
as.POSIXct(x, tz = )
tz
A timezone specification to be used for the conversion...
but it fails to mention what these specifications are. So far, I
have tried...
as.POSIX(x, tz=UTC) ... works, gives UTC times
Try this:
iris.by - do.call(rbind, by(iris[,-5], iris[,5,drop=FALSE],colSums))
do.call(rbind, iris.by)
On 3/7/06, Vivek Satsangi [EMAIL PROTECTED] wrote:
Folks,
I know that I can do the following using a loop. That's been a lot
easier for me to write and understand. But I am trying to force
[EMAIL PROTECTED] writes:
Dear R-users,
I would like to build N tkentry compounds in the same window, with
default text for each. As N is variable I need to construct them in an
iterative way :
library(tcltk)
main-tktoplevel()
tktitle(main)-My Tool
filenames-c(toto,tata,titi)
Whoops,
[EDIT]
as.POSIX(x, tz=UTC) ... works, gives UTC times
as.POSIX(x, tz=EST) ... works, gives EST times
as.POSIX(x, tz=CST) ... does NOT work, gives UTC times
[/EDIT]
On Mar 7, 2006, at 8:05 AM, Jason Horn wrote:
as.POSIX(x, tz=UTC) ... works, gives UTC times
as.POSIX(x, tz=UTC)
Sorry, that should be:
iris.by - by(iris[,-5], iris[,5,drop=FALSE],colSums)
do.call(rbind, iris.by)
On 3/7/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
Try this:
iris.by - do.call(rbind, by(iris[,-5], iris[,5,drop=FALSE],colSums))
do.call(rbind, iris.by)
On 3/7/06, Vivek Satsangi [EMAIL
Dear Alexandre,
It is possible to do what you want. Take a look, for example, at the dialog
box produced by Statistics - Contingency tables - Enter and analyze
two-way table in the Rcmdr package. That dialog box is able to modify
itself and to keep variables for an arbitrary number of tkentry()
For a general solution without warnings try
interleave - function(v1,v2)
{
ord1 - 2*(1:length(v1))-1
ord2 - 2*(1:length(v2))
c(v1,v2)[order(c(ord1,ord2))]
}
interleave(rep(1,5),rep(3,8))
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Gabor
Dear R-users
I am relatively new to R, i hope my many novice questions are welcome.
I have problems accessing some objects (specifically the random effects,
correlation structure and variance function) from an object of class gls and
lme.
I used the following models:
On 3/7/06 8:29, John Fox [EMAIL PROTECTED] wrote:
Dear Alexandre,
It is possible to do what you want. Take a look, for example, at the dialog
box produced by Statistics - Contingency tables - Enter and analyze
two-way table in the Rcmdr package. That dialog box is able to modify
itself
This is a problem how to convert vector indices to array indices. Here
is a general solution utilizing the fact that matrices are stored
column by column in R (this extends to arrays of any dimension):
arrayIndex - function(i, dim) {
ndim - length(dim); # number of dimension
v -
Only and GMT are really guaranteed to work on all systems
since the time zones are system dependent but try: CDT6CST
and see if that works on your system.
On 3/7/06, Jason Horn [EMAIL PROTECTED] wrote:
Whoops,
[EDIT]
as.POSIX(x, tz=UTC) ... works, gives UTC times
as.POSIX(x, tz=EST) ...
Dear Sean,
That was Peter Dalgaard's suggestion, posted a little while ago. It's a much
better solution to Alexandre's problem than what I suggested. I'm not sure
that it would work for the Rcmdr dialog that I mentioned, but I'll take a
look when I have a chance.
Regards,
John
Dear R-users,
I am checking the proportional hazard assumption of a cox model for a
given covariate, let say Z1, after adjusting for other relavent covariates
in the model. To this end, I fitted cox model stratified on the discrete
values of Z1 and try to get beslow estimator for the baseline
Thank you again Gabor, that did the trick. Any thoughts on where I
go go for a reference for these time codes? Where did you get
CDT6CST from? Or is this just one of those things that is common
knowledge in UNIX circles.
To the R developers: I recommend a sentence be added to the manual
The function 'basehaz' computes the predicted survivor function for a Cox
prop hazards model centered (at the average values of the covariates) or
non-centered (at zero level of covariates).
As far as the estimator used, basehaz defaults to the Nelson-Aalen estimate
of the cumulative hazard with
Each OS would presumably have to document it. I personally
use Windows and in that case there is some info here:
http://msdn2.microsoft.com/en-us/library/90s5c885.aspx
On 3/7/06, Jason Horn [EMAIL PROTECTED] wrote:
Thank you again Gabor, that did the trick. Any thoughts on where I
go go for a
I am writing to document the answer for the next poor sod who comes along.
To get tmp_byRet() into a multi-dimentional matrix, copy the object
using as.vector(), then copy the dim and dimnames from tmp_byRet into
the new object. However, this may not be what you want, since you
probably want the
Another solution (ex #3) is to return a data frame with at least two columns
and then remove the dummy one using drop = FALSE:
# ex #1. error
iris.by - by(iris, iris[,5, drop = FALSE], length)
do.call(rbind, iris.by)
# ex #2. ok but no column heading
iris.by - by(iris, iris[,5, drop=FALSE],
Say you have a POSIX object that is in UTC. How do you change the
values to another timezone?
If I do this:
times - strptime(times, %H:%M:%S)
times1 - as.POSIXct(times, tz=UTC)
times2 - as.POSIXct(times, tz=CDT6CST)
times1 id UTC, but times2 is still UTC, not CTD. Why? Is the only
was to
POSIX objects are UTC internally but can be displayed
with respect to other time zones.
By the way, do you really need time zones in the first
place? Read R News 4/1 help desk article which will
help you determine which date/time class is
suitable for your application and also has a table
of
hi,
I am trying to fit an ARIMA model to some time series data, I have used
differencing to make the data stationary.
dailyibm is the data I am using, could someone please help out in identifying
the coding as I can't seem to identify the problem
many thanks
fit.ma - arima.sim(dailyibm -
Dear Prof. Gott,
On Monday 06 March 2006 14:37, R Gott wrote:
Does anybody know of aything that will help me do Quantitiative
Comparative Analysis (QCA) and/or Fuzzy set analysis?? Or failing that
Quine?
ta
rg
Prof R Gott
Durham Univesrity
UK
There is a package called QCA which (in its
Could someone please provide a examples regarding best practice for
grouping and/or categorization of data?
E.g., if I have a data page with columns X,CAT where CAT is an integer
1-10, and I want to create a new data page where for each value of CAT I
have the sum(X)?
E.g., I have same
On 3/7/06 2:20 PM, Andrew Athan [EMAIL PROTECTED] wrote:
Could someone please provide a examples regarding best practice for
grouping and/or categorization of data?
E.g., if I have a data page with columns X,CAT where CAT is an integer
1-10, and I want to create a new data page where
Hello,
I have two problems in automating multiple glm(s) operations.
The data file is tab delimited file with headers and two columns. like
ABC EFG
1 2
2 3
3 4
dat - read.table(FILENAME, header=TRUE, sep=\t, na.strings=NA,
dec=., strip.white=TRUE)
dataf - read.table(FILENAME,
I think this is the best solution! Thank you!
On 3/7/06, Petr Pikal [EMAIL PROTECTED] wrote:
Hi
If you do not insist on which.max() you can use
which(mat==max(mat), arr.ind=T)
HTH
Petr
On 6 Mar 2006 at 20:55, Michael wrote:
Date sent: Mon, 6 Mar 2006 20:55:20 -0800
I agree that that is the best solution although not to the
question as stated which said: I want to use which.max
On 3/7/06, Michael [EMAIL PROTECTED] wrote:
I think this is the best solution! Thank you!
On 3/7/06, Petr Pikal [EMAIL PROTECTED] wrote:
Hi
If you do not insist on
[.ggobiDataset - function(x, ..., drop=FALSE) {
x - as.data.frame(x)
NextMethod([, x)
}
[[.ggobiDataset - function(x, ..., drop=FALSE) {
x - as.data.frame(x)
NextMethod([[, x)
}
$.ggobiDataset - function(x, ..., drop=FALSE) {
x - as.data.frame(x)
If your class is a subclass of data.frame then I think
it ought to be a special sort of data frame so all you
need to do is the following in which case you get subscripting
for free by inheritance:
# constructor
myobj - function(...)
structure(data.frame(...), class = c(myobj,
How do I manipulate the read.table function to read in only the 2nd
column???
[[alternative HTML version deleted]]
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide!
Hi all,
What parameter do I normally change in the rpart function? How do I set the
cp option?
Is there a way to read off error rate directly from the rpart function for
training data; I imagine for testing data I have to apply a predict, but
for training data I guess the error count would
If your class is a subclass of data.frame then I think
it ought to be a special sort of data frame so all you
need to do is the following in which case you get subscripting
for free by inheritance:
My class is actually an external pointer to a data set stored in
ggobi, so I don't think this
mark salsburg [EMAIL PROTECTED] writes:
How do I manipulate the read.table function to read in only the 2nd
column???
If your data is small, you can read in all columns and then subset the
resulting data frame. Try that first.
Perhaps there is a nicer way to do this that I don't know about,
mark salsburg [EMAIL PROTECTED] writes:
How do I manipulate the read.table function to read in only the 2nd
column???
Something along the lines of
cc - rep(NULL, ncols)
cc[2] - NA # use type.convert
read.table( colClasses=cc )
--
O__ Peter Dalgaard Ă˜ster
mark salsburg wrote:
How do I manipulate the read.table function to read in only the 2nd
column???
Se the colClasses argument of read.table()
Kjetil
[[alternative HTML version deleted]]
__
R-help@stat.math.ethz.ch mailing list
You are not reading the Help file correctly. It says:
Character.A vector of classes to be assumed for the columns. Recycled as
necessary.
colClasses=NULL) means that you have no colClasses argument. It does exactly
what you tell it to (use whatever defaults it has, inother
read.table(datafile, colClasses=c(NULL, numeric), ...)
or something like that.
Andy
From: mark salsburg
How do I manipulate the read.table function to read in only
the 2nd column???
[[alternative HTML version deleted]]
__
I have a group of data.frames that I need to write out interspersed with
some complex header information at the top of each. The file needs include
many such data.frame/header pairs. Is it as simple as using a connection
and printing to it everything (including tabs and endlines, etc.), or is
You might want to read
?scan and pay attention to what= argument
Jean
mark salsburg wrote:
How do I manipulate the read.table function to read in only the 2nd
column???
[[alternative HTML version deleted]]
__
R-help@stat.math.ethz.ch mailing
If you know what the dependent variable is called and is the same for
all regressions see
?formula
Or you can do glm(ABC~. , ...,data=dat)
PS. the way you are calling the formula you are taking the first element
in the first column and the first element in the second column. So that
is not
Hi.
On 3/7/06, hadley wickham [EMAIL PROTECTED] wrote:
[.ggobiDataset - function(x, ..., drop=FALSE) {
x - as.data.frame(x)
NextMethod([, x)
}
[[.ggobiDataset - function(x, ..., drop=FALSE) {
x - as.data.frame(x)
NextMethod([[, x)
}
$.ggobiDataset -
x$total_bill
Error in $.default(x, total_bill) : invalid subscript type
where/how is $.default() defined? I don't have one;
getAnywhere($.default)
no object named '$.default' was found
Neither do I. I guess there is some internal magic going on for $.
Hadley
Just to get something reproducible lets assume the
objects of class myobj each consists of a one-element
list that contains a data frame. Then try this:
# constructor
myobj - function(...)
structure(list(value = data.frame(...)), class = myobj)
$.myobj - function(obj, x) .subset2(obj,
On 3/7/06 5:10 PM, Sean Davis [EMAIL PROTECTED] wrote:
I have a group of data.frames that I need to write out interspersed with
some complex header information at the top of each. The file needs include
many such data.frame/header pairs. Is it as simple as using a connection
and printing
Just to get something reproducible lets assume the
objects of class myobj each consists of a one-element
list that contains a data frame. Then try this:
Thanks for that - it makes sense. Every time I try to use inheritance
in R, I always seem to end up using a different method.
Hadley
On 3/7/06, hadley wickham [EMAIL PROTECTED] wrote:
Just to get something reproducible lets assume the
objects of class myobj each consists of a one-element
list that contains a data frame. Then try this:
Thanks for that - it makes sense. Every time I try to use inheritance
in R, I
I tend to have to use trial and error myself. Here is another
possibility.
That's got the subsetting solved, so here's the next challenge
lm(x ~ y, z)
Error in as.data.frame.default(data) : cannot coerce class myobj
into a data.frame
as.data.frame.myobj - function(x) x[[1]]
lm(x ~ y, z)
Hi all,
I am trying to play around with the randomForest function for
classification. I know its performance is great.
I am currently using the default options.
It has many options.
How do I further tweak the options so that I can make its performance even
better?
What are the options that
When I plot the randomForest object, it shows a graph with 3 lines, green,
red and black, what's the meaning of these three lines?
On 3/7/06, Michael [EMAIL PROTECTED] wrote:
Hi all,
I am trying to play around with the randomForest function for
classification. I know its performance is
The problem is that x[[1]] in the definition of as.data.frame.myobj
invokes [[.myobj whereas we want to extract the first element of the
list in the internal representation of x -- which is not the same.
Try this instead:
as.data.frame.myobj - function(x) .subset2(x, 1)
lm(y ~ x, z)
Call:
As ?plot.randomForest says, it plots error rates. In addition to overall
error rates, it also plots error rates for each class.
As to the options in randomForest, read about the options in the help page
and the reference linked from the help page.
Andy
From: Michael
When I plot the
2006/3/8, A Mani [EMAIL PROTECTED]:
Hello,
I have two problems in automating multiple glm(s) operations.
The data file is tab delimited file with headers and two columns. like
ABC EFG
1 2
2 3
3 4
dat - read.table(FILENAME, header=TRUE, sep=\t, na.strings=NA,
dec=.,
It did not have a legend showing on which color is for class1, which color
is for class2, etc...
I've read the R-help page.
It lists a lot of options, but it did not say which ones are the key
parameters that people use most for improving performance...
Do you know?
On 3/7/06, Liaw, Andy
From: ronggui
2006/3/8, A Mani [EMAIL PROTECTED]:
Hello,
I have two problems in automating multiple glm(s)
operations.
The data file is tab delimited file with headers and two
columns. like
ABC EFG
1 2
2 3
3 4
dat - read.table(FILENAME, header=TRUE, sep=\t,
Yes, I do know. That's why I pointed you to the reference linked from the
help page.
BTW, there's also an R News article describing the initial version of the
package. Have you perused that?
Andy
-Original Message-
From: Michael [mailto:[EMAIL PROTECTED]
Sent: Tuesday, March 07,
Hello all,
I set 'UDUNITS_PATH' and 'NETCDF_PATH' successfully to my custom places and
then
% R CMD INSTALL RNetCDF_1.1-3.tar.gz
and got this:
...
checking for executable suffix...
checking for object suffix... o
checking whether we are using the GNU C compiler... yes
checking whether gcc
After an RSiteSeach(Box.test) I found some discussion regarding the degrees
of freedom in the computation of the Ljung-Box test using Box.test(), but did
not find any posting about the proper degrees of freedom.
Box.test() uses lag=number as the degrees of freedom. However, I believe
the
84 matches
Mail list logo