Hello R-users,
I am new to R-commands.
I have two sets of data:
x - c(7, 7 , 8, 9, 15, 17, 18)
y - c(7, 8, 9, 15, 17, 19, 20, 20, 25, 23, 22)
I have used 'cut' command to seperate them as follows
a - cut(x, breaks =c(0,5,10,20,25,30))
b - cut(y, breaks =c(0,5,10,20,25,30))
table(a)
a
Thank you for all your answers...
I solved my problem thanks to you all !
david
2005/12/6, paul sorenson [EMAIL PROTECTED]:
Return something that can hold more than one value, eg:
calculate - function(x, y) {
list(a=x+y, b=x-y)
}
David Hajage wrote:
Thank you for your answer.
try :
barplot(do.call(rbind,lapply(list(x,y), function(x) table(cut(x,
breaks =c(0,5,10,20,25,30),beside=T)
Subhabrata a écrit :
Hello R-users,
I am new to R-commands.
I have two sets of data:
x - c(7, 7 , 8, 9, 15, 17, 18)
y - c(7, 8, 9, 15, 17, 19, 20, 20, 25, 23, 22)
I have used
Dear R Users,
Before running ksmooth( ), a suitable bandwidth selection is needed. I use
some functions for this task and receive these results for my data:
width.SJ(y,nb=100,method=ste) : 40.25
bcv(y,nb=100) : 40.53
ucv(y): 41.26
bandwidth.nrd(y) : 45.43
After
If you order your factor levels in your vectors in the order you want in the
output,
then the prop.table(prop()) command will give you what you want.
But you have to reorder the factor levels so that the levels commands give the
following output:
levels(trans$class)
[1] seed veg repr
Felix Flory wrote:
I am simulating an ANOVA model and get a strange behavior from the
summary function. To be more specific: please run the following code
and see for yourself: the summary()[[r.squared]] values of two
identical models are quite different!!
## 3 x 3 ANOVA of two factors x
You can change the code of layout:
layout(lmat, widths = lwid, heights = lhei, respect = TRUE)
layout(lmat, widths = lwid, heights = lhei, respect = FALSE)
(best to create a new function my.layout with the modified code)
Jacob Michaelson wrote:
Hi all,
Does anyone know of a fairly easy way
Hello everyone,
I'm working on a package using S4 classes and methods and I ran into the
following problem when I tried to create an apply method for objects
of one of my new classes. I've found a way around the problem but I
wonder if I did not paint myself into the corner. I'd like your
On Wed, 2005-12-07 at 18:08 +1100, paul sorenson wrote:
Apple Ho wrote:
Hello,
I have a problem about using the command plot. Suppose I have some
points, and one of them is (0,0), how can I show the figure with this
point which is at the corner?
How close to the corner do you want
Or building on that solution but eliminating the do.call and lapply:
f - function(x) table(cut(x, breaks = seq(0, 30, 5)))
barplot(rbind(f(x), f(y)), beside = TRUE)
On 12/7/05, Jacques VESLOT [EMAIL PROTECTED] wrote:
try :
barplot(do.call(rbind,lapply(list(x,y), function(x) table(cut(x,
Why does simply
setMethod(apply,
signature(X = myClass,
MARGIN = numeric,
FUN = function),
function(X, MARGIN, FUN, ...) .apply.myClass(X, MARGIN, FUN, ...))
not do what you want? It works for me in your example, e.g.
Bert,
how about when making predictions of contrasts using, for example,
estimable() from the gmodels package? I find it very useful.
Andrew
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Berton Gunter
Sent: Wednesday, 7 December 2005 8:27 AM
Adaikalavan Ramasamy wrote:
Yes, it drives me mad too when people use = instead of - for
assignment and suppress spaces in an naive attempt for saving space.
In fact, I like the - assignment operator, but tend to write code
densely myself as that is the way I like to view it. As R formats
On 12/5/05, Cox, Stephen [EMAIL PROTECTED] wrote:
I have been looking into both of these approaches to conducting a GLMM,
and want to make sure I understand model specification in each. In
particular - after looking at Bates' Rnews article and searching through
the help archives, I am unclear
Dear list,
I have a list containing parameters (time and X1), and have n
similar data set like
the following:
cal
[[1]]
timeX1
1 0.0 10.006306
2 0.5 9.433443
3 1.0 8.893405
4 2.0 7.904274
5 4.0 6.243807
6 6.0 4.932158
7 8.0 3.896049
8 10.0 3.077604
[[2]]
timeX1
Oh Patrick, surely German Capitalization is better!
:)
Peter
Patrick Connolly wrote:
On Tue, 06-Dec-2005 at 04:21PM +, Patrick Burns wrote:
| I don't put in extraneous ';' because I maybe get a
| blister on my little finger.
|
| I suspect that those who find the semi-colons ugly in
As usual, Gabor provides an elegant solution. But I hope that, in
this case, the OP provided a toy example. Otherwise, I don't see
the point of applying cut() to a vector of length 7. Why not just
use stripchart()?
Peter Ehlers
Gabor Grothendieck wrote:
Or building on that solution but
Dear Prof. Ripley,
Thanks for the clarification.
Prof Brian Ripley wrote:
Why does simply
setMethod(apply,
signature(X = myClass,
MARGIN = numeric,
FUN = function),
function(X, MARGIN, FUN, ...) .apply.myClass(X, MARGIN, FUN,
I suggest that when displaying test data in a post that
you do it like this:
dput(cal)
since then others can simply copy and paste it into
their session.
At any rate, using this test data:
cal - list(A = data.frame(time = 1:3, X1 = 1:3),
B = data.frame(1:3, X1 = 3:5))
Pick off the
assuming that you have the same number of measurements in each
sub-data.frame, you could use something like:
cal - lapply(1:10, function(x) data.frame(time = c(0, 0.5, 1, 2, 4,
6, 8, 10), X1 = rnorm(8, 10:3)))
##
rowMeans(as.data.frame(lapply(cal, [, X1)))
I hope it helps.
Best,
Thanks for the reply Doug!
A follow up question and comment ...
1) If I understand correctly, looking at a simple situation in which
SITES are nested in ZONES, the following should be similar. However,
despite the same F values, the p-value from lmer is 1/2 the other
methods. Why is this true?
Hi all,
How can the label of the x-axes in the plot() of a stl.object be adapted?
e.g.,
When plotting: plot(stl(nottem, per))
In the labels of the x-axes is time. How can this be changed to e.g.,
Time (dekade) ?
It does not work with xlab or others anymore
Thanks,
Jan
Hi
changing list to matrix and making summary could do the trick
lll - list(a=cbind(1:10, rnorm(10)), b=cbind(1:10, rnorm(10)))
mat - do.call(rbind, lll)
tapply(mat[,2], mat[,1], mean)
BTW I found a suitable thread with similar question in CRAN search
list summary mean
HTH
Petr
On 7 Dec
If you look through the output of:
stats:::plot.stl
you see right near the end that time is hard coded in the call to mtext.
However, we could temporarily redefine mtext so that it works as you
wish and then redefine plot.stl so that it looks within the environment
of our function to find mtext
Greetings,
The question was about getting closed form equations from a bs() representation
of a curve so enabling publication of a fitted curve for uise outside R. In
case anyone else is interested, the solution lies in exploiting the fact that
we can get accurate derivatives at the
I have a groupedData object named data.
When I use plot(data) I obtain a trellis plot for each group with a grey
bakground. How can I change the background to white? I tried with
par(bg=white) but got no change at all.
I would appreciate any suggestion.
--
Albert Sorribas
Grup de
Well, this has been an interesting thread. I guess my own perspective
is warped, having never been a C programmer. My native languages are
FORTRAN, python, and R, all of which accept (or demand) a linefeed as a
terminator, rather than a semicolon, and two of which are very
particular about
On 12/7/05, Albert Sorribas [EMAIL PROTECTED] wrote:
I have a groupedData object named data.
When I use plot(data) I obtain a trellis plot for each group with a grey
bakground. How can I change the background to white? I tried with
par(bg=white) but got no change at all.
I would appreciate
Have you read Pinheiro and Bates (2000) Mixed-Effects Models in S and
S-Plus (Springer)? The latter part about nonlinear modeling with mixed
effects sounds like it could help you a lot.
1. Consistent with that, I might start by averaging over all 15
people, then making
On 12/7/05, Dave Roberts [EMAIL PROTECTED] wrote:
Well, this has been an interesting thread. I guess my own perspective
is warped, having never been a C programmer. My native languages are
FORTRAN, python, and R, all of which accept (or demand) a linefeed as a
terminator, rather than a
Hi,
My general goal is to find a coding strategy to efficiently store and
retrieve drawing routines for different plots.
This is my approach so far. In a single text file I store multiple drawing
routines where each routine draws a different plot.
A drawing routine may look like this:
Thanks a lot!
However, its not working perfectly yet. The function plot.stl now also
changes the labels of Data, Seasonal, Trend, and Remainder to the text
defined for xlab. How could this be fine-tuned?
Regards,
Jan
-Original Message-
From: Gabor Grothendieck [mailto:[EMAIL
One other thought. This can be arguably done more compactly
using the proto package. We define a proto object consisting
of three components:
- plot.stl which is just a copy of the corresponding routine
in the stats package,
- our redefined mtext and
- our desired x label.
and then run
Hello, I'm a senior statistician at Affinnova, a market research firm
outside of Boston, MA. We are looking to hire a strong R programmer.
Here is the description of the job:
Come join a growing company in the market innovation field. Affinnova
is changing innovation and product development by
This should fix that problem:
plot.stl - function(..., xlab = time) {
mtext - function(text, ...)
graphics::mtext(if (text == time) xlab else text, ...)
plot.stl - stats:::plot.stl
environment(plot.stl) - environment()
plot.stl(...)
}
Also for
hi all
Here is a small part of my code:
tab_tmp-tab[1:(no[off_set[i-1]+1]+(no[off_set[i]+1]-no[off_set[i-1]+1])),length(tab)];
tab_tmp1-tab[(no[off_set[i-1]+1]+(no[off_set[i]+1]-no[off_set[i-1]+1])):length(TotalFillTimeHours),length(tab)];
tab-c(tab_tmp,tab_tmp1);
attach(tab);
Here is the
Greetings all:
OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is
simple
and straightforward but for the life of me I cannot find it in the
documentation, in the archives, or in my notes (because I know I've
encountered this in the past). My problem is:
I have a data
Do you know where I can download R 2.1.0 ??
I would like to use ttda.
Thanks
Lucie
[[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
Hi Peter,
Thanks for pointing out the set functions. I can use setdiff to find
missing rows
setdiff(dev, rownames(A))
[1] seed
and intersect to find common rows
d1- intersect(dev, rownames(A) )
[1] veg rep
I was trying to use a negative index like A[-1,] to remove the dead row,
but d1 is a
Does newDF - oldDF[,c(A,C,D)] work?
Kurt Wollenberg wrote:
Greetings all:
OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is
simple
and straightforward but for the life of me I cannot find it in the
documentation, in the archives, or in my notes (because I know I've
newDF - oldDF[,c(A,C,D)]
HTH
Kurt Wollenberg wrote:
Greetings all:
OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is
simple
and straightforward but for the life of me I cannot find it in the
documentation, in the archives, or in my notes (because I know I've
Kurt Wollenberg wrote:
Greetings all:
OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is
simple
and straightforward but for the life of me I cannot find it in the
documentation, in the archives, or in my notes (because I know I've
encountered this in the past). My
On Wed, 7 Dec 2005, Kurt Wollenberg wrote:
Greetings all:
OK, this is bugging the @[EMAIL PROTECTED] out of me. I know the answer is
simple
and straightforward but for the life of me I cannot find it in the
documentation, in the archives, or in my notes (because I know I've
encountered
On Tue, Dec 06, 2005 at 04:21:01PM +, Patrick Burns wrote:
I don't put in extraneous ';' because I maybe get a
blister on my little finger.
I suspect that those who find the semi-colons ugly in
R do not find them ugly in C. I think the reason there
would be a visceral reaction in R
Dear r-list:
I am using rpart to build a tree on a dataset. First I obtain a perhaps too
large tree:
arbol.bsvg.02 - rpart(formula, data = bsvg, subset=grp.entr,
control=rpart.control(cp=0.001))
arbol.bsvg.02
n= 10
node), split, n, loss, yval, (yprob)
* denotes terminal node
1)
Guillaume,
I assume that 'tab' is a data frame and that, for some
unspecified reason, you want to get two subsets of the last
column of tab, overlapping one case, and coercing the final
result to a data frame. If that is correct, then
as.data.frame(c(tab_tmp, tab_tmp1))
will give you a data
Dear colleagues,
I've been searching for information on the Kaiser-Meyer-Olkin (KMO)
Measure of Sampling Adequacy (MSA). This statistic is generated in
SPSS and is often used to determine if a dataset is appropriate for
factor analysis -- it's true utility seems quite low, but it seems to
Sorry, there was an error in that function, a hangover from a
previous session. The corrected function is:
kmo.test - function(df){
###
## Calculate the Kaiser-Meyer-Olkin Measure of Sampling Adequacy.
## Input should be a data frame or matrix, output is the KMO statistic.
## Formula derived
Lucie RYBARCZYK [EMAIL PROTECTED] writes:
Do you know where I can download R 2.1.0 ??
I would like to use ttda.
Which platform?
Both source and Windows binaries of historic releases are on CRAN and
are not particularly hard to find.
Any particular reason why this cannot work with R-2.2.0
I would like estimate a number of contrasts from a one-way ANOVA model. I see
that the lm command has a contrasts option, but I can't figure out how to use
it! Any help that can be offered would be greatly apreciated.
Here is my model statement:
Model-lm(log2PM~P+T+P*T)
where P has 16
Following the instruction in R website and downloading gcc and g77, I
am trying to configure and build R in my Mac laptop, but got some
error message that I do not know how to resolve. Do any of you know
how to solve this problem?
After type ./configure, I got the following message.
R is
I noticed that we can combine the function and proto
approaches by placing the proto in the function with
these advantages:
1. the function body can be reduced to just two statements
2. no explicit manipulation of environments via
environment(...) is required (as proto does that itself
On 12/7/05, Jan T. Kim [EMAIL PROTECTED] wrote:
On Tue, Dec 06, 2005 at 04:21:01PM +, Patrick Burns wrote:
I don't put in extraneous ';' because I maybe get a
blister on my little finger.
I suspect that those who find the semi-colons ugly in
R do not find them ugly in C. I think
Hello,
I have a question pertaining to the stepwise regression which I am trying to
perform. I have a data set in which I have 14 predictor variables
accompanying my response variable. I am not sure what the difference is
between the function mle.stepwise found in the wle package and the
Mon cher M. MENICACCI:
It looks to me like you ultimately want to use lmer in
library(lme4) [which also requires library(Matrix)]. For documentation,
I suggest you start with Doug Bates (2005) Fitting Linear Mixed Models
in R, R News, vol. 5/1: 27-30 (available from
I haven't seen any replies, so I will offer a few thoughts:
If this were my problem, I'd start using lm with terms that predict
the tide in terms of the positions of the sun and moon. If other things
were thought to be important, I'd include them also in the lm model.
I am hoping for help with a genetic analysis.
I am trying to perform an analysis of the relation between genes at a given
locus (rs2304795) and a phenotypic trait (zerotg). Multiple subjects are
recruited from each family (and so share a part of their genome and are
correlated). Family groups
Hey, Once again I ask for some quick help.
Here is some code:
ovendata- read.table(ovens.dat,header=TRUE)
attach(ovendata)
print(ovendata)
Here is the .dat file:
DOne Two Three FourFiveSeven Eight
1130254 252 375 384 252 375 876
127 250
I see no error here, let alone an error in read.table as claimed in your
subject line.
The posting guide does specifically ask `Use an informative subject line'.
Please distinguish warnings about _your_ usage from errors in R.
The first warning is that R fixed up an error in your file: it is
You could ask the author of the contributed package 'wle', which is not
part of the `R-software'.
The documentation is minimal, but the references are all to classical
stepwise methods such as those in package leaps, that is they select
columns in the model matrix and _not_ terms.
On Wed, 7
DeepS == Deepayan Sarkar [EMAIL PROTECTED]
on Wed, 7 Dec 2005 19:15:52 -0600 writes:
DeepS On 12/7/05, Jan T. Kim [EMAIL PROTECTED] wrote:
On Tue, Dec 06, 2005 at 04:21:01PM +, Patrick Burns wrote:
I don't put in extraneous ';' because I maybe get a
blister on my
61 matches
Mail list logo