Look at the following link:
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=88
This should be pretty close to what you want.
HTH
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Andrej Kastrin
> Sent: Monday, June 25, 2007
How about:
sum(sapply(unique(a), function(x) {b <- which(a==x); sum(M[b, b])}))
HTH
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
> -Original Message-
> From: [EMAIL
Go to Options/Main/Editor
Click on EdgeColor and select white as the color (or to whatever color you
have set your page's background). This will make the edge line disappear.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Judith Flores
t tried it myself).
http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter7.html
See Figure 7.18 and code
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
> -Original Message-
> Fro
Thanks.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Seth Falcon
> Sent: Friday, May 11, 2007 1:32 PM
> To: r-help@stat.math.ethz.ch
> Subject: Re: [R] names of objects in .rda
>
> "Christos Hatzis" <
An approach would be to attach it and then use ls()
attach(myarchive.rda)
ls(pos=2)
detach(myarchive.rda)
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
> -Original Message-
>
e it bombs.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Andrew Pierce
> Sent: Wednesd
Here is a recursive version of the same function:
"%^%" <- function(A, n) if(n == 1) A else A %*% (A %^% (n-1))
> a <- matrix(1:4, 2)
> a %^% 1
[,1] [,2]
[1,]13
[2,]24
> a %^% 2
[,1] [,2]
[1,]7 15
[2,] 10 22
> a %^% 3
[,1] [,2]
[1,] 37 81
[2,] 54 1
ttach(file.path(my.package.dir, "MyStuff.RData"))
This will make your objects available in your current session without
cluttering your workspace.
Of course, there is a price to pay for simplicity (i.e. no error checks, no
documentation etc).
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosci
behind the function.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Jennifer Dillon
> Sent: Tue
The Surv object contains the information on the type of censoring.
Look at ?Surv
for an explanation of how censored events are represented.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Lu, Jiang
> Sent: Saturday, April 28, 2007 11:
If
sdf <- survdiff(...)
is your survdiff object, the p-value can be computed as follows:
p.val <- 1 - pchisq(sdf$chisq, length(sdf$n) - 1)
and then use it in your K-M plot.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Te
Take a look at Figure 3.26 from Paul Murrell's book and associated code
posted here:
http://www.stat.auckland.ac.nz/~paul/RGraphics/chapter3.html
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Robert Biddle
> Sent: Wednesday, April 1
Take a look at the "R Installation and Administration" manual -
Section 6.1 Installing packages.
It is platform-dependent and you didn't say what platform you're on.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of slomascolo
> Sent: Mo
ion.htm
The link is for a windows application (PermutMatrix) that can perform
seriation on distance matrices used in hierarchical clustering, but might be
useful in your context as well.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 018
Try this:
y <- rle(dat$ID)
unlist(sapply(y$lengths, FUN=function(x) seq(1,x)))
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
> -Original Message-
> From: [EMAIL PROTECTED]
> [m
Also, take a look at Andrew Gelman's recent book with Jennifer Hill on
multilevel modeling.
It is written as a practical how-to text book using R as the primary
platform. I have found it very easy to read, extremely useful and very good
value for its price (I am not related to the authors or the p
in the good
prognosis group and thus the two groups will not have a homogeneous
censorship structure. In this case, naïve analysis could be misleading.
For more details and a simulation example take a look at
http://jnci.oxfordjournals.org/cgi/data/99/2/147/DC1/3
HTH
-Christos
Christos
A way to do this is through substitute:
e1 <- substitute(expression(u1 + u2 + u3), list(u2=quote(x), u3=1))
But I am not sure whether you will run into similar limitations regarding
the length of the expression to be substituted.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
You can try the following:
n.len <- nrow(iris)
n.sel <- 3
iris[(n.len-n.sel+1):n.len, ]
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Lauri Nikkinen
> Sent: Tuesday, March 20, 2007 10:33 AM
> To: r-help@stat.math.ethz.ch
> Subject: [
See
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=7
and code therein.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Nguyen
> Dinh Nguyen
> Sent: Tuesday, March 13, 2007 12:20 AM
> To: r-help@stat.math.ethz.ch
> Subjec
Your "data table" basis is actually a dataframe, whose first column is
non-numeric. That's what is causing the problem.
Try removing the first column of the dataframe before adding the row to your
matrix:
test <- latpoints + basis[2, -1]
-Christos
Christos Hatzis, Ph.D.
Try this:
a <- matrix(c(8, 4.2, 9.4, 1.1),2)
b <- c(3,1)
a[rep(1:nrow(a), b), ]
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
> -Original Message-
> From: [EMA
Try
split(x, row(x))
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> Johannes Graumann
> Sent: Friday, March 09, 2007 10:30 AM
> To: r-help@stat.math.ethz.ch
> Subject: [R] Matrix conversion question
>
> Hello,
>
> Please help - I'
$na.action <- z$na.action
class(ans) <- "summary.lm"
^^
ans
}
So then print.summary.lm does all the job displaying the summary.lm object.
To see that function do
getAnywhere(print.summary.lm)
Then you can then modify that function as needed.
-Ch
Take a look at Windows FAQ 2.9. Following the instructions there, I was
able to make WinXP use at least 3GB of RAM (physical RAM installed) with
Rgui.exe.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
What do you want to do with rbind?
paste produces a single vector of 24 character-valued elements.
If you want a column vector, you could do that by
x <- paste('txt.est',1:24, sep = '')
matrix(x, ncol=1)
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West C
Why do you need to use a data frame? A list will give you the flexibility
you want:
d <- list( x=list( c(1,2), c(5,2), c(9,1) ), y=c( 1, -1, -1) )
Then you can access the individual elements
> d$x
[[1]]
[1] 1 2
[[2]]
[1] 5 2
[[3]]
[1] 9 1
> d$y
[1] 1 -1 -1
> d$x[[1]]
[1] 1 2
-Christos
And if you want to know how it is done, take a look at
stats:::print.dist
-Christos
> -Original Message-
> From: Christos Hatzis [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, February 07, 2007 2:16 PM
> To: 'Leo Gürtler'; 'r-help@stat.math.ethz.ch'
&
You can try
as.dist(d)
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Leo Gürtler
> Sen
Hi Jon,
Take a look at this graph
http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=85
I think it is very close to what you need (source code provided at the
site).
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel
of x
On Thu, 2007-02-01 at 22:46 -0500, Christos Hatzis wrote:
> Marc,
>
> I don't think the issue is duplicates in the matching columns. The
> data were generated by an instrument (NMR spectrometer), processed by
> the instrument's software through an FFT transform an
fill = fill) do.call("merge0",
lapply(X, function(x) zoo(x[,2], x[,1])))
To get more info on zoo try:
vignette("zoo")
On 2/1/07, Christos Hatzis <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I was wondering if there is a direct approach for lining up 2-column
> matri
Marc,
I don't think the issue is duplicates in the matching columns. The data
were generated by an instrument (NMR spectrometer), processed by the
instrument's software through an FFT transform and other transformations and
finally reported as a sequence of chemical shift (x) vs intensity (y) pai
ted on the time dimension.
-Christos
-Original Message-
From: Marc Schwartz [mailto:[EMAIL PROTECTED]
Sent: Thursday, February 01, 2007 4:21 PM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Lining up x-y datasets based on values of x
On Thu, 2007-02-01 at 15:
:[EMAIL PROTECTED]
Sent: Thursday, February 01, 2007 3:29 PM
To: [EMAIL PROTECTED]
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Lining up x-y datasets based on values of x
On Thu, 2007-02-01 at 15:05 -0500, Christos Hatzis wrote:
> Hi,
>
> I was wondering if there is a direct approach for li
c(x[,1],y[,1],z[,1])), max(c(x[,1],y[,1],z[,1])), 1)
w <- cbind(xx, matrix(rep(0, 3*length(xx)), ncol=3))
w[ xx >= x[1,1] & xx <= x[10,1], 2 ] <- x[,2]
w[ xx >= y[1,1] & xx <= y[10,1], 3 ] <- y[,2]
w[ xx >= z[1,1] & xx <= z[10,1], 4 ] <- z[,2]
w
I app
.
Finally
attach(myFunctions.RData)
should do the trick without cluttering your workspace.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
-Original Message-
From: [EMAIL PROTECTED]
[mai
Try,
mapply('%*%', a, b, SIMPLIFY=FALSE)
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Doran, Harold
Sent: Tuesday, January 23, 2007 10:22 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Matrix operations in a list
I have matrices stored withi
Here is a slightly more compact version of your function which might run
faster (I did not test timings) since it does not use the sum:
apply(mat2, 1, function(x) which(apply(mat1, 1, function(y) all(x == y)) ==
TRUE))
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL
You can try the following:
a == grep("ear", a, value=T)
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED]
Or
which.max(a)
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of talepanda
Sent: Wednesday, January 17, 2007 11:45 PM
To: Feng Qiu
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] how to get the index of entry with max value in an array?
In R lang
everse the sort order. Of course, if the matrices are "relatively" small,
sorting time would likely be a non-issue.
HTH,
Marc
On Tue, 2007-01-09 at 16:39 -0500, Christos Hatzis wrote:
> Thanks, Marc.
> This is what I was trying to do but
e, 2007-01-09 at 16:10 -0500, Christos Hatzis wrote:
> Hi,
>
> A function calculates the absolute difference between the two largest
> values of each row of a matrix, as shown in the following example code:
>
> cx <- matrix(runif(15),5)
> cy <- t( apply(cx, 1, order,
iff(cx[i, cy[i,1:2]]))
Anybody has any ideas on how the last loop can be vectorized?
Thanks.
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com <http://www.nuverabio.com/>
__
.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Geoffrey Zhu
Sent: Tuesday, December 26, 2006 11:06 AM
To: r
vantage of eliminating the eval.
On 12/25/06, Christos Hatzis <[EMAIL PROTECTED]> wrote:
> Thank you Gabor. Very interesting solution.
> If I get it right, the first argument in function f is just a
> placeholder to help extract the right element out of the list(...)
> that is passed
"
>
> > eval(parse(text='xx$a'))
> [1] 1 2 3 4 5
> >
>
> So that way you can pass in the character string and then 'parse' it.
>
>
>
> On 12/24/06, Christos Hatzis <[EMAIL PROTECTED]> wrote:
> >
> > This might be
1 2 3 4 5
$b
[1] "a" "b" "c" "d" "e"
> eval(parse(text='xx$a'))
[1] 1 2 3 4 5
>
So that way you can pass in the character string and then 'parse' it.
On 12/24/06, Christos Hatzis <[EMAIL PROTECTED]> wrote:
n(...) {
names <- as.character(substitute(list(...)))[-1]
sapply(names, FUN=function(x){y <- get(x); length(y)})
}
> my.length(xx)
xx
2
> my.length(xx$a)
Error in get(x, envir, mode, inherits) : variable "xx$a" was not found
> my.length(xx$a, xx$b)
Error i
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Wee-Jin Goh
Sent: Sunday, November 19, 2006 4:26 PM
T
Apologies for the typos there.
I meant to say see the Bioconductor web site for details.
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Christos Hatzis
Sent: Thursday, November 16, 2006 11:53 AM
To: 'Wensui Liu'; 'Wade W
One option is the Bioconductor package MLInterfaces that provides a unified
interface for several machine learning alrogirithms and methods for
cross-validation etc. See the algorithms web site for details.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite
#x27;vectorized'
system.time(
{
ind <- sapply(1:(K+1), seq, length = K+1)
cc <- outer(cf,cf)
p.2 <- apply(U, 1, FUN=function(u) sum(cc * u[ind]))
} )
all.equal(p.1, p.2)
rm(n,K,p,U,cf,cc,ind,p.1,p.2)
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc
Mike,
Can you recommend any good books on Fortran 90/95? I had been an old user
of Fortran 77 but haven't followed the developments in the last 15 years or
so...
Thanks.
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938
Great. I will try it.
Thank you.
-Christos
-Original Message-
From: Prof Brian Ripley [mailto:[EMAIL PROTECTED]
Sent: Wednesday, November 08, 2006 1:21 PM
To: Christos Hatzis
Cc: 'Stefan Grosse'; r-help@stat.math.ethz.ch; 'Taka Matzmoto'
Subject: RE: [R] CPU or m
nterested in running Monte-Carlo cross-validation in some sort of a
parallel mode on a dual core (Pentium D) Windows XP machine.
Thank you.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
-Origin
Use a list to store the partial matrices:
z <- vector("list", 189)
for(i in 1:189)
z[[i]] <- subset(...)
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of antonio rodriguez
Sent: Tuesday, November 07, 2006 2:01 PM
To: R-Help
Subject: [R
You need to start by first allocating the list. The problem is that you
cannot reference a list member that does not exist yet (as in x$two):
x <- vector("list", 10)
x
List x has 10 NULL elements by default. You can then assign values to these
as needed.
-Christos
-Original Message-
Hi Florent,
A simple example with the expected output would help. If I understood
correctly what you want, perhaps the following would work:
X[ X$code %in% levels(Y$code), ]
assuming Y$code is a factor. If not, you can used instead unique(Y$code) in
the above.
-Christos
-Original Messag
See ?basehaz in 'survival' package.
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Zheng Yuan
Sent: Friday, November 03, 2006 6:20 PM
To: r-help@stat.math.ethz.ch
Subject: [R] How to obtain the estimate of baseline survival function?
Hi,
If
See ?points and ?lines for adding new groups of points or lines to an
existing graph created by plot.
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Li Zhang
Sent: Friday, November 03, 2006 9:55 PM
To: R-help@stat.math.ethz.ch
Subject: [R] multiple plots
Try
?Special
For information on the special functions included in the base R
distribution.
Also,
RSiteSearch("digamma")
gives several hits on additional packages that might be useful.
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL
R] help fo finding R package "utils"
sir i have downloaded poptools for excel to import data but still feeling
problems. I am not understanding what I should do?
On 10/26/06, Christos Hatzis <[EMAIL PROTECTED]> wrote:
Amina,
The best way for enterin
d sir
I have a great problem for data entry in R. using sessionInfo() utils has
appeared. but while entring data there is a message of no object found. Sir
is there any option for spreadsheet for data entry.
I shall be thankful to you.
Amina
On 10/25/06, Christos Hatzis <[EMAIL PROTECTED]> w
Amina,
utils is a base package and should be already installed in a functional R
system.
You can try
sessionInfo()
to verify that it is loaded.
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of amna khan
Sent: Thursday, October 26, 2006 12:11
Try this (essentially the trick is to shift the invector to get the y[i-i]
effect):
constructLt<-function(invector, a=1) {
invector[invector aa <- c(1,1,0.5,2,3,0.4,4,5)
> aa
[1] 1.0 1.0 0.5 2.0 3.0 0.4 4.0 5.0
> constructLt(aa)
[1] 1.0 1.0 0.5 2.0 3.0 1.2 4.0 5.0
-Christos
-Original Mes
@stat.math.ethz.ch
Subject: Re: [R] Plotmath expression
Christos Hatzis wrote:
> Hello,
>
> I've been trying to plot a subscript in a text formula using plotmath
> but I haven't been able to do so.
>
> In my example below I would like the text label to show X[min] =
, collapse="+/-")
text(x=9, y=2, pos=2, expression(paste(X[min], "=", ll.txt)))
Any help is much appreciated.
Thanks.
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel: 781-938-3830
www.nuverabio.com
___
Tom,
coef returns a "named" vector, which is a vector with an extra attribute
called "names".
To remove the extra attribute you can:
names(a) <- NULL# through the accessor function
[EMAIL PROTECTED] <- NULL # directly accessing the attribute names
or by creating a new vector as you
Another way to do this is:
o <- order(a[,"y"],-a[,"x"], decreasing=TRUE)
a[o,]
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Richard M. Heiberger
Sent: Sunday, October 15, 2006 1:32 AM
To: zhijie zhang
Cc: R-help@stat.math.ethz.ch
Subject: Re: [R] sort
ue(pp)
> res
[1] "CBBAA" "BCBAA" "BBCAA" "CBABA" "BCABA" "CABBA" "ACBBA" "BACBA" "ABCBA"
"BBACA" "BABCA"
[12] "ABBCA" "CBAAB" "BCAAB" "CABAB" &
atistic # or wilcox.test( 1:5 ~
factor(c(1,1,0,0,0)) )$statistic
W
6
So there does not appear to be a difference between the two methods. Did I
miss something?
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Christos Hatzis
Sent: Thursda
Probably because of the offset:
U = W - n*(n+1)/2
In your example, W=12 (=3+4+5) as reported by wilcox.test. The offset is 6
(=3*4/2) and therefore U=6.
I am not certain as I haven't installed the exactRankTests package, but it
seems that wilcox.exact reports U instead of W.
-Christos H
I've found the following method to work:
e.g. for
df <- data.frame(v1,v2,v3,v4)
use:
df <- data.frame(df[1:2],v5,df[-c(1:2)])
I *believe* this is the one-line solution I was looking for. Can anyone see
why this wouldn't work?
Jon
-----Original Message-
From: Christos Hatzis
See ?append
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jon Minton
Sent: Wednesday, September 13, 2006 5:14 PM
To: r-help@stat.math.ethz.ch
Cc: 'Jon Minton'
Subject: Re: [R] inserting columns in the middle of a dataframe
Dear R users:
Try this:
old.colnames <- colnames(my.439.vars.df)
old.colnames[old.colnames=="fksm"] <- "new.name.a"
old.colnames[old.colnames=="klmk"] <- "new.name.b"
I don't think it would be too complicated to put this into a function.
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[
See ?sweep
sweep(a, 2, a[1,],"/")
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
[EMAIL PROTECTED]
Sent: Wednesday, September 06, 2006 11:49 AM
To: r-help@stat.math.ethz.ch
Subject: [R] Matrix multiplication using apply() or lappy() ?
I am
Say,
my.lm <- lm(y ~ x, data=my.data)
Then if you try:
names(summary(my.lm))
you will see the components of the summary.lm object. The coefficients and
t-statistics can be extracted by
summary(my.lm)$coefficients
and similarly for the r-squared and other statistics provided in the summary
r
eld ~ site, data=barley)
plotList[[2]] <- xyplot(yield ~ variety, data=barley)
plotList[[3]] <- xyplot(yield ~ year, data=barley)
plotList
plotList[[3]] <- update(plotList[[3]], yaxis="Yield (bushels/acre)")
print(plotList[[3]])
Obviously, you can store any lattice-based plot in t
Hi,
The difference is in the _return_ value of the function.
E.g.
> foo <- function() { cat("before\n"); cat("after\n"); return("done")}
> foo()
before
after
[1] "done"
i.e. returns the return value "done".
However
> foo2 <- function() { cat("before\n"); cat("after\n"); invisible("done")}
> foo
Hi,
You can use complete.cases
It should run faster than the code you suggested.
See following example:
x <- matrix(runif(30),10,3)
# introduce missing values
x[sample(1:10,3),1] <- NA
x[sample(1:10,3),2] <- NA
x[sample(1:10,3),3] <- NA
cor(x,use="pairwise.complete.obs")
n <- ncol(x)
n.na <-
x27;t work because in my application
f(A2) will fail if there are any zeroes in A2.
cheers
rksh
On 27 Jul 2006, at 15:10, Christos Hatzis wrote:
> This is not as elegant, but should work:
>
> a3 <- f(A2)
> a3[ which( apply(a3,1,prod) == 0 ), ] <- rep(0,ncol(a3))
> a3
&
This is not as elegant, but should work:
a3 <- f(A2)
a3[ which( apply(a3,1,prod) == 0 ), ] <- rep(0,ncol(a3))
a3
Essentially use the product to pick out the rows with at least one 0 and
replace these rows with 0s.
HTH.
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL
elpful the discussion and example in Ch.10 of Venables &
Ripley, 4th ed, that introduces the concepts behind random and mixed effects
models.
-Christos
Christos Hatzis, Ph.D.
Vice President, Technology
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Tel
XX" and "XXX".
So xify(4.1) should produce "XXX.X" as character string.
Any pointers? Or did I miss something with formatC?
-Original Message-
From: Christos Hatzis [mailto:[EMAIL PROTECTED]
Sent: Monday, July 17, 2006 16:21
To: Bashir Saghir (Aztek Globa
See ?formatC
You might need to write a simple wrapper function to implement the interface
that you want.
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bashir Saghir (Aztek
Global)
Sent: Monday, July 17, 2006 10:07 AM
To: '[EMAIL PROTECTED]'
Ternary plots are typically used to plot triplets of values (e.g.
composition of 3 components) that add up to 100% or 1. In this context, I am
not sure what a negative value means. Do the 3 numbers in your application
still add up to 100%? Alternatively, would it be meaningful to translate
the da
paste("A", 1:300, sep="")
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of YIHSU CHEN
Sent: Thursday, May 18, 2006 12:56 AM
To: R-help@stat.math.ethz.ch
Subject: [R] create a vector
Dear R users:
I have an elementary question: how to creat a vector of [
The process that you outlined is described in the Windows R FAQ 2.8 "What's
the best way to upgrade?".
The same process should apply to other platforms as well, but I don't think
it is in the general R FAQ. Perhaps it should.
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailt
Try
gsub('[[:punct:]]', '', str)
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Filipe Almeida
Sent: Tuesday, May 09, 2006 11:51 AM
To: r-help@stat.math.ethz.ch
Subject: [R] remove Punctuation characters
Hi,
I want to remove all punctuatio
I think you got it right.
The mean of the (weighted) sum of a set of random variables is the
(weighted) sum of the means and its variance is the (weighted) sum of the
individual variances (using squared weights). Here you don't have to worry
about weights.
So what you proposed does exactly this.
I did not look at your code in detail, but I see a potential problem in your
inner loop. I think you intended k to be in 2,3,...N+1. What you get from
your code is (2:N)+1 according to the operator precedence rules. You need
2:(N+1).
HTH,
-Christos
-Original Message-
From: [EMAIL PROT
See Windows FAQ 2.8 - works well.
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Thomas Harte
Sent: Wednesday, April 26, 2006 2:54 PM
To: r-help@stat.math.ethz.ch
Subject: [R] copying previously installed libraries to R 2.3.0
hi all,
is the
Hello,
I am using 'pairs' to produce a scatter plot matrix with a custom
upper.panel function to plot the Pearson's correlation coefficients for the
pairs of variables.
I would like to be able to use the actual variable names as subscripts in
rho in the printed text. I know these labels are ac
It is not very clear how you want to index your results vector.
If ss contains the indices of the results vector that you are trying to
change, this implies that you have a vector of length 9. In this case
results <- numeric(max(ss))
results[ss] <- ss + 1
will do the trick.
Or in case that ss
As suggested below,
sign(ii*1e9-f)
will give you the same result as the S-plus
compare(ii*1e-9,f)
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Bellinger Instruments
P/L
Sent: Thursday, April 20, 2006 11:02 PM
To: 'Prof Brian Ripley'
Cc:
A flexible way for doing this is to define logical vectors for the types of
samples that you want to include or exclude. You can then use logical
negation to select the complementary set:
inSet1 <- HData$H < 1.3
inSet2 <- HData$H < 8 & Hdata$DBH > 20
HDataPart1 <- Hdata[!inSet1, ]
HDataPart2 <-
You get the same result with
sum(outer(a,b))
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of jim holtman
Sent: Wednesday, April 19, 2006 3:32 PM
To: Doran, Harold
Cc: r-help@stat.math.ethz.ch
Subject: Re: [R] Basic vector operations was: Funct
See ?plotmath for the answer to your question and many more regarding math
expression drawing.
It might be worth printing this help page for future reference.
-Christos
-Original Message-
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of Jing Yang
Sent: Tuesday, April 18, 20
1 - 100 of 129 matches
Mail list logo