252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] igraph_0.5.5-3
Thanks.
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
999 Broadway, Suite 301
Saugus, MA 01906
__
You can try
rm(list = ls()[!(ls() %in% "index")]).
-Christos
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Luc Villandre
> Sent: Friday, May 29, 2009 2:06 PM
> To: fernando espindola
> Cc: r-help@r-project.org
> Subject:
Hi,
Is there a way to find which functions are flagged for debugging in a given
session?
Thank you.
-Christos
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE d
The following site is your friend:
http://www.rseek.org/
-Christos
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of
> meenu.s...@ingim.com
> Sent: Friday, March 20, 2009 5:47 AM
> To: r-help@r-project.org
> Subject: [R] Sta
See ?pdf and its width and height arguments.
Also if you want to have the graph centered on a standard page, there are
additional arguments to help you achieve that effect:
> pdf("test.pdf", height=5, width=5, paper="letter", pagecentre=TRUE)
> hist(rcauchy(100))
> dev.off()
-Christos
> -Or
Bioconductor already provides download stats for all packages...
http://bioconductor.org/packages/stats/bioc/affy.html
-Christos
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Max Kuhn
> Sent: Tuesday, March 10, 2009 12:25
Take a look at the elasticnet package.
-Christos
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of joris meys
> Sent: Tuesday, March 10, 2009 3:43 PM
> To: R-help Mailing List
> Subject: [R] Sparse PCA in R
>
> Dear all,
>
>
You can easily write a simple function to do that:
letters2num <- function(x) {
nletters <- 1:length(LETTERS)
names(nletters) <- LETTERS
nletters[x]
}
> x <- c("A", "X", "F", "W", "G", "V", "L")
> letters2num(x)
A X F W G V L
1 24 6 23 7 22 12
-Christos
> --
Hi Ken,
The help page for ?"for" says that:
The index seq in a for loop is evaluated at the start of the loop; changing
it subsequently does not affect the loop. The variable var has the same type
as seq, and is read-only: assigning to it does not alter seq.
So you cannot do what you want to do
gregexpr("\\at|\\og", text)
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Corey Sparks
> Sent: Wednesday, February 25, 2009 11:50 AM
> To: R Help
> Subject: [R] Using gregexpr with multiple search elements
>
> Dear list,
>
Maybe as a starter
RSiteSearch("linear discriminant analysis")
R has tools to help you help yourself with this types of questions.
-Christos
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Arup
> Sent: Wednesday, February
I don't know if there is a direct, perl-like way to capture the matches, but
here is a solution:
> mdat <- gregexpr("[[:digit:]]{8}", txt)
> dates <- mapply(function(x, y) substr(txt, x, x + y - 1), mdat[[1]],
attr(mdat[[1]], "match.length"))
> dates
[1] "20080101" "20090224"
-Christos
> -
You're right. The help page is somewhat misleading at first read.
?`[<-.data.frame` states that (with added emphasis)
value A suitable replacement value: it will be repeated a whole number of
times if necessary and it may be coerced: see the Coercion section. *** If
NULL, deletes the column if
Setting to NULL works only if a single column is selected.
More generally,
df[, !(colnames(df) %in% c("var.b", "var.c")), drop=FALSE]
-Christos
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Sean Zhang
> Sent: Tuesday, Fe
Here's a way without a loop:
x <- read.table(textConnection("ID X2
1.001.00
2.000.00
3.001.00
4.003058
5.000.00
6.006.00"),header=TRUE)
closeAllConnections()
x$X3 <- append(x$X2, 0, 0)[-nrow(x)]
x$X4 <- as.matrix(x[,2:3]) %*% c(1, 0.24)
> x
ID X2 X3 X4
1
You might want to compare the performance of your version to the kronecker
method of Matrix (Matrix package) that has appropriate versions for sparse
matrices etc.
-Christos
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Cam
It seems to be in optimize.c
Rgonzui has a very nice search facility for source of R or CRAN packages
(however it is against R 2.8.0 source):
http://rgonzui.nakama.ne.jp/R/markup/R-2.8.0/src/main/optimize.c?fm=c&q=nlm#
l378
-Christos
> -Original Message-
> From: r-help-boun...@r-project.
This requires a small modification to use which instead of which.max that
returns only the first maximum:
do.call("rbind", lapply(split(xveg, xveg$loc), function(x) x[which(x$tot ==
max(x$tot)), ]))
loc sp tot
L1L1 b 60
L2.5 L2 d 25
L2.7 L2 e 25
L3L3 b 68
-Christos
> ---
I don't have an easy solution with aggregate, because the function in
aggregate needs to return a scalar.
But the following should work:
do.call("rbind", lapply(split(xveg, xveg$loc), function(x)
x[which.max(x$tot), ]))
loc sp tot
L1 L1 b 60
L2 L2 e 30
L3 L3 b 68
-Christos
> -O
Ok. So you have a set of features, which when combined in a certain way
predict a binary outcome, i.e. a multi-feature binary predictor.
You have to decide first what is the hypothesis that you want to test
regarding this predictor in the study that you're designing. E.g. that
prediction accurac
Here is a way to do this:
round(upper.tri(matrix(1, 9, 9)))
Or if you also need the diagonal of one's
round(upper.tri(matrix(1, 9, 9), diag = TRUE))
-Christos
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Dale Steele
>
One way to do this is through transform, assuming that there is one-to-one
correspondence between regions and elements:
mydf <- data.frame(region=c(rep("North", 5), rep("East", 5), rep("South",
5), rep("West", 5)))
elements <- c("earth", "water", "air", "fire")
transform(mydf, element = factor(reg
If you want to chose numbers from your range with uniform probability
runif(1, 0, 0.5)
See ?runif
-Christos
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Vie
> Sent: Monday, February 09, 2009 9:41 AM
> To: r-help@r-proje
... which is the same as
setdiff(union(x, y), intersect(x, y))
-Christos
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of
> dav...@rhotrading.com
> Sent: Tuesday, January 13, 2009 10:56 AM
> To: Juliet Hannah; r-help@r-proj
An alternative that works for any base (other than 10) is the following:
> library(sfsmisc)
> digitsBase(1001, 10)
Class 'basedInt'(base = 10) [1:1]
[,1]
[1,]1
[2,]0
[3,]0
[4,]1
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On
A simple approach would be to start a fresh R session and source your
function.
Then save that workspace as, e.g., myFuncs.RData.
In future sessions all you have to do is
attach("myFuncs.Rdata")
and your functions will be available for you to use.
-Christos
> -Original Message-
> From:
Udo,
You can try inserting a newline where you need the break in your labels:
> dd.names <- c('Conduct Disorders','Attention Deficit', 'Eating Disorders',
'Substance Abuse','Developmental Disorders')
> dd.names.2 <- sapply(dd.names, function(x) gsub("\\s", "\\\n", x))
> barplot(dd, names.arg=dd.n
Try the following instead:
vegdata.dd[is.na(vegdata.dd)] <- 0.01
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Friday, October 17, 2008 4:50 PM
> To: [EMAIL PROTECTED]
> Subject: [R] using ifelse with surpr
hat "avoiding loops" rarely matters.
>
> Also see ?replicate for a way to perhaps write cleaner code
> (but still using hidden interpreted loops).
>
> -- Bert Gunter
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf O
Have a look at mapply.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of David Afshartous
> Sent: Thursday, October 16, 2008 3:47 PM
> To: r-help@r-project.org
> Subject: [R] Loop avoidance in simulating a vector
>
>
>
> All,
>
> I'd
You might find Robert Gentleman's recent book useful for exposure on many of
the more advanced features of R.
http://www.bioconductor.org/pub/RBioinf/
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Hua Li
> Sent: Thursday, October 09,
Hi John,
As I mentioned in our private exchange, this is well known in R, i.e.
vectorized versions are not always faster or more efficient than straight
loops. It is a misconception that loops should be avoided at any cost. See
John Fox's illuminating article on Rnews (p. 46) on this subject.
ht
which(A %in% B)
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of mentor_
> Sent: Wednesday, October 08, 2008 11:19 AM
> To: r-help@r-project.org
> Subject: [R] Using grep
>
>
> Hi,
>
> I have a vector A with (200, 201, 202, 203, 204, .
John,
Try the following:
> mapply(function(p, r, x) sub(p, r, x, fixed = TRUE), p=patt, r=repl, x=X)
b cda
"aB" "CD" "ef"
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Thaden, John J
> Sent: Tuesday, October 07, 2008 3:59 P
It might be an overkill for what you need, but take a look at package Ruuid.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Ralph S.
> Sent: Thursday, September 04, 2008 11:44 PM
> To: r-help@r-project.org
> Subject: [R] algorithm to cr
Try:
> unlist(mapply(seq, c(1,20,50), c(7,25,53)))
[1] 1 2 3 4 5 6 7 20 21 22 23 24 25 50 51 52 53
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Chris Oldmeadow
> Sent: Tuesday, August 26, 2008 12:42 AM
> To: r-help@r-project.
Try this:
> paste(paste(x, c(" ","\n"), sep=""), collapse="")
[1] "1 2\n3 4\n5 6\n"
-Christos Hatzis
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of remko duursma
> Sent: Monday,
The above approach is not restricted to 2x2 tables, and should be
straightforward generate datasets that conform to arbitrary nxm frequency
tables.
-Christos Hatzis
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Greg Snow
> Sent: Fri
Mark,
It is not clear whether you are dealing with a single list or something more
complex, such as a list of lists or a list of data frames. In the case of a
single list, you don't really need any of the 'apply' functions. The main
problem in your code is the use of '&&' instead of '&':
> test
Jose,
I think shell.exec should do what you want:
shell.exec("http://www.yahoo.com";)
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Friday, August 15, 2008 6:56 AM
> To: r-help@r-project.org
> Subject: [R
Would something like this work?
my.list <- as.list(c(NIM.results$par, a.hat.decision, etc))
do.call("Draw.NIM.POD.curve", my.list)
-Christos Hatzis
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Charles Annis, P.E.
>
Eleni,
A way to do this is to group the data first using 'split' and then sapply
the dist function to this list.
The slower step will be the split which took a couple of minutes on my
laptop but sapply should not take more than a minute or so.
size <- 1
df <- data.frame(
id=rep(sample
Have a look at gsub:
> x <- "001-010-001-0"
> gsub("^0+", "", x)
[1] "1-010-001-0"
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of calundergrad
> Sent: Thursday, July 31, 2008 4:40 PM
> To: r-help@r-project.org
> Subject: [R] cutting ou
Try this:
> x <- matrix(runif(20), ncol=2)
> x
[,1] [,2]
[1,] 0.33119833 0.4797847
[2,] 0.01339784 0.5218626
[3,] 0.78975940 0.8597246
[4,] 0.60849015 0.5217248
[5,] 0.91779777 0.9364047
[6,] 0.88302538 0.3467961
[7,] 0.87565986 0.4029147
[8,] 0.51594479 0.9885018
[9,] 0.
A more general solution:
strip.fun <- function(x, split=".") {
xx <- strsplit(x, split, fixed=TRUE)
txx <- table(unlist(xx))
nxx <- names(txx)[txx > 1]
setdiff(unlist(xx), nxx)
}
> x <- c("dog.is.an.animal", "cat.is.an.animal", "rat.is.an.animal")
> strip.fun(x)
[1
I just received mine today (had pre-ordered it directly from Springer)
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Wednesday, July 30, 2008 2:27 PM
> To: r-help@r-project.org
> Subject: [R] john chambers
matrix(rep(x, each=13) - xk, nrow=13)
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of dxc13
> Sent: Tuesday, July 29, 2008 2:13 PM
> To: r-help@r-project.org
> Subject: [R] finding a faster way to do an iterative computation
>
>
> useR's,
>
> I
NA "D" NA NA
> rna(x)
[1] "A" "B" "B" "B" "C" "C" "C" "C" "C" "D" "D" "D"
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
> x <- "B03_MAH 0.2115 0.2087 0.2087 0.2147 0.2115 0.2176"
> strsplit(x, " +")
[[1]]
[1] "B03_MAH" "0.2115" "0.2087" "0.2087" "0.2147" "0.2115" "0.2176"
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Kim Milferstedt
> Sent
> k <- c(1,1,1,2,2,1,1,1)
> k[k != 1]
[1] 2 2
> k[k != 2]
[1] 1 1 1 1 1 1
> k[k != 3]
[1] 1 1 1 2 2 1 1 1
>
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Shubha
> Vishwanath Karanth
> Sent: Wednesday, May 14, 2008 11:16 AM
> To: [EMA
Try %in%
subset(dat, treatment %in% vec)
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Friday, May 02, 2008 11:41 PM
> To: r-help@r-project.org
> Subject: [R] help with subset
>
> Dear list:
>
> I have a problem us
Christian,
You need to use reshape to convert to the 'long' format.
Check the help page ?reshape for details.
>dat <- read.table('clipboard', header=TRUE)
>dat
site lat lon spec1 spec2 spec3 spec4
1 site1 10 11 1 0 1 0
2 site2 20 21 1 1 1 0
3 site3 30 31
Another option in R is to use the vectorized version 'ifelse', which has an
advantage if x is a vector:
> x <- -1:4
> x
[1] -1 0 1 2 3 4
> ifelse(x == 1, 'same', ifelse(x > 1, 'bigger', 'smaller'))
[1] "smaller" "smaller" "same""bigger" "bigger" "bigger"
-Christos
> -Original Mes
The place to look is the CRAN Task View 'ExperimentalDesign'.
There are several packages there related to design and analysis of
experiments.
The package 'AlgDesign' appears to have a function for generating mixture
designs, and there might be others in other packages.
Good luck!
-Christos
> -
length(unlist(strsplit(C, ' ')))
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Shubha
> Vishwanath Karanth
> Sent: Wednesday, April 09, 2008 11:21 AM
> To: [EMAIL PROTECTED]
> Subject: [R] Number of words in a string
>
> Hi R,
>
>
>
> A qui
Here is as solution that calculates derivatives using central differences by
appropriately embedding the vectors:
> grad.1
function(x, fn) {
x <- sort(x)
x.e <- head(embed(x, 2), -1)
y.e <- embed(fn(x), 3)
hh <- abs(diff(x.e[1, ]))
y.e <- apply(y.e, 1, function(z) (z[1] - z[3])/(2 * hh))
cbind
March 27, 2008 3:17 AM
> To: Christos Hatzis
> Cc: r-help@r-project.org
> Subject: Re: [R] Rule for accessing attributes?
>
> Oh please don't recommend misuse of @ to those already confused.
>
> @ is for accessing slots in S4 objects. This 'works' because
> they
You need to use the '@' operator to directly access attributes (not
elements) of objects:
> [EMAIL PROTECTED]
[1] "x" "y" "z"
See ?'@' for more details.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Tribo Laboy
> Sent: Thursday, March
John,
There is a peak finding algorithm attributed to Prof. Ripley in the R-help
archive. It has a span parameter which might give you something close to
what you seem to be looking for.
http://finzi.psych.upenn.edu/R/Rhelp02a/archive/33097.html
-Christos
> -Original Message-
> From:
Monica,
You can try the following:
> x.tot <- aggregate(x$val, by=list(total=x$locat), 'sum')
> x.tot
total x
1 a 5
2 b 20
3 c 40
4 d 30
> cbind(x, perc=x$val/rep(x.tot$x, table(x$locat)) * 100)
locat val perc
1 a 5 100.0
2 b 5 25.0
3 b 15
Try this one:
> gsub("^(plif)([a-z]*)", "\\1ONE", words)
[1] "plifONE" "plafboum" "ploufbang" "plifONE"
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of GOUACHE David
> Sent: Wednesday, March 12, 2008 12:15 PM
> To: [EMAIL PROTECTED]
Try:
> names(which(my_list == 'Fred'))
[1] "name"
You can break down the two nested calls to figure out what is happening.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Srinivas Iyyer
> Sent: Wednesday, March 12, 2008 6:53 PM
> To: Be
Ramon,
If you are looking for a solution to your specific application (as opposed
to a general compression/ decompression mechanism), it might be worth
checking out the Matrix package, which has facilities for storing and
manipulating sparse matrices. The sparseMatrix class stores matrices in the
Googling "MUAC" mentioned in that message will take you to the following
site with information on the algorithm and apparently access to the code.
http://www.acooke.org/jara/muac/index.html
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf O
Sorry, it should have been:
col = c("red", "blue")[c(rep(1, 100), rep(2, 15))]
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Christos Hatzis
> Sent: Tuesday, February 26, 2008 4:46 PM
> To: '
If your samples are in the specified order (i.e. first 100 from group A and
remaining from group B) you can try the following in your plot call:
plot(..., col=c("red", "blue")[c(rep(100, 1), rep(15, 2))])
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECT
Introduce
cat(j)
flush.console()
in your loop.
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Waterman,
> DG (David)
> Sent: Tuesday, February 05, 2008 11:20 AM
> To: r-help@r-project.org
> Subject: [R] immediate print
>
> Hi every
Also, see ?aggregate:
> with(A, aggregate(no_of_accidents, by=list(SEX=sex), FUN='sum'))
SEX x
1 F 34
2 M 83
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Attiglah, Mama
> Sent: Tuesday, January 29, 2008 7:21 AM
> To: [EMAIL PROTECTED]; r
Take a look at ?reshape - it is used to convert between 'long' and 'wide'
formats of data tables (frames).
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of
> [EMAIL PROTECTED]
> Sent: Friday, January 25, 2008 4:30 PM
> To: r-help@r-proj
formatC(round(12.01), digits=1, format="f")
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Lucke, Joseph F
> Sent: Thursday, January 24, 2008 4:37 PM
> To: r-help@r-project.org
> Subject: [R] Displaying trailing zeroes
>
> round(12.01,1
You need to use '&' instead of '&&':
A shorter version of your code using ifelse:
das$danger <- with(das, ifelse(age>65 & bmi>30, 1, 0))
HTH
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Gerard Smits
> Sent: Tuesday, January 01, 200
It not entirely clear, but I think that you are looking for
seq(t-1, 1)
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Owe Jessen
> Sent: Thursday, December 20, 2007 1:29 PM
> To: [EMAIL PROTECTED]
> Subject: [R] Recursive solution wit
te handy.
> It covers Perl, C, PHP, Python, Java, and .Net.
>
> David L. Reiner
> Rho Trading Securities, LLC
>
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED]
> On Behalf Of Christos Hatzis
> Sent: Tuesday, December 11, 2007 9:47 AM
Hello,
Could someone recommend a good book on regular expressions with focus on
applications/use as it might relate to R. I remember there was a mention of
such a reference book recently, but I could not locate that message on the
archive.
Thanks.
-Christos
Christos Hatzis, Ph.D.
Nuvera
According to the help page sprintf will recycle its arguments:
The arguments (including fmt) are recycled if possible a whole number of
times to the length of the longest, and then the formatting is done in
parallel.
Therefore the following works:
> sprintf("Number: %d", A)
[1] "Number: 3" "Nu
Another useful search facility is
http://www.rseek.org
The nice thing is that it categorizes results by help-list items, R function
etc.
It might be closer to what you are looking for.
-Christos
Christos Hatzis, Ph.D.
Nuvera Biosciences, Inc.
400 West Cummings Park
Suite 5350
Woburn, MA 01801
Try split:
> x <- matrix(letters[1:4], 2)
> x
[,1] [,2]
[1,] "a" "c"
[2,] "b" "d"
> split(x, row(x))
$`1`
[1] "a" "c"
$`2`
[1] "b" "d"
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Søren Højsgaard
> Sent: Monday, November 1
In terms of recommended approach, I think it would be easier to generate
subsetting conditions as (lists of) logical vectors and use those as
suggested before. It seems to me more cumbersome to use the data to
generate logical conditions as text strings and then parse those within your
wrapper to
The following variation of what you proposed will allow you to either subset
the dataset outside coxph or to use the subset argument:
subwrap5 <- function(x, sb=NULL) {
coxph(Surv(times,event)~trt, data = x, subset = sb)
}
subwrap5(testdf, testdf$sex == 'F')
subwrap5(testdf[testdf$sex == 'F',
Instead of mapply, use lapply (it is more appropriate in this case anyway as
you have only one list that you need to iterate over):
lapply(df.list, function(x) coxph(form, x))
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Erik Ivers
Another way to do this without messing with environments is to update the
data and formula locally within the function and re-run the regression on
the updated model/data:
tukey.test <- function(m) {
ud <- data.frame( m$model, pred2=m$fitted.values^2 )
uf <- update.formula(formula(m$terms)
> a <- c(2, 3, 7, 5)
> b <- c(4, 7, 8, 9)
> mapply(seq, from=a, to=b)
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Rolf Turner
> Sent: Tuesday, October 23, 2007 11:29 PM
> To: Anya Okhmatovskaia
> Cc: r-help@r-project.org
> Subject: R
nt studies).
-Christos
> -Original Message-
> From: Armin Goralczyk [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, October 10, 2007 7:27 AM
> To: [EMAIL PROTECTED]
> Cc: R-help@r-project.org
> Subject: Re: [R] Visualize cox proportional hazards
>
> On 10/9/07,
There are at least a couple of versions of such plots.
Search for forest plots:
help.search("forest plot")
-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 Messag
t;U" "U" "A"
>
> My original fff is a factor with levels c
> ("Unit","Achievement","Scholarship"). If you make that
> adjustment, you get the ``right answer''.
> > Actually we have another problem too, name
Would
levels(fff) <- c("A","S","U")
not work? Can you send an example?
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Rolf Turner
> Sent: Wednesday, October 03, 2007 12:58 AM
> To: r-help list
> Subject: [R] Factor levels.
>
>
> I
Instead of
> bmisds(age,gender,bmi)
Try the vectorized version
> mapply(bmisds, age, gender, bmi)
See ?mapply
-Christos
> -Original Message-
> From: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] On Behalf Of Chung-hong Chan
> Sent: Wednesday, October 03, 2007 12:31 AM
> To: [EMA
87 matches
Mail list logo