The : operator does give a numeric, non-integer result
when integer would not be sufficient:
1.1:10.1
On Jan 30, 2008 9:28 AM, [EMAIL PROTECTED] wrote:
Ok, I get your point.
On the other hand, R is not only for high level programmer. On low
level, the fact that : change the type is
Here is a variation in which the sample sizes appear under the
labels:
set.seed(1)
y - rnorm(50)
x - factor(sample(letters[1:5], 50, replace = TRUE))
bp - boxplot(y ~ x, varwidth = TRUE)
mtext(paste((n=, bp$n, ), sep = ), at = seq_along(bp$n), line =
2, side = 1)
On Jan 30, 2008 7:30 AM, S
On Jan 29, 2008 10:40 PM, Christophe Genolini [EMAIL PROTECTED] wrote:
x[c(2,4)] work as well
My point is that that at the native-code level subsetting/enumeration
is done by integer indices and coercion from double to integer is
always going to less efficient than working directly with
Hello,
How do I run interaction between to categoric variables in lme()?
I tried this:
lmefit1- lme(Handling ~Mass+factor(Prey)+factor (Decap)+
factor(Prey)*factor(Decap), random = ~ 1 |Place, data=nestling1)
Error in MEEM(object, conLin, control$niterEM) :
Singularity in backsolve at level
Try this also:
y-rnorm(50)
x-factor(sample(letters[1:5],50,replace=T))
bp - boxplot(y~x)
text(1:5, bp$stats[3,]+.1, paste(n, bp$n, sep==))
On 30/01/2008, Marc Bernard [EMAIL PROTECTED] wrote:
Dear all,
How can I plot the number of observations per box in a boxplot. Many thanks,
Bernard
Falco tinnunculus kestrel78 at gmail.com writes:
How do I run interaction between to categoric variables in lme()?
I tried this:
lmefit1- lme(Handling ~Mass+factor(Prey)+factor (Decap)+
factor(Prey)*factor(Decap), random = ~ 1 |Place, data=nestling1)
Error in MEEM(object, conLin,
On Wed, 30 Jan 2008, Stuart Leask wrote:
hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO
Hi there.
Some years ago, I was trying to get loess to behave like lowess, so I could
repeat some old analyses but 'predict.loess' into some reference data (R
lowess and loess have different defaults).
I don't understand this behavior. Why does the every data point get trashed by
data.matrix when there is one non-numeric element in the array? Thanks.
temp
GDP CPIYOY
19540 2098.1 garbage
19632 2085.4 0.9
19724 2052.5 0.8
19814 2042.4 1.1
On Sat, 26 Jan 2008, J. Scott Olsson wrote:
Is there a way in GAMM to increase the amount of smoothing (something like
min.sp in GAM)?
-- There is nothing built in I'm afraid - the only way I can think of
doing this would involve re-writing the pdMat classes that mgcv supplies
in order to
OK - here is an example:
## Create example data
data = matrix(1:8, nrow=4, ncol=2)
## Name columns x and y
colnames(data) = c(x, y)
data = data.frame(data)
## Create 5 graphs with the xyplot command
graph1= xyplot(y~x, data = data)
graph2 = xyplot(y~x, data = data)
graph3 = xyplot(y~x,
xyplot.zoo uses xyplot and will displays graphs of
times series without space:
library(zoo)
z - with(data, zoo(y, x))
xyplot(cbind(z, z, z, z, z))
On Jan 30, 2008 11:17 AM, eite2335 [EMAIL PROTECTED] wrote:
OK - here is an example:
## Create example data
data = matrix(1:8, nrow=4, ncol=2)
useR's,
Consider some variables and a data frame of points:
x1 - c(1,2,3)
x2 - c(3,4,5)
xk1 - seq(min(x1)-.5, max(x1)+.5,.5)
xk2 - seq(min(x2)-.5, max(x2)+.5,.5)
expand.grid(xk1=xk1,xk2=xk2)
xk1 xk2
1 0.5 2.5
2 1.0 2.5
3 1.5 2.5
4 2.0 2.5
5 2.5 2.5
6 3.0 2.5
7 3.5 2.5
...
46 2.0 5.5
AmTrust Bank headquartered in Cleveland OH (founded in 1889, one of
the 50 largest banks in the US, with more than $18 billion in assets)
has an opening for a Marketing Statistician in the Business
Intelligence group.
===Essential Job Duties:
- Apply various data analysis techniques to address
On 1/30/08, Dr. Ottorino-Luca Pantani [EMAIL PROTECTED] wrote:
Deepayan Sarkar ha scritto:
On 1/29/08, Dr. Ottorino-Luca Pantani [EMAIL PROTECTED] wrote:
Dear R users,
I would like to exactly reproduce a figure like the 1.5 or 1.9 or 4.13
from the book
Mixed effects models in S and
On 1/30/08, eite2335 [EMAIL PROTECTED] wrote:
OK - here is an example:
## Create example data
data = matrix(1:8, nrow=4, ncol=2)
## Name columns x and y
colnames(data) = c(x, y)
data = data.frame(data)
## Create 5 graphs with the xyplot command
graph1= xyplot(y~x, data = data)
Hi room,
Is there any R package that solves a non linear objective pb, with
linear equality constraint?
A simple example
a =c (2, 5, 6, 7, 2)
b = c (7, 1, 4, 5, 6)
a and b are vectors of length 5
minimise f(x, a) = sum( (x-a)^2) such that sum( x*b) = 50.
where x is the control
I would like to compute the CSD of two finite time series. Is this
implemented in R. Spectrum can handle multivariate input, but
computes the coherence and the phase, but not the cross spectral
density. Are there any packages out there that can do what I am
asking?
thanks
Stephen Sefick
--
hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO
On Wed, 2008-01-30 at 07:53 -0800, Arthur Steinmetz wrote:
I don't understand this behavior. Why does the every data point get
trashed by data.matrix when there is one non-numeric element in the
array? Thanks.
I suspect it is because your data
I am a beginner and this is a naive question.
I have the following data set.
row column height
1 2 96
3 7 67
9 25 77
..
I have a matrix of 50*100 data points and about 60% of them are zeros.
I want to put the height data into the matrix according to their row and column
numbers. does anybody
Hi room,
Is there any R package that solves a non linear objective pb, with
linear equality constraint?
A simple example
a =c (2, 5, 6, 7, 2)
b = c (7, 1, 4, 5, 6)
a and b are vectors of length 5
minimise f(x, a) = sum( (x-a)^2) such that sum( x*b) = 50.
where x is the control
How can I plot the number of observations per box in a boxplot.
As usual, there's probably a more elegant solution, but this will do it:
p - rnorm(100)
diddy - boxplot(z)
text(1, diddy$stats[3]+0.4, paste(n = , diddy$n))
see ?text and ?boxplot
-
David Hewitt
Virginia Institute of
Hi,
Is there a good approach to working with multiple predictors in a linear model
which are in some ways related? In other words, is there a procedure, test,
or general rule for determining if predictor variables are independent
enough?
An example from soil science could be the notion of
Try adding a penalty term, e,g,
lambda - 1e3
f - function(x) crossprod(x-a) + lambda * (crossprod(x, b) - 50)^2
optim(a, f)
On Jan 30, 2008 12:01 PM, Attiglah, Mama [EMAIL PROTECTED] wrote:
Hi room,
Is there any R package that solves a non linear objective pb, with
linear equality
Let's A = expand.grid(xk1=xk1,xk2=xk2)
B = A[A[,1] %in% x1 A[,2] %in% x2, ]
Should in principle produce the desired result.
Mama
-
Mama Attiglah, PhD
Advanced Research Center
Quantitative Research Analyst
State Street Bank
+44(0)20 7698 6290 (Direct Line)
+44 (0)207 004 2968 (Direct
Hi,
I would like to know if it is possible to generate a waiting bar in R when
you execute your programs like in Matlab, to make the program more living.
Particularly for the loops, it can be useful to know how many time left...
Thanks in advance,
Loïc Joffre
--
View this message in context:
Hi R-users,
From the last week I've been working fitting a linear mixed model with
random intercept and fixed shape (model4) for a data set with 37 individuals
measured over time, using lme package. Results are at the end of this
message. The outcome is score and the covariate is age.
My
OK, this was a silly example.
This one should be not as silly:
## Created example dataset
data1 = matrix(1:12, nrow=4, ncol=3)
data1 = data.frame(matrix(data1, 4, 3, byrow = T))
colnames(data1) = c(y1, y2,x)
data2 = data.frame(c(1,1,2,2))
colnames(data2) =c(z)
data = cbind(data1,data2)
For text-based progress bars see the ProgressBar class in R.utils, e.g.
# A faster progress bar with default step length 1.4.
pb - ProgressBar(max=42, stepLength=1.4)
reset(pb)
while (!isDone(pb)) {
x - rnorm(3e4)
increase(pb)
Sys.sleep(0.02)
}
cat(\n)
Output:
Perhaps like this:
diag(mat[data$row, data$column]) - data$height
On 29/01/2008, Gator Connection [EMAIL PROTECTED] wrote:
I am a beginner and this is a naive question.
I have the following data set.
row column height
1 2 96
3 7 67
9 25 77
..
I have a matrix of 50*100 data points
Dear all,
maybe somebody can provide some help for this problem:
Example:
I've got the following dataframe data:
grid.id-c(1:4)
lat-c(10,12,13,15)
species1-c(0,0,0,1)
species2-c(1,1,0,0)
species3-c(1,1,1,1)
data-data.frame(cbind(grid.id,lat,species1,species2,species3))
How can I, out of data
Martin Maechler wrote:
Dear R-help mailing list readers,
After some discussion among R foundation members (and friends),
we have agreed that ``the spammer mafia (*)'' has momentarily won a
battle:
After more than ten years of open and free mailing lists devoted
to R (development, use,
Christian
Try:
data.frame(data[,1:2], data[,3:5]*data[,2])
Peter Alspach
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Christian Hof
Sent: Thursday, 31 January 2008 7:48 a.m.
To: r-help@r-project.org
Subject: [R] data.frame transformation
Hello,
How can I make the following expressions are equivalent
datos$Col1 and datos$var when I define var - Col1?
I am trying to get the same result with
datos$Col1
[1] 0 1 1 0 1 0 1 1 0
And
datos$var
NULL
Thank's ,
Ramón
[[alternative HTML version deleted]]
I have a list of 20 values. The first time through a loop I want to find the
mean and stnd.dev. of the first two values; the second time through the loop
I want to find the mean and stnd. dev. of the first 3 values, etc. until
the last time through the loop I want to find the mean and stnd.
On 31/01/2008, at 8:58 AM, cvandy wrote:
I have a list of 20 values.
***NO***! You have (or should have) a *vector* of 20 values.
Vectors and lists are different concepts. Learn and understand
the difference, else the world will come to an end.
The first time
When preparing a series of histograms I found that hist was combining
the two lowest categories or bins, 1 and 2. Specifying breaks, as
illustrated below, resulted in the correct histogram:
values - sample(10,500,replace=TRUE)
hist(values)
hist(values,breaks = 0:10)
Apparently,
That's a dandy little program but the apply with lapply blew my mind! I had to
pick it apart to figure out what it was doing. Perhaps others will find this
expanded version useful:
# Make up some repeated measures data with measures at 4 times.
t1-c(1,2,3,4,5)
t2-c(2,3,3,5,5)
t3-c(3,3,4,4,4)
On 30-Jan-08 18:46:52, Marc Schwartz wrote:
Martin Maechler wrote:
Dear R-help mailing list readers,
After some discussion among R foundation members (and friends),
we have agreed that ``the spammer mafia (*)'' has momentarily
won a battle:
After more than ten years of open and free
Try this:
x - rnorm(20)
sapply(c(sd, mean), function(fun)lapply(lapply(lapply(2:20, seq,
from=1), function(.x)x[.x]), fun))
On 30/01/2008, cvandy [EMAIL PROTECTED] wrote:
I have a list of 20 values. The first time through a loop I want to find the
mean and stnd.dev. of the first two
Hi,
I haven't used RExcel before but from what I've read
in the instructions so far it seems like I cannot
connect from RExcel to an already running R session,
can I?
The background is that usually I use Tinn-R and start
R from there but occasionally I get the sudden desire
to push the data to
On 1/30/08, eite2335 [EMAIL PROTECTED] wrote:
OK, this was a silly example.
This one should be not as silly:
## Created example dataset
data1 = matrix(1:12, nrow=4, ncol=3)
data1 = data.frame(matrix(data1, 4, 3, byrow = T))
colnames(data1) = c(y1, y2,x)
data2 = data.frame(c(1,1,2,2))
On 30-Jan-08 19:47:55, Ramon Hidalgo wrote:
Hello,
How can I make the following expressions are equivalent
datos$Col1 and datos$var when I define var - Col1?
I am trying to get the same result with
datos$Col1
[1] 0 1 1 0 1 0 1 1 0
And
datos$var
NULL
It will work if you use [],
I think I would use lines for this, notice in your barplots how the higher
species seem to bounce around more than the ones at the bottom of the plot even
though they come from the same random process, this is because you are adding
the effects of the randomness as you go up and this makes it
On Jan 30, 2008 1:15 PM, Ted Harding [EMAIL PROTECTED] wrote:
On 30-Jan-08 19:47:55, Ramon Hidalgo wrote:
Hello,
How can I make the following expressions are equivalent
datos$Col1 and datos$var when I define var - Col1?
I am trying to get the same result with
datos$Col1
[1] 0 1 1
y - sort(rnorm(20)) # say...
m - s - numeric(19)
for(i in 2:20) {
m[i-1] - mean(y[1:i])
s[i-1] - sd(y[1:i])
}
Easy peasy, ...
Bill Venables
CSIRO Laboratories
PO Box 120, Cleveland, 4163
AUSTRALIA
Office Phone (email preferred): +61 7 3826 7251
Fax (if absolutely necessary):
Thank you for your reply, Thomas. I'm not quite sure whether survexp() does
that. It seems that the idea of survexp() is to take the ratetable from a
mortality table or Cox model based on one dataset and apply it to another
dataset. I'm trying to adjust for confounding, so I want to take the
Bill.Venables at csiro.au writes:
y - sort(rnorm(20)) # say...
m - s - numeric(19)
for(i in 2:20) {
m[i-1] - mean(y[1:i])
s[i-1] - sd(y[1:i])
}
-Original Message-
On Behalf Of cvandy
Subject: [R] Loop with variable index
I have a list of 20 values. The first
My grasp of R and statistics are both seriously lacking, so if this question
is completely naive, I apologize in advance. I've hunted for a couple hours
on the internet and none of the methods I've found have produced the result
I'm looking for.
I'm currently a student in a Statistics class and
Your data setup is wrong. You have one factor (Drug) with 3 levels
(Zoloft, Naltrexone, Valium). So your data should be:
spiderdata - data.frame(Drug=rep(c(Zoloft, Naltrexone, Valium),
each=10), Response=c(9, 11, 5, 12, 15, 14, 13, 12, 7, 6, 15, 16, 12, 12,
18, 19, 23, 20, 13, 17, 9, 11, 12, 5,
hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO
Hi Christian,
Use the fact that 0 * lat[i] == 0 and 1 * lat[i] == lat[i], where lat[i]
is one of your lat values. Also use the fact that R is vectorized.
So we have:
grid.id-c(1:4)
lat-c(10,12,13,15)
species1-c(0,0,0,1)
species2-c(1,1,0,0)
Hello R users,
I have to import a file with one column containing dates written in
French short format, such as:
7-déc-07
11-déc-07
14-déc-07
18-déc-07
21-déc-07
24-déc-07
26-déc-07
28-déc-07
31-déc-07
2-janv-08
4-janv-08
7-janv-08
9-janv-08
11-janv-08
I am trying to make a decision tree using rpart. This is my code and output.
data - read.table(/Users/randygriffiths/Desktop/data, header=T)
attach(data)
library(rpart)
bookings.cart - rpart(totalRev~., data=data, method=class)
bookings.cart
n= 50
node), split, n, loss, yval, (yprob)
Hello R users,
I am trying to run a cox model for the prediction of relapse of 80 cancer
tumors, taking into account the expression of 17000 genes. The data are
large and I retrieve an error:
Cannot allocate vector of 2.4 Mb. I increase the memory.limit to 4000
(which is the largest supported by
I have a similar problem, saying cannot allocate vector size of
300MB. I would also appreciate if someone can offer some suggestion
on this.
Best,
Shige
On Jan 31, 2008 2:48 PM, Eleni Christodoulou [EMAIL PROTECTED] wrote:
Hello R users,
I am trying to run a cox model for the prediction of
The output from sessionInfo() the posting guide asked for would have been
very helpful here.
I think the problem is likely to be that these are not standard French
abbreviations according to my systems. On Linux I get
format(Sys.Date(), %d-%b-%y)
[1] 31-jan-08
format(Sys.Date()-50,
On Thu, 31 Jan 2008, Eleni Christodoulou wrote:
Hello R users,
I am trying to run a cox model for the prediction of relapse of 80 cancer
tumors, taking into account the expression of 17000 genes. The data are
large and I retrieve an error:
Cannot allocate vector of 2.4 Mb. I increase the
Thank you Greg for your comments.
Here is a (very) simple example of what my data might look like:
res - matrix(sample(20:25, 41*12, replace=T), nrow=12, ncol=41,
dimnames=list(c(paste(sp,1:12)), c(seq(0, 200, by=5
barplot(res, space=0, legend.text=T, beside=F, col=c(white,grey50),
On 1/29/08, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Dear R-community,
I created 5 different xyplots and graphed all of them with the print command
on one page (e.g.
print(graph1, split=c(1,1,1,5), more = T)
... print(graph5, split=c(1,5,1,5), more =T)
Using the above commands
hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO
[this after a mistakenly private email to Megh]
As others have said, %*% is sufficiently vectorized to do
what you want.
Speaking as a reformed Matlab user,
it might be as well to add that the definition of function fu()
that you give looks like
Deepayan Sarkar ha scritto:
On 1/29/08, Dr. Ottorino-Luca Pantani [EMAIL PROTECTED] wrote:
Dear R users,
I would like to exactly reproduce a figure like the 1.5 or 1.9 or 4.13
from the book
Mixed effects models in S and S-Plus.
Not for the sake of it, but because I have my own data I
Gustaf Granath wrote:
Hi,
I have measured two response variables (y1, y2) at each treatment level
(x = 0, 1.5 or 3). Now I would like to show the y1 and y2 against x in a
bar plot. However, y1 and y2 differ in scale so I need two y-axises, one
on the left side and one on the right side
Randy Griffiths wrote:
I am trying to make a decision tree using rpart. The function runs very
quickly considering the size of the data (1742, 163). When I call the
summary command I get this:
summary(bookings.cart)
Call:
rpart(formula = totalRev ~ ., data = bookings, method = class)
Fantastic - I new it would be straightforward if I could only find the
function!
Many thanks
Paul
-Original Message-
From: Frank E Harrell Jr [mailto:[EMAIL PROTECTED]
Sent: 29 January 2008 20:30
To: Paul Sweeting
Cc: r-help@r-project.org
Subject: Re: [R] Logit Regressions, Clustering
Hello!
Recently I updated my R and all packages, under Linux (Ubuntu 6.06).
After that, I started to receive warning messages:
1: In namespaceImportFrom(self, asNamespace(ns)) :
replacing previous import: cov2cor
2: In namespaceImportFrom(self, asNamespace(ns)) :
replacing previous import:
Hi there,
I've just finished looking at Ben Edwards' latest developments to his guitar
learning package, Jamorama - the Ultimate Guitar Learning Kit.
I get approached by people all the time wanting me to market their products,
and believe me, it can get tiresome looking at the same type of stuff
Dear all,
How can I plot the number of observations per box in a boxplot. Many thanks,
Bernard
-
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
I understood that you only need to multiply each row of Ret by the
vector Pos but it seems that you would like to sum the resulting vector
element in order to have a vector of length 500.
That is merely the matrix multiplication in R!!!
i.e. Ret %*% Pos.
Am I getting the question wrong?
Mama
Dear all,
How can I plot the number of observations per box in a boxplot. Many thanks,
Bernard
-
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
On 1/30/2008 6:42 AM, Marc Bernard wrote:
Dear all,
How can I plot the number of observations per box in a boxplot. Many thanks,
Bernard
Something like this?
X - boxplot(count ~ spray, data = InsectSprays, col = lightgray)
mtext(side=1, line = 2, at =
Do you mean something like
y-rnorm(50)
x-factor(sample(letters[1:5],50,replace=T))
boxplot(y~x)
text(1:5,rep(min(y),5),paste(n=,tapply(y,x,length)) )
?
(You can fiddle about with the text placement easily enough).
Also note that boxplot's varwidth parameter provides a graphical
indication of
Yes definitely it is just matrix multiplication. However I was interested why
those code going wrong.
Attiglah, Mama [EMAIL PROTECTED] wrote: I understood that you only need to
multiply each row of Ret by the
vector Pos but it seems that you would like to sum the resulting vector
element in
On Jan 30, 2008 2:15 AM, Markus Didion [EMAIL PROTECTED] wrote:
Thank you Greg for your comments.
Here is a (very) simple example of what my data might look like:
res - matrix(sample(20:25, 41*12, replace=T), nrow=12, ncol=41,
dimnames=list(c(paste(sp,1:12)), c(seq(0, 200, by=5
hits=-2.6 tests=BAYES_00
X-USF-Spam-Flag: NO
Hi there.
Some years ago, I was trying to get loess to behave like lowess, so I could
repeat some old analyses but 'predict.loess' into some reference data (R
lowess and loess have different defaults).
loess(X~Y,span=sp, family=(symmetric),
73 matches
Mail list logo