Hi
Or mabe easier in this case
b - a+1-(a==0)
HTH
Petr
On 17 Jan 2006 at 5:31, tom wright wrote:
From: tom wright [EMAIL PROTECTED]
To: Andrej Kastrin [EMAIL PROTECTED]
Date sent: Tue, 17 Jan 2006 05:31:53 -0500
Copies to:
try:
DF2 - as.data.frame(matrix(vec, nr=nrow(DF),nc=ncol(DF))==
matrix(1:ncol(DF),nr=nrow(DF),nc=ncol(DF),byrow=T))
DF3 - data.frame(mapply(function(z,x,y) { x[y] - 0 ; x },
names(DF), DF, DF2, SIMPLIFY=F))
but there must be an easier way...
Kenneth Cabrera a écrit :
Hi, R
Hi
eg. your data frame has 35 rows and 6 columns
a-sample(1:6, 35, replace=T)
b-1:35
vec-rep(0,35*6)
vec[a+6*(b-1)]-1
This shall do the replacement
your.d.f[matrix(vec,35,6, byrow=T)==1] - 0
But I am not sure if it is quicker than a loop.
HTH
Petr
On 18 Jan 2006 at 2:35, Kenneth Cabrera
r-help,
I am trying to compile R on an powerpc-IBM-AIX5.1.0.0 machine, Is R
suitable to be used in this system? The R Installation and Administration
document mentioned rs6000-ibm-aix not powerpc-IBM-AIX5.1.0.0 .
When I tried to compile R.2.2.0 in powerpc-IBM-AIX5.1.0.0 using the
you could try something like the following:
dat - data.frame(matrix(rnorm(200), 20, 10))
index - sample(10, 20, TRUE)
###
mat.ind - matrix(FALSE, nrow(dat), length(dat))
mat.ind[cbind(seq(along = index), index)] - TRUE
dat[mat.ind] - 0
index
dat
I hope it helps.
Best,
Dimitris
Own Color Palette
Dear all,?xml:namespace prefix = o ns =
urn:schemas-microsoft-com:office:office /o:p/o:p
I would like to generate a contour-plot according to a master plot. The problem
is that the rainbow-palette included in R does not answer this purpose. I need
a darker blue, no
On Wed, 18 Jan 2006, Robert Michael Rausch wrote:
?colorRampPalette
Own Color Palette
Dear all,?xml:namespace prefix = o ns =
urn:schemas-microsoft-com:office:office /o:p/o:p
I would like to generate a contour-plot according to a master plot. The
problem is that the rainbow-palette
Dear R-users
I have problems using lme
The model i want to fit can be viewed as a two-level bivariate model
Two-level bivariate: bivariate (S coded as -1,T coded as 1) endpoint within
trial
OR
It can equivalently be considered as a three-level model.Three-level:
endpoint
Hi all. Sorry for any confusion. At one point, close to a year ago I
think, I put in the effort to get the bugs() function in R to work with
OpneBUGS. But at the time, I couldn't get OpenBUGS to do much. After
some effort I got it to work on some simple examples but I couldn't get
it to
Hi,
As the message pointed out, the current linker cannot produce share library.
However gcc used option -bdynamic, is that for share library? I guess. Need
to read its gcc manual.
It might be caused by very slight difference of the gcc compiler in your AIX.
Please seek for Zhao Wei's
I have been trying to find which par settings can help me avoid
truncated text at the bottom of the y axis in a mosaic plot (created
when I plot a result of a 2d xtabs) without much success. Using las=1
has helped but the text (the 500+ level) is still cropped.
I get the same result on
Andrew Gelman wrote:
Hi all. Sorry for any confusion. At one point, close to a year ago I
think, I put in the effort to get the bugs() function in R to work with
OpneBUGS. But at the time, I couldn't get OpenBUGS to do much. After
some effort I got it to work on some simple examples
Uwe,
Does coda put parameters into arrays based on their names? I had the
impression that coda just considered parameters as one very long vector
(as in the summary output inside the Bugs window), hence it would not
make those nice graphs on the right side of the output from plot()
applied
Use par(xpd=TRUE).
On Wed, 18 Jan 2006, paul sorenson wrote:
I have been trying to find which par settings can help me avoid
truncated text at the bottom of the y axis in a mosaic plot (created
when I plot a result of a 2d xtabs) without much success. Using las=1
has helped but the text
I am trying to send a manuscript to a journal.
One of the figures build by R is in the right orientation and 4 are rotated
clockwise 90 deg in the preview.
I used the right click save to PS option and I used the command line
postscript(c:/temp/fig04.eps,bg=transparent,onefile = TRUE
Folks,
I do a series of regressions (one for each quarter in the dataset) and
then go and extract the residuals from each stored lm object that is
returned as follows:
vResiduals - as.vector(unlist(resid(lQuarterlyRegressions[[i]])));
Here lQuarterlyRegressions is a vector of objects returned
On 1/18/2006 2:35 AM, Kenneth Cabrera wrote:
Hi, R users:
I have a data.frame (not a matrix), I got a vector with the same length
as the
number of records (rows) of the data frame, and each element of
that vector is the column number (in a specific range of columns) of the
corresponding
Hello all,
This is to announce the creation of R-sig-wiki, a new R SIG (Special
Interest Group) mailing list dedicated to the elaboration and
maintenance of a R Wiki. You can subscribe at:
https://stat.ethz.ch/mailman/listinfo/r-sig-wiki. There is currently a
prototype for a new R Wiki at
I am having problems with comparing individual means in a
within-subjects ANOVA. From my understanding, TukeyHSD is not
appropriate in this context. So I am trying to compute contrasts, as
follows:
seven subjects participated in each of 6 conditions (intervals).
subject = factor(rep(c(1:7),
Last week Giovanni Parrinello posted a message asking why various packages were
loaded when he loaded an .Rdata file. Brian Ripley replied saying he thought it
was because the saved workspace contained a reference to the namespace of
ipred. (Correspondence copied below).
This begs the
Dear group,
I am nearly beside myself. After an entire night spent on a niggling
little detail, I am no closer to to the truth. I loaded an Excel file in .csv
form into R. It apparentely loads as a list, but not the kind of list you can
use. Oh no, it converts into a list that
The option se.fit in predict.nls is currently ignored.
Is there any other function available to calculate the
error in the predictions?
Thanks,
Manuel
__
LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1
?unlist
y - list(1,2,3,4,5)
y
[[1]]
[1] 1
[[2]]
[1] 2
[[3]]
[1] 3
[[4]]
[1] 4
[[5]]
[1] 5
unlist(y)
[1] 1 2 3 4 5
On 1/18/06, Norman Goodacre [EMAIL PROTECTED] wrote:
Dear group,
I am nearly beside myself. After an entire night spent on a niggling
little detail, I am no
i am not sure i clearly understood...
do you want to coerce a vector into a list of its elements ?! like this:
split(1:5,1:5)
Norman Goodacre a écrit :
Dear group,
I am nearly beside myself. After an entire night spent on a niggling
little detail, I am no closer to to the truth. I
1. Try using
lm(...whatever..., na.action = na.exclude)
2. Be sure to read the note on Using Time Series in ?lm
3. The dyn package will accept ts, irts, its and zoo class time series
and output time series for the residuals. Just preface lm with dyn$.
e.g.
library(dyn)
# test data
The problem is a well-known one in viewers looking at whole pages,
especially PS - PDF converters. R figures are particularly vulnerable as
they have text running both horizontally and vertically (with normal
axes).
Please do follow exactly the advice on the postscript help page.
The
Knut Krueger wrote:
I am trying to send a manuscript to a journal.
One of the figures build by R is in the right orientation and 4 are rotated
clockwise 90 deg in the preview.
I used the right click save to PS option and I used the command line
It seems you are looking for na.action = na.exclude.
This is described in all good books on S/R (e.g. MASS4, p. 141) and also
in an answer on this list already this week.
It is even on the help pages for residuals.lm and fitted.
On Wed, 18 Jan 2006, Vivek Satsangi wrote:
Folks,
I do a
thank you. I am still not sure how to get the scores in princomp, though:
ds= as.data.frame( cbind(rnorm(10),rnorm(10)) )
names(ds)=c(x1,x2)
ds[5,]=c(NA,NA)
pc= princomp( formula = ~ ds$x1 + ds$x2, na.action=na.omit)
ds$pc1 = pc$scores[,1] #-- error, scores has 9 obs, ds has 10 obs
is there an
I recommend that the allowable values for docs be included in the short
help output generated by the command 'rcmd build --help'. The html help
file for build does not contain this information (which is fine since
the HTML help system supports multiple operating systems). I did find
the options I
Dear R helpers,
running the following code of a glm model of the family poisson, gives
predicted values 0. Why?
library(MASS)
library(stats)
library(mvtnorm)
library(pscl)
data(bioChemists)
poisson_glm - glm(art ~ fem + mar + kid5 + phd + ment, data = bioChemists,
family = poisson)
On Wed, 2006-01-18 at 13:04 +0100, Knut Krueger wrote:
I am trying to send a manuscript to a journal.
One of the figures build by R is in the right orientation and 4 are
rotated clockwise 90 deg in the preview.
I used the right click save to PS option and I used the command line
It's worth noting that there are quite a few for loops inside the code
used by matrix indexing of data frames.
I think a single for-loop over the columns is as good as any, something
like
DF - data.frame(x=1, y=rep(a, 4), z = 3)
ind - c(1,3,3,1) # only numeric cols
for(i in unique(ind))
On Wed, 2006-01-18 at 12:27 +, Norman Goodacre wrote:
Dear group,
I am nearly beside myself. After an entire night spent on a
niggling little detail, I am no closer to to the truth. I loaded an
Excel file in .csv form into R. It apparentely loads as a list, but
not the kind of
of course unlist()/as.list() do that !!! (sorry, i am tired)
Norman Goodacre a écrit :
Dear group,
I am nearly beside myself. After an entire night spent on a niggling
little detail, I am no closer to to the truth. I loaded an Excel file in
.csv form into R. It apparentely loads as
Dear list
Having just started to use the Windows version, I am very impressed with
it's package handling as well as the gui.
So I tried to see what was due for update and packages such as Hmisc,
Matrix and others came up.
But when I had updated them - which took a few goes as something hung
Uwe Ligges schrieb:
Always hard to tell what an unknown system is doing. We do not know
of any rotation problems with R graphics, hence please ask the poeple
running that unknown system.
I tried to ask, they converted the files to rotated tiff (as a free
service) but used old files from
On Wed, 18 Jan 2006, Robert Michael Rausch wrote:
I would like to generate a contour-plot according to a master plot. The
problem is that the rainbow-palette included in R does not answer this
purpose. I need a darker blue, no turquoise, relatively less green, more
yellow and more red. Haw
On Wed, 18 Jan 2006, P. Olsson wrote:
Dear R helpers,
running the following code of a glm model of the family poisson, gives
predicted values 0. Why?
Look at the help page for predict.glm, particularly the type argument.
Then exponentiate the results.
-thomas
library(MASS)
Prof Brian Ripley schrieb:
The problem is a well-known one in viewers looking at whole pages,
especially PS - PDF converters. R figures are particularly
vulnerable as they have text running both horizontally and vertically
(with normal axes).
Please do follow exactly the advice on the
P. Olsson [EMAIL PROTECTED] writes:
Dear R helpers,
running the following code of a glm model of the family poisson, gives
predicted values 0. Why?
library(MASS)
library(stats)
library(mvtnorm)
library(pscl)
data(bioChemists)
poisson_glm - glm(art ~ fem + mar + kid5 + phd + ment,
Marc Schwartz schrieb:
On Wed, 2006-01-18 at 13:04 +0100, Knut Krueger wrote:
One of the first things to do is to use 'onefile = FALSE', 'horizontal =
FALSE' and paper = special'.
I am afraid the problem is on the journals side, because the wrong
postscript line (with letter )is
On 1/18/2006 9:51 AM, John Logsdon wrote:
Dear list
Having just started to use the Windows version, I am very impressed with
it's package handling as well as the gui.
So I tried to see what was due for update and packages such as Hmisc,
Matrix and others came up.
But when I had updated
I'm afraid you're a day late and a dollar short: see ?na.exclude.
lm() has been around longer than you have, maybe, and is thus pretty well
optimized. Not perfect, mind you, but I think it unlikely that casual
suggestions haven't already been considered.
-- Bert Gunter
Genentech Non-Clinical
On Wed, 18 Jan 2006 14:58:26 +0100, P. Olsson wrote:
PO Dear R helpers,
PO running the following code of a glm model of the family poisson,
PO gives predicted values 0. Why?
PO
PO library(MASS)
PO library(stats)
PO library(mvtnorm)
PO library(pscl)
PO data(bioChemists)
PO poisson_glm -
P. Olsson olsson1 at gmail.com writes:
Dear R helpers,
running the following code of a glm model of the family poisson, gives
predicted values 0. Why?
Because by default predict.glm() gives answers on the
link (log) scale. predict(poisson_glm,type=response)
is probably what you're
I have some doubts about the validity of my procedure to estimeate linear
contrasts ina a factorial design.
For sake of semplicity, let's imagine a one way ANOVA with three levels. I am
interested to test the significance of the difference between the first and
third level (called here contrast
Hi all,
Does lme has function to compute the cook's distance or influence
measure like lm? I can't find them. Thanks.
Yen Lin
[[alternative HTML version deleted]]
__
R-help@stat.math.ethz.ch mailing list
On Wed, 18 Jan 2006, John Logsdon wrote:
Dear list
Having just started to use the Windows version, I am very impressed with
it's package handling as well as the gui.
So I tried to see what was due for update and packages such as Hmisc,
Matrix and others came up.
But when I had updated
Hi, all,
Anyone has experience on Logistf package? I am using logistftest in Logistf
package to selelct diagnosis genes. The result seems not the same as I
expected.
I have 10 gene expression data for 27 tumor 1 and 11 tumor 0. I want to
select the best one using Maximum likelihood ratio test
group=factor(rep(c(0:2), each = 8))
ar = data.frame(group, dip)
con = matrix(c(1, -1, 0, 1, 0, -1), nrow=3, ncol=2, byrow=F)
contrasts(ar$group)=con
aovRes = aov(dip~group, ar)
summary.aov(aovRes, split=list(group = list(0 vs 1 = 1, 0 vs 3 = 2)))
Df Sum Sq Mean Sq F value
Hi.
I'm trying to plot a pair of intertwined spirals and an svm that
separates them. I'm having some trouble. Here's what I tried.
library(mlbench)
library(e1071)
Loading required package: class
raw - mlbench.spirals(200,2)
spiral - data.frame(class=as.factor(raw$classes), x=raw$x[,1],
Hello R users:
I am fairly new to R and am trying to figure out how to compute an intraclass
correlation (ICC) and/or design effect for binary data? More specifically, I
am trying to determine the amount of clustering in a data set - that is,
whether certain treatment programs tend to
On Wed, 2006-01-18 at 17:09 +0100, Knut Krueger wrote:
Marc Schwartz schrieb:
On Wed, 2006-01-18 at 13:04 +0100, Knut Krueger wrote:
One of the first things to do is to use 'onefile = FALSE', 'horizontal =
FALSE' and paper = special'.
I am afraid the problem is on the journals
Dear R/RS-Perl users,
I have a perl script in which I parse a large number of files and
construct an array of arrayrefs from the data in the files. I then
pass that construct to R using the RS Perl interface. I want to be
able to use the construct as an R array or matrix so that I can use
Andrew,
Thanks for the suggestion! This seems to have fixed things. I was wondering
if you could explain why this works and what was wrong. If I issue the command
my.boot-boot(dataframe,cs,R=999)
and in order to what effect the command you told me use has I then do something
like
Hi.
I'm trying to plot a pair of intertwined spirals and an svm that
separates them. I'm having some trouble. Here's what I tried.
library(mlbench)
library(e1071)
Loading required package: class
raw - mlbench.spirals(200,2)
spiral - data.frame(class=as.factor(raw$classes), x=raw$x[,1],
Marc Schwartz (via MN) schrieb:
Unfortunately, it may have precluded my being able to replicate exactly
what you are seeing, despite being intimately familiar with one of the
functions (barplot2 ;-) that you are using.
I did create some data that would generally fit what you are doing in
On Wed, 2006-01-18 at 20:48 +0100, Knut Krueger wrote:
Marc Schwartz (via MN) schrieb:
Unfortunately, it may have precluded my being able to replicate exactly
what you are seeing, despite being intimately familiar with one of the
functions (barplot2 ;-) that you are using.
I did
Hi all,
I am using the package Segmented to estimate logistic regression models
with unknown breakpoints (see Muggeo 2003 Statistics in Medicine
22:3055-3071). In the documentation it suggests that it might be possible to
include several variables with breakpoints in the same model: Z = a
R for Windows, version 2.2. I am trying the following
code:
BLAH.lme4 - lme(fixed = , data = , random =
)
plot(BLAH.lme4, resid(.,type = p) ~ fitted(.) |
GROUP,
id = 0.05, adj = -0.3,
idLabels = BLAH$VALUE,
main = Pearson Residuals vs. Fitted Values, by
Group)
When
Dear R-helpers,
i am a beginner of R and i am using cluster package to do hierarchical
clustering
i am wondering if i can use my own distance matrix to do the hierarchical
clustering without using dist() function.
if i have my own distance matrix, how can i ask hclust() function to recongnize
Use something like hclust(as.dist(mydist), ...) ought to work.
Andy
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED]
Sent: Wednesday, January 18, 2006 4:47 PM
To: r-help@stat.math.ethz.ch
Subject: [R] r-help, how can i use my own
x - array(1:30, c(4,5,3))
x[1,,]
How can I do the same thing with do.call?
do.call([, list(x, 1)) == x[1]
do.call([, list(x, 1, NULL, NULL)) == x[1, NULL, NULL]
I guess you can't, because of the special way that [ deals with arguments.
How can I index an array programmatically for arrays and
I apologize for the second posting, my other email address
died today.
I am using R for Windows, version 2.2. Here is my code:
plot(FOO.lme4, resid(.,type = p) ~ fitted(.) | LOT,
id = 0.05, adj = -0.3, idLabels = RO54F$VALUE,
main = Pearson Residuals vs.
see ?dist
there's an example
x - matrix(rnorm(100), nrow=5)
m - as.matrix(dist(x))
d - as.dist(m)
'as.dist' is what you're probably looking for
regards,
Marco
[EMAIL PROTECTED] wrote:
Dear R-helpers,
i am a beginner of R and i am using cluster
I apologize for the second posting, my other email address
died today.
I am using R for Windows, version 2.2. Here is my code:
plot(FOO.lme4, resid(.,type = p) ~ fitted(.) | GROUP,
id = 0.05, adj = -0.3,
idLabels = FOO$value,
main = Pearson Residuals vs. Fitted Values,
On 1/18/06, hadley wickham [EMAIL PROTECTED] wrote:
x - array(1:30, c(4,5,3))
x[1,,]
How can I do the same thing with do.call?
do.call([, list(x, 1, TRUE, TRUE))
seems to work for me.
Deepayan
do.call([, list(x, 1)) == x[1]
do.call([, list(x, 1, NULL, NULL)) == x[1, NULL, NULL]
I
I've been asked about Canonical Variance Analysis (CVA). I don't
see any reference to it searching the R site. Does it go by other
names?
Genstat describes it thus:
Canonical variates analysis operates on a within-group sums of squares
and products matrix, calculated from a set of variates and
Ben,
although I appended a smiley to my first note, the message was
serious. If you don't show us what you're doing, we can't help you.
Please provide an example in which you:
1) generate a small dataframe similar in structure to yours
2) provide cs
3) show the boot statement that applies cs to
Thanks for responding :) Again...
I understand how indexing works (basically as in any other programming
language), that is why I am so confused as to why that statement made my
bootstraping work! It seems like, if anything, it would completely screw up
everything.
Here is the (now
Ben,
Ok, it's clear now, thanks. Note that your boot call
boot(mydata,cs,R=999)
does not specify an stype argument. The boot help file notes that
the default value for stype is i, which means that boot will pass an
index to the function, not a weight, regardless of whether you call it
w, i,
do.call([, list(x, 1, TRUE, TRUE))
seems to work for me.
Oh! Of course. I knew someone obvious was staring me in the face.
Thanks,
Hadley
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the
G'day David,
DK == David Kinniburgh [EMAIL PROTECTED] writes:
DK I have used Mike Powell's optimization routine (VA05AD) from
DK the Harwell Subroutine Library (HSL) for more than 20 years.
DK [...]
DK Now that I have converted to R, I will miss my trusted
DK friend. I have
I am working with lmer() in the latest release of Matrix, doing various
things including writing a function called mcsamp() that acts as a
wrapper for mcmcsamp() and automatically runs multiple chains, diagnoses
convergence, and stores the result as a bugs object so it can be
plotted. I
I have not seen a reply to this post, and unfortunately, I'm not
smart enough to help you. If you would still like help from this
listserve, please provide a terse, reproducible example that someone can
in seconds copy from your email into R and presumably get the same error
message
R Help List --
I have defined two time-series-vector-valued-functions, let them be f and g,
and want to find the numeric derivative of f with respect to the variable x
where f depends on x through g:
(d/dx)(f (g(x) )
Moreover, x is a vector
I tried this out the long way (naming every element of
Dear All,
I'm trying to attach a legend outside the plot (Inside plot OK), but failed.
Any help is very much appreciated.
Thanks.
Abd. Rahman Kassim, PhD
Forest Management Ecology Program
Forestry Conservation Division
Forest Research Institute Malaysia
Kepong 52109 Selangor
MALAYSIA
I'm sorry, but I still do not understand, but I will make a guess:
You have data on n characteristics from each of many patients, and you
want to form N groups, with roughly k patients per group from the next
roughly k*N patients who walk into your clinic.
If this is your
Hi,
This works fine.
setClass(a,representation(b=list,c=list))
new(a,b=list(7))
An object of class a
Slot b:
[[1]]
[1] 7
Slot c:
list()
But, now suppose you want a slot to accept an object of class formula...
setClass(a,representation(b=list,c=formula))
new(a,b=list(7))
Error in
In general, singular convergence means you were trying to estimate
k parameters when the data would support estimation k-1 or fewer.
Beyond this, RSiteSearch(singlular convergence) produce 53 hits for
me just now, and RSiteSearch(lme singular convergence) produced 7. If
use xpd argument in par(), as follows:
?par
par(xpd=T, mar=par()$mar+c(0,0,0,4))
plot(1,1)
legend(1.5,1,point,pch=1)
Abd Rahman Kassim a écrit :
Dear All,
I'm trying to attach a legend outside the plot (Inside plot OK), but failed.
Any help is very much appreciated.
Thanks.
Abd.
Create a virtual class that can either be a formula or be NULL:
setClassUnion(formulaOrNULL, c(formula, NULL))
setClass(a,representation(b=list,c=formulaOrNULL))
new(a, b = list(7))
On 1/18/06, Steven Lacey [EMAIL PROTECTED] wrote:
Hi,
This works fine.
I have a program where the following code works fine:
df.opt$Delta - apply(df.opt, 1, function(x)
EuropeanOption(x[CallPutString], x[UnderlyingPrice],
x[StrikePrice], 0, interest.rate, x[FractionalExpiration],
x[Vol])[[2]])
However, the code below fails:
#df.opt$Delta - apply(df.opt, 1,
with apply loop, x is a vector you are indexing in the first sample code
with its names.
so it failed when you tried indexing it with $ which is dedicated to
data frames.
Fernando Saldanha a écrit :
I have a program where the following code works fine:
df.opt$Delta - apply(df.opt, 1,
$ can be used with data frames but not arrays and apply is
not sending a data frame to your function. For
example, try this:
apply(df.opt, 1, is.data.frame)
By the way, in addition the difference you mention there
are a bunch of # marks in your second statement.
On 1/19/06, Fernando Saldanha
On 18 Jan 2006, [EMAIL PROTECTED] wrote:
But, now suppose you want a slot to accept an object of class
formula...
setClass(a,representation(b=list,c=formula))
new(a,b=list(7)) Error in validObject(.Object) : invalid class
a object: invalid object
for slot c in class a: got class NULL, should
Dear Jacques,
Thanks for the promt response.
Abd. Rahman
- Original Message -
From: Jacques VESLOT [EMAIL PROTECTED]
To: Abd Rahman Kassim [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Sent: Wednesday, January 18, 2006 9:15 PM
Subject: Re: [R] Legend Outside Plot Dimension
use xpd
88 matches
Mail list logo