Dear All,
I'd like to know if it is possible to create animations with R.
To be specific, I attach a code I am using for my research to plot
some analytical results in 3D using the lattice package. It is not
necessary to go through the code.
Simply, it plots some 3D density profiles at two differe
Out of curiosity and possibly for later use: is there an R-function that
does matrix logarithms?
Best, Ingmar
On 9/21/06 8:58 PM, "Dimitrios Rizopoulos"
<[EMAIL PROTECTED]> wrote:
> Quoting Douglas Bates <[EMAIL PROTECTED]>:
>
>> On 9/21/06, Dimitrios Rizopoulos <[EMAIL PROTECTED]> wrote:
>>>
>
Dear list,
I am using Lattice graphics together with Grid. In order to get
completely good results, I would like to copy the X and Y axes from the
Lattice graphic and draw these in another Grid Viewport. Is there a way
to achieve this?
I would be gratefull for your help,
Albart Coster
You can make animated gifs using the write.gif function in the caTools package.
On 22/09/06, Lorenzo Isella <[EMAIL PROTECTED]> wrote:
> Dear All,
>
> I'd like to know if it is possible to create animations with R.
> To be specific, I attach a code I am using for my research to plot
> some analyti
I have asked a similar question before but this time
the problem is somewhat more involved. I have the
following data:
case;name;x
1;Joe;1
1;Mike;1
1;Zoe;1
2;Joe;1
2;Mike;0
2;Zoe;1
2;John;1
3;Mike;1
3;Zoe;0
3;Karl;0
I would like to count the number of "case"
in which any two "name"
a. both have
John Tillinghast wrote:
> I am updating the Bioconductor package, LMGene. Thus I am modifying someone
> else's package, editing or writing new documentation, etc.
>
> When I modify the man files in LMGene and install the library, it doesn't
> change the 'help' that R gives you. The 'help' you a
Hello all,
I have read as many merge issues as I possibly could tonight and
although I presume this is a small error, I have not found the
solution to my problem.
I'm trying to merge two data sets: dat0 and TransTable. As you can
see below, dat0 has 8000 rows, whereas TransTable has 47296
> dat <- read.delim("clipboard", sep=";")
> dat <- dat[order(dat$case, dat$name), ]
> res <- apply(combinations(nlevels(dat$name), 2), 1, function(x)
> with(dat[dat$name %in%
levels(dat$name)[x],], table(unlist(sapply(split(x, case), function(y)
ifelse(length(y) == 2,
paste(y, collapse="")
Dear Tova
There is no reason why the merged data.frame should have
exactely 8000 or less rows.
The "all=FALSE" options only says that now new rows are
generated for cases that appear only in one of the two
data.frames.
Have a look at this sample
> dat1 <- data.frame(a = c(1,2,3,4), b = letters[
On Fri, 22 Sep 2006, Tova Fuller wrote:
> Hello all,
>
> I have read as many merge issues as I possibly could tonight and
> although I presume this is a small error, I have not found the
> solution to my problem.
>
> I'm trying to merge two data sets: dat0 and TransTable. As you can
> see below,
One suggestion:
as a recursive list. For example have a look at the 'party' package
and the BinaryTree class.
I hope this helps.
Bálint
On 22/09/06, X.H Chen <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> How to store recursive resutls from a function for each step without using
> global operators <<
Note that <<- is not necessarily global:
if (exists("x")) rm(x)
f <- function() {
x <- 2
g <- function() x <<- 3
g()
x
}
f() # 3
exists("x") # FALSE
On 9/22/06, X.H Chen <[EMAIL PROTECTED]> wrote:
> Hi all,
>
> How to store recursive resutls from a function for eac
On 9/22/2006 3:23 AM, Lorenzo Isella wrote:
> Dear All,
>
> I'd like to know if it is possible to create animations with R.
> To be specific, I attach a code I am using for my research to plot
> some analytical results in 3D using the lattice package. It is not
> necessary to go through the code.
There is also a write.gif function in package caTools.
See the example there.
Best,
Matthias
>
> Dear All,
>
> I'd like to know if it is possible to create animations with R.
> To be specific, I attach a code I am using for my research to
> plot some analytical results in 3D using the lattice
Dear UseRs
I would like to show my students how to use "resampling" to solve the
following simple problem:
If a family has two children of which one is a boy, what is the
probability that the other child is also a boy.
The answer is (obviously) 1/3, and can be show easily using the usual
method
This works too:
t.d$V712 <- NULL
On Thursday 21 September 2006 22:28, Gavin Simpson wrote:
> On Thu, 2006-09-21 at 20:01 +0200, Thomas Preuth wrote:
> > delete a entire vector of a dataframe
> >
> > Hello,
> >
> > i want to delete a vector and tried "rm (t.d$V712)". This did not work,
> > message
try the following:
B <- 1
index <- rowSums(matrix(rbinom(B*2, 1, 0.5), ncol = 2))
sum(index == 2) / sum(index > 0)
I hope it helps.
Best,
Dimitris
Dimitris Rizopoulos
Ph.D. Student
Biostatistical Centre
School of Public Health
Catholic University of Leuven
Address: Kapucijnenvoer 35,
Try this:
set.seed(1)
n <- 100
first <- sample(0:1, n, replace = TRUE)
second <- sample(0:1, n, replace = TRUE)
sum(first == 1 & second == 1) / sum(first == 1 | second == 1)
# The last could be written more compactly like this
# as 1 and 0 will be treated as TRUE and FALSE by the
# logical ope
Giovanni Parrinello wrote:
> Dear All,
> I would like to find something ( references, code,..) to implement a
> comparison of three
> treatments in an observational study using the 'Propensity Score'.
> Any help is much appreciated. Thanks!
> Giovanni
>
@Article{tch05use,
author =
Thanks Jacques, this works!
Serguei
--
___
Austrian Institute of Economic Research (WIFO)
Name: Serguei Kaniovski P.O.Box 91
Tel.: +43-1-7982601-231 Arsenal Objekt 20
Fax: +43-1-7989386
Dear wise ones,
I have a problem assigning different colors to bars in a barplot.
The data I'm using is the following dataframe (truncated) :
> L0
r n p t
[...]
18 19 1 1 RFM
19 20 1 1 RFM
20 21 2 1 RFM
21 23 6 1 RIH
22 24 2 1 ROC
23 25 1 1 ROC
24 26 1 1 ROC
25 27 2 1 RO
I think it is because your command:
> coul <- array()
means that the first element of coul is NA, even after you've added the
colour names.
On 22/09/06, Octave Julien <[EMAIL PROTECTED]> wrote:
>
> Dear wise ones,
>
> I have a problem assigning different colors to bars in a barplot.
> The data I'
The problem was that I was using the unzipped distributed package, rather
than the source. Once I got the source I was fine.
See http://bioconductor.org/packages/1.8/bioc/html/LMGene.html for links to
source and package. Installing from source works differently from installing
from a package, and i
Hi list,
I want to write a general function so that it would take an lm object,
extract its data element, then use the data at another R function (eg, glm).
I searched R-help list, and found this would do the trick of the first part:
a.lm$call$data
this would return a name object but could not be
Hi,
the data of the model fit is stored in lm$model and should work
Good luck,
Thilo
On Friday 22 September 2006 16:45, Mike Wolfgang wrote:
> Hi list,
>
> I want to write a general function so that it would take an lm object,
> extract its data element, then use the data at another R functi
Hi Patrick,
Thanks for your suggestion. I find your method works for the functions with
integer paramters. For example,
If we have function f:
f<-function(i)
{
if(i>1)
i*f(i-1)
else
1
}
and then using:
ans <- vector("list", n)
for(i in 1:5) {
a
On Fri, 2006-09-22 at 10:45 -0400, Mike Wolfgang wrote:
> Hi list,
>
> I want to write a general function so that it would take an lm object,
> extract its data element, then use the data at another R function (eg, glm).
> I searched R-help list, and found this would do the trick of the first part
Hi Gabor,
Thanks for pointing out this for me. However, what I try to get is how to
construct such form a function f that
ret<-f(...),
where ret contains the each recursive result from f, and meantime f consists
of no <<- operator. Do you have any idea how to implemet this. Thanks a lot
for
Hi Bálint,
Thanks very much for your suggestions. The party package is a little bit
complicated to use. Do you have a much simpler example for this problem?
Anyway, I am gonna try this package.
Cheers,
Xiaohui Chen
Dept. of Statistics
UBC, Canada
From: "Bálint Czúcz" <[EMAIL PROTECTED]
In R, is there an automatic variable that stores the results of the most
recent command or commands? (I am thinking of a behavior like
Mathematica's % result-history substitution syntax.)
(I am using R 2.3.1 on Linux and R 2.3.1 on Windows XP.)
This is a pretty basic question, so I tried to do
Yeh, Richard C wrote:
> In R, is there an automatic variable that stores the results of the most
> recent command or commands? (I am thinking of a behavior like
> Mathematica's % result-history substitution syntax.)
>
Something like .Last.value:
> x=sqrt(2)
> .Last.value
[1] 1.414214
whi
1. The point is that you can use <<- and still not pollute the
global environment with any variables so its not clear
why there should be any requirement not to use it.
Other possiblities are
2. to pass the info around through the return value or through an environment:
fact <- function(n) {
> I have asked a similar question before but this time
> the problem is somewhat more involved. I have the
> following data:
>
> case;name;x
> 1;Joe;1
> 1;Mike;1
> 1;Zoe;1
> 2;Joe;1
> 2;Mike;0
> 2;Zoe;1
> 2;John;1
> 3;Mike;1
> 3;Zoe;0
> 3;Karl;0
>
> I would like to count the number of "case"
> in w
On Fri, 22 Sep 2006, Thilo Kellermann wrote:
> Hi,
>
> the data of the model fit is stored in lm$model and should work
>
Not reliably. In the first place, you should use the accessor function
model.frame(model) rather than model$model, which works even if the model
was fitted with model=FAL
That's perfect! Thanks!
I now see that .Last.value is mentioned in the 'Introduction to R',
footnote 5. Sorry, I hadn't read it that carefully.
(Before posting, I even did read
> help('.Last')
but thought that that function wasn't what I wanted.
I guess I wasn't using the right keywords.
> help
what's different from:
> with(dat, tapply(x, list(name,case), sum))
1 2 3
Joe 1 1 NA
John NA 1 NA
Karl NA NA 0
Mike 1 0 1
and how to deal with this table ?
---
Jacques VESLOT
CNRS UMR 8090
I.B.L (2ème étage)
1 rue d
I am getting a bit rusty on some of these things, but I seem to recall
that there is a numerical advantage (speed and/or accuracy?) to
diagonalizing:
> expM <- function(X,e) { v <- La.svd(X); v$u %*% diag(v$d^e) %*% v$vt }
> P <- matrix(c(.3,.7, .7, .3), ncol=2)
> P %*% P %*% P
[,1] [
On Fri, 22 Sep 2006, X.H Chen wrote:
> Hi Gabor,
>
> Thanks for pointing out this for me. However, what I try to get is how to
> construct such form a function f that
>
> ret<-f(...),
>
> where ret contains the each recursive result from f, and meantime f consists
> of no <<- operator. Do you ha
> what's different from:
> > with(dat, tapply(x, list(name,case), sum))
>1 2 3
> Joe 1 1 NA
> John NA 1 NA
> Karl NA NA 0
> Mike 1 0 1
>
> and how to deal with this table ?
Well, the syntax is easier (once you have the data in the correct,
molten, form), and more flexible for ot
On Fri, 22 Sep 2006, Thomas Lumley wrote:
> On Fri, 22 Sep 2006, Thilo Kellermann wrote:
>
>> Hi,
>>
>> the data of the model fit is stored in lm$model and should work
>>
>
> Not reliably. In the first place, you should use the accessor function
> model.frame(model) rather than model$model, wh
Dear all,
Does the frailty.object$history[[1]]$theta returns the Variance of random
effect?
Why is the value different? Here is an example with kidney data:
> library(survival)
> data(kidney)
> frailty.object<-coxph(Surv(time, status)~ age + sex + disease +
frailty(id), kidney)
> frailty.object
Excuses me Dear Martin,
I have make a mistake when posting my message !
Sincerly !
- Message d'origine
De : Martin Maechler <[EMAIL PROTECTED]>
À : justin bem <[EMAIL PROTECTED]>
Cc : Martin Maechler <[EMAIL PROTECTED]>
Envoyé le : Vendredi, 22 Septembre 2006, 7h39mn 25s
Objet : Re
Dear everybody!
take a<-c(5,3,NA,6).
if(a[1]!=NA){b<-7}
if(a[3]!=5){b<-7}
if(a[3]!=NA){b<-7}
if(a[3]==NA){b<-7}
will alltogeather return
Fehler in if (a[1] != NA) { : Fehlender Wert, wo TRUE/FALSE nötig ist
(or simularly). Somehow this is logical. But how else should I get out,
whether a certai
Mag. Ferri Leberl wrote:
> Dear everybody!
> take a<-c(5,3,NA,6).
>
> if(a[1]!=NA){b<-7}
> if(a[3]!=5){b<-7}
> if(a[3]!=NA){b<-7}
> if(a[3]==NA){b<-7}
>
> will alltogeather return
>
> Fehler in if (a[1] != NA) { : Fehlender Wert, wo TRUE/FALSE nötig ist
>
> (or simularly). Somehow this is log
On Fri, 2006-09-22 at 20:16 +0200, Mag. Ferri Leberl wrote:
> Dear everybody!
> take a<-c(5,3,NA,6).
>
> if(a[1]!=NA){b<-7}
> if(a[3]!=5){b<-7}
> if(a[3]!=NA){b<-7}
> if(a[3]==NA){b<-7}
>
> will alltogeather return
>
> Fehler in if (a[1] != NA) { : Fehlender Wert, wo TRUE/FALSE nötig ist
>
> (o
Can someone help me understand the following behavior of "[<-" ?
If I define a simple class based on a matrix, the [<- operation only
inserts into the first column:
> x <- matrix(rnorm(10),nrow=5,ncol=2)
> class(x) <- "foo"
> "[<-.foo" <- function(x, i, j, value) {
+ if(missing(i)) i <- 1:n
If you run R on Linux, then you can run the ImageMagick command called
convert. I place this in an R function to use a sequence of PNG plots as
movie frames:
make.mov.plotcol3d <- function(){
unlink("plotcol3d.mpg")
system("convert -delay 10 plotcol3d*.png plotcol3d.mpg")
}
Examples c
Try this:
x <- matrix(rnorm(10),nrow=5,ncol=2)
class(x) <- "foo"
"[<-.foo" <- function(x, i = TRUE, j = TRUE, ..., value) {
x <- unclass(x)
x <- NextMethod()
class(x) <- "foo"
x
}
x[] <- 100.0
On 9/22/06, Armstrong, Whit <[EMAIL PROTECTED]> wrote:
> Can someone help me unde
An alternative that I've used a few times is the jpg() function to
create the sequence of images, and then converting these to an mpeg
movie using "mencoder" distributed with "mplayer". This works on both
windows and linux. I have a pretty self-contained example file
written up that I can send to
See the flag= argument on formatC:
n <- 10
formatC(1:n, dig = nchar(n)-1, flag = 0)
# Here is another way:
n <- 10
sprintf(paste("%0", nchar(n), ".0f", sep = ""), 1:n)
On 9/22/06, J.R. Lockwood <[EMAIL PROTECTED]> wrote:
> An alternative that I've used a few times is the jpg() function to
> cr
Hi Folks,
I've just come across a kind of problem which leads
me to wonder how to approach it in R.
Basically, each a set of items is subjected to a series
of "impacts" until it eventually "fails". The "force"
of each impact would depend on covariates X,Y say;
but as a result of preceding impact
Dear list,
My problem is to change the strip text of lattice panels when using two
factors.
I have a data frame with two factors:
df <- expand.grid( "fact1"=c("y","b","r"),
"fact2"=c("far","por","lis","set"), "year"=1991:2000, "value"= NA)
df[,"value"] <- sample(1:50, 120, replace=TRUE)
I can m
Try this:
levels(df$fact2) <- c("faro","porto","lisbon","setubal")
xyplot( value ~ year | fact1*fact2, data=df, type="b")
On 9/22/06, Rafael Duarte <[EMAIL PROTECTED]> wrote:
> Dear list,
> My problem is to change the strip text of lattice panels when using two
> factors.
> I have a data frame w
Hello R-help:
I was hoping someone could help me understand a particular function i came
across in a package:
"$.myClass" <- function( x, name ) {
sym = paste( "foo", name, sep = "_" )
if( is.loaded(sym) )
.Call(sym,x)
}
I understand the paste, and .Call part, but I
Hi there,
I have the following plot. The circles and the line do not cross in
the main plot. But in the legend, the circle and the line cross. I am
wondering if there is a way to make the legend look like the plot
without crossing. I looked around but did not find a way to do that.
Is it d
If the main thing you want is just to ensure that the legend and
plot are consistent it would be easier to change the plot than
change the legend:
x <- 1:10
plot(x,x^1.5, pch=1)
lines(x, x^1.5,lty=1)
legend(1,25, legend="hello",pch=1, lty=1)
On 9/22/06, Bingshan Li <[EMAIL PROTECTED]> wrote:
>
Iuri Gavronski schrieb:
> Other text I am trying to find is multivariate data analysis (EFA,
> cluster, mult regression, MANOVA, etc.) with examples with R.
Hi Iuri,
for your second answer I would recommend
B. Everitt: An R and S-PLUS Companion to Multivariate Analysis. Springer 2005.
isbn 1-8
I'm hoping someone can help me. I have downloaded the proj4R.zip and under my
version of R (2.3.1) I install the package from local zip file. This worked
great. I then type library(proj4R) to load the library and I get the error:
Error in library(proj4R) : 'proj4R' is not a valid package -- in
Hi all,
I need to solve double integrals with no closed solution. Calling x and y the
two variables we have x ~ Normal(y*v,1) and y ~Half-Normal(0,1). In fact, given
a joint funcion g(x,y), I need evaluate the integral of this function under
that random structure. Could anyone suggest me a
Hi all,
I need to solve double integrals with no closed solution. Calling x and y the
two variables we have x ~ Normal(y*v,1) and y ~Half-Normal(0,1). In fact, given
a joint funcion g(x,y), I need evaluate the integral of this function under
that random structure. Could anyone suggest me a
On Fri, 2006-09-22 at 17:16 -0400, Philip Bermingham wrote:
> I'm hoping someone can help me. I have downloaded the proj4R.zip and
> under my version of R (2.3.1) I install the package from local zip
> file. This worked great. I then type library(proj4R) to load the
> library and I get the error:
Caio Lucidius Naberezny Azevedo said the following on 9/22/2006 4:40 PM:
> Hi all,
>
> I need to solve double integrals with no closed solution. Calling x and y
> the two variables we have x ~ Normal(y*v,1) and y ~Half-Normal(0,1). In fact,
> given a joint funcion g(x,y), I need evaluate t
On 9/22/2006 4:02 PM, Sender wrote:
> Hello R-help:
>
> I was hoping someone could help me understand a particular function i came
> across in a package:
>
> "$.myClass" <- function( x, name ) {
> sym = paste( "foo", name, sep = "_" )
> if( is.loaded(sym) )
> .Call(s
hi, there:
i have 2 questions associated with heatmap
in heatmap.2{gplot}, there is a bar called "raw z-score" showing the
coloring legend for each pixel. Where can I find that z-score's
formulae?
question 2,
for example, I have 5 groups and I want to label each group with a
color name from "#FF0
So...are you trying to modify a contributed package by adding a *.R file
to the 'R' subdirectory in the package? One thing to consider besides
the previous tip is that the package might be using a NAMESPACE, which
lives in the package root directory (one directory up from the 'R'
subdirectory).
Dear R users,
I have a question about R installation under Cygwin. When running
./configure, I can't pass the checking phase due to an error:
--with-readline=yes (default) and headers/libs are not available... Anybody
who can tell me why this error arises? Thanks a lot.
Xiaohui Chen
Dept. of
On 9/22/2006 10:29 PM, X.H Chen wrote:
> Dear R users,
>
> I have a question about R installation under Cygwin. When running
> ./configure, I can't pass the checking phase due to an error:
> --with-readline=yes (default) and headers/libs are not available... Anybody
> who can tell me why this e
Weiwei Shi wrote:
> hi, there:
> i have 2 questions associated with heatmap
>
> in heatmap.2{gplot}, there is a bar called "raw z-score" showing the
> coloring legend for each pixel. Where can I find that z-score's
> formulae?
>
A Z-score is the mean of the group divided by the standard deviatio
Sean Davis wrote:
> Weiwei Shi wrote:
>
>> hi, there:
>> i have 2 questions associated with heatmap
>>
>> in heatmap.2{gplot}, there is a bar called "raw z-score" showing the
>> coloring legend for each pixel. Where can I find that z-score's
>> formulae?
>>
>>
> A Z-score is the mean of
I am using Windows XP and R 2.3.1.
During my lastest session I updated my packages and now when I try to start
R 2.3.1
I get the following error message:
Fatal error: unable to restore saved data in .RData in an error window and
Error in loadNamespace(name): there is no package called 'nlme' in th
useRs,
A no doubt simple question, but I am baffled. Indeed, I think I
once knew the answer, but can't recover it. The default contrasts
for aov (and lm, and...) are contr.treatment and contr.poly for
unordered and ordered factors, respectively. But, how does one
invoke the latter? T
With this:
> plot(seq(from=0,to=10,by=1),1-pbinom
> (seq(from=0,to=10,by=1),size=6,prob=0.50),pch=15)
How do you change the Y-axis from 0 ~ 0.6?
I only get 0.0 ~1.0.
thx much
__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listin
On Fri, 22 Sep 2006, Duncan Murdoch wrote:
> On 9/22/2006 10:29 PM, X.H Chen wrote:
>> Dear R users,
>>
>> I have a question about R installation under Cygwin. When running
>> ./configure, I can't pass the checking phase due to an error:
>> --with-readline=yes (default) and headers/libs are not av
On Fri, 22 Sep 2006, [EMAIL PROTECTED] wrote:
> Hi Folks,
>
> I've just come across a kind of problem which leads
> me to wonder how to approach it in R.
>
> Basically, each a set of items is subjected to a series
> of "impacts" until it eventually "fails". The "force"
> of each impact would depen
74 matches
Mail list logo