[R] Mtext doesn't display characters in italic when I use a greek symbol

2008-08-07 Thread michael watson (IAH-C)
Following on from my previous mail! plot(1:10,1:10) mtext("title", side=3, adj=0, font=3, cex=1.5) This works as expected and puts the font in italics. tag <- "A)" suffix <- "genea::" plot(1:10,1:10) mtext(bquote(.(tag) ~ Delta * .(suffix)), side=3, adj=0, font=3, cex=1.5) Here, the font isn't

Re: [R] using acf() for multiple columns

2008-08-07 Thread rcoder
Hi Gary, Thanks for your reply. This works fine. Is there any way to send the ACF data to a matrix, so I could analyse the data in excel for e.g.? Thanks, rcoder Ling, Gary (Electronic Trading) wrote: > > Hi, here is one possible solution ... > -gary > > ### example ### > > # cre

[R] Trying to run simple survival program in R but does not work

2008-08-07 Thread Trev101
Hey, I am just starting to learn R now and I typed in this simple survival program: library(survival) t <- c(10,13,18,19,23,30,36,38,54,56,59,75,93,97,104,107,107,107) c <- c(1,0,0,1,0,1,1,0,0,0,1,1,1,1,0,1,0,0) data <- Surv(t,c) km <- survfit(data) summary(km) Call

Re: [R] Mtext doesn't display characters in italic when I use a greek symbol

2008-08-07 Thread Prof Brian Ripley
On Thu, 7 Aug 2008, michael watson (IAH-C) wrote: Following on from my previous mail! plot(1:10,1:10) mtext("title", side=3, adj=0, font=3, cex=1.5) This works as expected and puts the font in italics. tag <- "A)" suffix <- "genea::" plot(1:10,1:10) mtext(bquote(.(tag) ~ Delta * .(suffix)), s

Re: [R] Incomplete x-axis in barplots

2008-08-07 Thread Jim Lemon
On Wed, 2008-08-06 at 16:42 +0100, Hanna Granroth wrote: > Hi everyone, > > This is a graphics question, concerning presentation rather than > actually producing figures. > After much fiddling I've managed to create bar plots showing error > bars. I've put in an x-axis, which goes along all the ba

Re: [R] Trying to run simple survival program in R but does not work

2008-08-07 Thread bartjoosen
When I run your code, I have no problem at all, could you please give us some more info about what system you are running on, OS, packages loaded, . Bart Trev101 wrote: > > Hey, > > I am just starting to learn R now and I typed in this simple survival > program: > >library(survival

Re: [R] Attempting to make a custom color spectrum to use in heatmap.2

2008-08-07 Thread Jim Lemon
On Wed, 2008-08-06 at 16:57 -0700, Daniel Bernstein wrote: > Hello there! I'd just like to say in advance, "Thank you," for any help > and/or advice. > > My problem is as follows: > > I have a dataset that is made up of percentages. I've assigned my > "error" percentages a value of '-100', my "

Re: [R] Trying to run simple survival program in R but does not work

2008-08-07 Thread bartjoosen
Survival depends on splines, so you should install the splines library, and then everything should be fine. Bart Trevor Hansen wrote: > > Oh wait it gives me another error saying that: > Loading required package: splines > > I cant find the package called splines in the list is that an impor

[R] Impulse response analysis within package vars

2008-08-07 Thread Samuel Bächler
Hi Everyone > var.2c <- VAR(Canada,p=2,type="const") > irf.rw.e <- irf(var.2c,impulse="rw",response=c("e")) ...makes *vars* to compute the orthogonalised impulse responses to a *unit* change in variable rw. Now, if I want to compute the the orthogonalised impulse responses to a *0.25* change in

Re: [R] Trying to run simple survival program in R but does not work

2008-08-07 Thread Prof Brian Ripley
On Thu, 7 Aug 2008, Trev101 wrote: Hey, I am just starting to learn R now and I typed in this simple survival program: library(survival) t <- c(10,13,18,19,23,30,36,38,54,56,59,75,93,97,104,107,107,107) c <- c(1,0,0,1,0,1,1,0,0,0,1,1,1,1,0,1,0,0) data <- Surv(t,c) km <- survfit(data

Re: [R] Trying to run simple survival program in R but does not work

2008-08-07 Thread Prof Brian Ripley
survival and splines come as part of R: you do not need to install either. On Thu, 7 Aug 2008, bartjoosen wrote: Survival depends on splines, so you should install the splines library, and then everything should be fine. Bart Trevor Hansen wrote: Oh wait it gives me another error saying t

[R] Problems using hetcor (polycor)

2008-08-07 Thread Birgitle
Sorry if this post should be long but I tried to give you a piece of my data to reproduce my error message using hetcor: Fehler in result$rho : $ operator is invalid for atomic vectors Zusätzlich: Warning messages: 1: In polychor(x, y, ML = ML, std.err = std.err) : 1 row with zero marginal remo

Re: [R] Index alternative to nasty FOR loop?

2008-08-07 Thread Dan Davison
On Wed, Aug 06, 2008 at 05:42:21PM +, zack holden wrote: > > Dear R wizards, > > I have a folder containing 1000 files. For each file, I need to extract the > first row of each file, paste it to a new file, then write out that file. > Then I need to repeat this operation for each additiona

[R] Obtaining the first /or last record of a subject in a longitudinal study

2008-08-07 Thread Luwis Tapiwa Diya
Dear R users, I was wondering if anyone knows how to obtain(subset) the first and/or the last record of a subject in a longitudinal setup. Normally in SAS one uses first.variable1 and last.variable1. So my question is that is there an R way of doing this. Regards, -- Luwis Diya, Phd student (B

Re: [R] Trying to run simple survival program in R but does not work

2008-08-07 Thread Tomas Lanczos
Trev101 wrote: Hey, I am just starting to learn R now and I typed in this simple survival program: library(survival) t <- c(10,13,18,19,23,30,36,38,54,56,59,75,93,97,104,107,107,107) c <- c(1,0,0,1,0,1,1,0,0,0,1,1,1,1,0,1,0,0) data <- Surv(t,c) km <- survfit(data) su

Re: [R] Union of columns of two matrices

2008-08-07 Thread Dan Davison
On Wed, Aug 06, 2008 at 06:32:43PM -0400, Giuseppe Paleologo wrote: > I was posed the following problem/teaser: > > given two matrices, come up with an "elegant" (=fast & short) function that > returns a matrix with all and only the non-duplicated columns of both > matrices; the column order does

[R] recursive root finding

2008-08-07 Thread baptiste auguie
Dear list, I've had this problem for a while and I'm looking for a more general and robust technique than I've been able to imagine myself. I need to find N (typically N= 3 to 5) zeros in a function that is not a polynomial in a specified interval. The code below illustrates this, by cre

Re: [R] Obtaining the first /or last record of a subject in a longitudinal study

2008-08-07 Thread Chuck Cleland
On 8/7/2008 6:21 AM, Luwis Tapiwa Diya wrote: Dear R users, I was wondering if anyone knows how to obtain(subset) the first and/or the last record of a subject in a longitudinal setup. Normally in SAS one uses first.variable1 and last.variable1. So my question is that is there an R way of doing

Re: [R] Problems using hetcor (polycor)

2008-08-07 Thread Mark Difford
Hi Birgitle, You need to get this right if someone is going to spend their time helping you. Your code doesn't work: You have specified more columns in colClasses than you have in the provided data set. > TestPart<-read.table("TestPart.txt", header=TRUE,row.names=1, > na.strings="NA" ,colClasses

[R] multiple tapply

2008-08-07 Thread glaporta
Hi folk, I tried this and it works just perfectly tapply(iris[,1],iris[5],mean) but, how to obtain a single table from multiple variables? In tapply x is an atomic object so this code doesn't work tapply(iris[,1:4],iris[5],mean) Thanx and great summer holidays Gianandrea -- View this message

Re: [R] using acf() for multiple columns

2008-08-07 Thread Henrique Dallazuanna
Try this: A <- matrix(rnorm(1500),nrow=500) do.call(cbind, lapply(apply(A, 2, acf, lag.max = 10), "[[", "acf")) On Thu, Aug 7, 2008 at 5:11 AM, rcoder <[EMAIL PROTECTED]> wrote: > > Hi Gary, > > Thanks for your reply. This works fine. Is there any way to send the ACF > data to a matrix, so I coul

[R] problem running R

2008-08-07 Thread Mahesh Pal
Dear all, I am new to R and very basic idea about it. While running some codes i am getting following error: "Error in m[indexMax] : invalid subscript type 'list'" I am not sure about this error. Any way to correct it. mahesh [[alternative HTML version deleted]] ___

[R] Create new dataframes with dames from dataset...

2008-08-07 Thread Lars Modig
Hi I'm wondering if you could save new data frames with in a loop using the names within the data frame... I.e. If you have a data frame as below Product TypeTest A One 67 A Two 55 B One 42 A One 55 I would like to generate new dataframes as

[R] re order vector in order given by another vector

2008-08-07 Thread jimineep
So imagine I have a vector: zz = c("a","c","d","b") and another vector: xx = c("d","c","a","b") I need to get xx in the same order as zz. I am sure this is very simple but I can't figure it out from the help pages for order or sort. Perhaps I'm not trying hard enough but its been bugging me fo

Re: [R] Problems using hetcor (polycor)

2008-08-07 Thread Birgitle
Thanks Mark and I am sorry that I forgot to adapt the Classe-vector. This should work now library(methods) setClass("of") setAs("character", "of", function(from) as.ordered(from)) Classe72<-cclasses <- c(rep("factor", 55), rep("numeric",6), rep ("factor", 12)) TestPart<-read.table("TestPart.t

Re: [R] Trying to run simple survival program in R but does not work

2008-08-07 Thread Trevor Hansen
Hey, Thanx I did that and it works it gives me the output I require but it still does not like that call option I guess its not that important since I got the output I required :-D. Thanx for all the help I really appreciate it :-D -- View this message in context: http://www.nabble.com/Trying-t

Re: [R] multiple tapply

2008-08-07 Thread Henrique Dallazuanna
Try this: aggregate(iris[,1:4], list(Species = iris[,5]), mean) On Thu, Aug 7, 2008 at 8:01 AM, glaporta <[EMAIL PROTECTED]> wrote: > > Hi folk, > I tried this and it works just perfectly > tapply(iris[,1],iris[5],mean) > but, how to obtain a single table from multiple variables? > In tapply x is

Re: [R] Trying to run simple survival program in R but does not work

2008-08-07 Thread Trev101
Very Strange have no idea why this is happening :-( I am running a AMD Athlon 64 3500+ with 1 GB RAM and Running microsoft Windows XP service pack 2. I only installed the main program of R being R-2.7.1-win32 and then I installed tinn-R. I then opened R and tinn-R and then from the RGui I went to

Re: [R] Trying to run simple survival program in R but does not work

2008-08-07 Thread Trev101
Oh wait it gives me another error saying that: Loading required package: splines I cant find the package called splines in the list is that an important package? -- View this message in context: http://www.nabble.com/Trying-to-run-simple-survival-program-in-R-but-does-not-work-tp18865807p18866

Re: [R] Create new dataframes with dames from dataset...

2008-08-07 Thread Henrique Dallazuanna
You can do this: split(x, list(x$Product, x$Type), drop = TRUE) On Thu, Aug 7, 2008 at 8:21 AM, Lars Modig <[EMAIL PROTECTED]> wrote: > Hi > > I'm wondering if you could save new data frames with in a loop using the > names within the data frame... I.e. If you have a data frame as below > > Produ

Re: [R] re order vector in order given by another vector

2008-08-07 Thread Henrique Dallazuanna
Try this: xx[match(zz, xx)] On Thu, Aug 7, 2008 at 8:20 AM, jimineep <[EMAIL PROTECTED]> wrote: > > So imagine I have a vector: > > zz = c("a","c","d","b") > > and another vector: > > xx = c("d","c","a","b") > > I need to get xx in the same order as zz. I am sure this is very simple but > I can't

Re: [R] Problems using hetcor (polycor)

2008-08-07 Thread Birgitle
I am so sorry there was a little mistake in the code again. Right code now: library(methods) setClass("of") setAs("character", "of", function(from) as.ordered(from)) Classe72<-cclasses <- c(rep("factor", 55), rep("numeric",6), rep ("of", 12)) TestPart<-read.table("TestPart.txt", header=TRUE,r

Re: [R] multiple tapply

2008-08-07 Thread Kenn Konstabel
one way would be: mapply(tapply, iris[,1:4], MoreArgs=list(iris[,5], mean)) K On Thu, Aug 7, 2008 at 2:01 PM, glaporta <[EMAIL PROTECTED]> wrote: > > Hi folk, > I tried this and it works just perfectly > tapply(iris[,1],iris[5],mean) > but, how to obtain a single table from multiple variables? >

Re: [R] multiple tapply

2008-08-07 Thread Chuck Cleland
On 8/7/2008 7:01 AM, glaporta wrote: Hi folk, I tried this and it works just perfectly tapply(iris[,1],iris[5],mean) but, how to obtain a single table from multiple variables? In tapply x is an atomic object so this code doesn't work tapply(iris[,1:4],iris[5],mean) Thanx and great summer holi

Re: [R] problem running R

2008-08-07 Thread Samuel Bächler
Dear all, I am new to R and very basic idea about it. While running some codes i am getting following error: "Error in m[indexMax] : invalid subscript type 'list'" What code did you enter? I am not sure about this error. Any way to correct it. ___

Re: [R] problem running R

2008-08-07 Thread stephen sefick
supply code and then we will probbly be able to figure it out On Thu, Aug 7, 2008 at 6:12 AM, Mahesh Pal <[EMAIL PROTECTED]> wrote: > Dear all, > I am new to R and very basic idea about it. > While running some codes i am getting following error: > > "Error in m[indexMax] : invalid subscript type

Re: [R] multiple tapply

2008-08-07 Thread Chuck Cleland
On 8/7/2008 7:01 AM, glaporta wrote: Hi folk, I tried this and it works just perfectly tapply(iris[,1],iris[5],mean) but, how to obtain a single table from multiple variables? In tapply x is an atomic object so this code doesn't work tapply(iris[,1:4],iris[5],mean) Thanx and great summer holi

Re: [R] problem running R

2008-08-07 Thread Duncan Murdoch
On 07/08/2008 6:12 AM, Mahesh Pal wrote: Dear all, I am new to R and very basic idea about it. While running some codes i am getting following error: "Error in m[indexMax] : invalid subscript type 'list'" I am not sure about this error. Any way to correct it. Sure, don't do that. If

Re: [R] Impulse response analysis within package vars

2008-08-07 Thread Pfaff, Bernhard Dr.
hello Sam, just rescale the result. Please note that *unit change* refers to the error term. By the same token you can also rescale the impulse responses by making use of the standard deviation of the residuals. Best, Bernhard > >Hi Everyone > > > var.2c <- VAR(Canada,p=2,type="const") > > irf

Re: [R] Matrix multiplication

2008-08-07 Thread Zhang Yanwei - Princeton-MRAm
Thanks. This is exactly what I want. Sincerely, Yanwei Zhang Department of Actuarial Research and Modeling Munich Re America Tel: 609-275-2176 Email: [EMAIL PROTECTED] -Original Message- From: Ling, Gary (Electronic Trading) [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2008 5:42

Re: [R] Diagnosing Documentation Issues

2008-08-07 Thread stephen sefick
worked just fine thanks- I have been let's say frustrated a little with this package building exercise, but I think I've got it for now ... thanks to everybody that helped Stephen On Wed, Aug 6, 2008 at 8:17 PM, Rolf Turner <[EMAIL PROTECTED]> wrote: > > On 7/08/2008, at 10:58 AM, stephen sefick

Re: [R] Problems using hetcor (polycor)

2008-08-07 Thread John Fox
Dear Birgit, Without looking at your data, it seems clear from the warning messages that when all of the observations with missing data are excluded, at least one of the variables becomes invariant. You can simply check this for yourself: Filter out the missing data, TestPart <- na.omit(TestPar

Re: [R] using acf() for multiple columns

2008-08-07 Thread Ling, Gary (Electronic Trading)
This should do. sapply(split(A,col(A)), function(ts) acf(ts,plot=F)$acf) -gary -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of rcoder Sent: Thursday, August 07, 2008 4:11 AM To: r-help@r-project.org Subject: Re: [R] using acf() for multiple columns Hi

Re: [R] Problems using hetcor (polycor)

2008-08-07 Thread Mark Difford
Hi Birgitle, It seems to be failing on those columns that have just a single "entry" (i.e = 1, with the rest as 0; having just 1, an , and then 0s gets you through). And there are other reasons for failure (in the call to get a positive definite matrix). The main problem lies in the calculation

Re: [R] Trying to run simple survival program in R but does not work

2008-08-07 Thread Duncan Murdoch
On 07/08/2008 3:56 AM, Trev101 wrote: Hey, I am just starting to learn R now and I typed in this simple survival program: library(survival) t <- c(10,13,18,19,23,30,36,38,54,56,59,75,93,97,104,107,107,107) c <- c(1,0,0,1,0,1,1,0,0,0,1,1,1,1,0,1,0,0) data <- Surv(t,c) km <- sur

[R] List of "occurrence" matrices

2008-08-07 Thread Lauri Nikkinen
R users, I don't know if I can make myself clear but I'll give it a try. I have a data.frame like this x <- "var1,var2,var3,var4 a,b,b,a b,b,c,b c,a,a,a a,b,c,c b,a,c,a c,c,b,b a,c,a,b b,c,a,c c,a,b,c" DF <- read.table(textConnection(x), header=T, sep=",") DF and I would like to sum all the com

[R] Downloading Yahoo data

2008-08-07 Thread Shubha Vishwanath Karanth
Hi R, I am trying to download the data from R. I give the below command. > library(fImport) > yahooSeries("IBM") trying URL 'http://chart.yahoo.com/table.csv?s=IBM&a=7&b=08&c=2007&d=7&e=07&f=2008&; g=d&x=.csv' Error in download.file(url = url, destfile = file, method = method) : cann

[R] maximization under constraits

2008-08-07 Thread Daniela Garavaglia
I'm an Italian student looking for help. How can I maximize this function? neg_loglik<-function(param){ a<-param[1] b <-param[2] -(log(pr)-(a*s2)-(b*s)+n*log(2*a)-n*log(1-(b/sqrt(a))*exp((b^2)/(4*a))*(sqrt (pi))*(1-pnorm(b/(2*sqrt(a)), mean=0, sd=1))*1)) } Con > pr

[R] limits/thresholds for arrayWeights in the limma package

2008-08-07 Thread Radek Blatny
Is there any limit ratio of between-array weight values, which one can get using the arrayWeights() function in the limma package ? For instance, if one array has the weight value - let's say - 4 and the rest between 0.5 and 2, shall I

Re: [R] Problems using hetcor (polycor)

2008-08-07 Thread Mark Difford
Hi Birgitle, >> I am so sorry there was a little mistake in the code again. This arrived _after_ I sent in my "fix" (really just an exploration of what the problem might be). Perhaps you need to wrestle a bit more with the art of coding ...;). I don't think it will change the work-around. You wo

Re: [R] Problems using hetcor (polycor)

2008-08-07 Thread Birgitle
Many Thanks Mark for your answer. It seems than, that it is not possible to use all variables without somehow imputing missing values. But I will try which variables I can finally use. Many thanks again. B. Mark Difford wrote: > > Hi Birgitle, > > It seems to be failing on those columns th

[R] colouring a tree

2008-08-07 Thread Monna Nygård
Hi all. I would be very pleased if someone could help me, as I do not seem to get the different branches of my tree painted in different colours. The closest I get is colouring the names of my samples(=names of the branches). Here is the code. data <- read.table(file = "S://SEDIM//TRFLP//

Re: [R] Obtaining the first /or last record of a subject in alongitudinal study

2008-08-07 Thread Daniel Malter
Had the same problem recently. I used a loop. Assume your data frame is called "data" and your units of observation are "Subject". first.round.index=NULL final.round.index=NULL for(i in unique(Subject)){ first.round.index[i]=min(which(Subject==i)) final.round.index[i]=max(which(Subject==i

Re: [R] multiple tapply

2008-08-07 Thread Gabor Grothendieck
Here are three ways: # 1 aggregate(iris[-5], iris[5], mean) # 2 library(doBy) summaryBy(.~Species, iris, keep = TRUE) # 3 library(sqldf) sqldf("select Species, avg(Sepal_Length) Sepal_Length, avg(Sepal_Width) Sepal_Width, avg(Petal_Length) Petal_Length, avg(Petal_Width) Petal_Width f

[R] Usingloglikelihood to Infer which distributions fits best to data

2008-08-07 Thread Gundala Viswanath
Hi, Below are the average loglikelihood of mixture model over 5 components (k=5). The loglikelihood are learnt using EM over three kinds of distribution: Lognormal, Gamma, and Normal. Since the average loglikelihood for Lognormal is the highest over Gamma and Normal. Is it safe to infer that Log

Re: [R] Problems using hetcor (polycor)

2008-08-07 Thread Mark Difford
Hi Birgitle, >> It seems than, that it is not possible to use all variables without >> somehow >> imputing missing values. It depends on what you are after. You can use the full data set if you set std.err=F and pd=F. Then exclude the columns that cause it to falter and redo with SEs turned on.

Re: [R] Problems using hetcor (polycor)

2008-08-07 Thread Birgitle
Thanks for all your help and the time you spent. It is now my turn to find my way. Maybe it is enough to have the Correlations. Final remark: Both of your examples work and in the first case are only a few standard errors missing. Unfortunately its not my whole dataset Mark Difford wrote: > >

Re: [R] Attempting to make a custom color spectrum to use inheatmap.2

2008-08-07 Thread Warnes, Gregory R.
You can assemble a list of colors manually to do what you want. Something like: col = c("grey", "black", rainbow(50) ) ought to do the trick. -G > Hello there! I'd just like to say in advance, "Thank you," for any help and/or > advice. > > My problem is as follows: > > I have a dataset that i

[R] Covariance matrix

2008-08-07 Thread Zhang Yanwei - Princeton-MRAm
Hi all, Assume I have a random vector with four variables, i.e. A=(a,b,c,d). I am able to get the covariance matrix of vector A, but how can I get the covariance matrix of vector B=(a,c,b,d) by manipulating the corresponding covariance matrix of A? Thanks. Sincerely, Yanwei Zhang Department

[R] Switch two rows in a matrix

2008-08-07 Thread Zhang Yanwei - Princeton-MRAm
Hi all, I have a 4 by 4 matrix, and I want to switch row 2 and row 3 first, then switch column 2 and column 3. Is there an easy way to do it? The following is a tedious way to get what I want. But I wonder if there is a way to simplify this. > a=matrix(rnorm(16),4,4) > a [,1]

Re: [R] List of "occurrence" matrices

2008-08-07 Thread Dan Davison
Lauri Nikkinen wrote: > > R users, > > I don't know if I can make myself clear but I'll give it a try. I have > a data.frame like this > > x <- "var1,var2,var3,var4 > a,b,b,a > b,b,c,b > c,a,a,a > a,b,c,c > b,a,c,a > c,c,b,b > a,c,a,b > b,c,a,c > c,a,b,c" > DF <- read.table(textConnection(x),

Re: [R] List of "occurrence" matrices

2008-08-07 Thread Gabor Grothendieck
Tr this: inner <- function(a,b,f) apply(b,2,function(x)apply(a,2,function(y)f(x,y))) lapply(levels(DF[, 1]), function(x) inner(DF, DF, function(a, b) sum(a == x & b == x))) On Thu, Aug 7, 2008 at 9:04 AM, Lauri Nikkinen <[EMAIL PROTECTED]> wrote: > R users, > > I don't know if I can ma

Re: [R] Obtaining the first /or last record of a subject in alongitudinal study

2008-08-07 Thread Frank E Harrell Jr
A very fast way using tapply may be found in section 4.3.8 of http://biostat.mc.vanderbilt.edu/twiki/pub/Main/RS/sintro.pdf Frank Daniel Malter wrote: Had the same problem recently. I used a loop. Assume your data frame is called "data" and your units of observation are "Subject". first.ro

Re: [R] Impulse response analysis within package vars

2008-08-07 Thread Samuel Bächler
Thank you Bernhard, just rescale the result. Please note that *unit change* refers to the error term. By the same token you can also rescale the impulse responses by making use of the standard deviation of the residuals. Best, Bernhard > Hi Everyone > > > var.2c<-VAR(Canada,p=2,type="const

[R] panel.arrows problem in custom panel function

2008-08-07 Thread Gavin Simpson
Dear List, I am writing a custom panel function and xyplot method to plot the results of a procrustes analysis from the vegan package. I am having trouble getting the call to panel.arrows to work as I wish when conditioning. The attached file contains the function definitions for the xyplot metho

Re: [R] Downloading Yahoo data

2008-08-07 Thread Henrique Dallazuanna
You are connecting to the internet trougth a proxy? On Thu, Aug 7, 2008 at 9:40 AM, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > Hi R, > > > > I am trying to download the data from R. I give the below command. > > > >> library(fImport) > >> yahooSeries("IBM") > > trying URL > 'http://cha

Re: [R] List of "occurrence" matrices

2008-08-07 Thread Gabor Grothendieck
That's a very nice solution. Here is a small tweak to get the names all at the same time rather than applying them afterwards: sapply(levels(unlist(DF)), function(x) crossprod(DF == x), simplify = FALSE) or lapply(sapply(levels(unlist(DF)), "==", DF, simplify = FALSE), crossprod) On Thu, Aug 7,

Re: [R] Obtaining the first /or last record of a subject in a longitudinal study

2008-08-07 Thread Gabor Grothendieck
It would have helped to see an example to clarify the input and output to the problem but !duplicated(x) will be TRUE for the first of each set of equal values in x and !duplicated(x, fromLast = TRUE) for the last. See ?duplicated for details. On Thu, Aug 7, 2008 at 6:21 AM, Luwis Tapiwa Diya <[E

Re: [R] Switch two rows in a matrix

2008-08-07 Thread Ling, Gary (Electronic Trading)
A <- matrix(rnorm(16)4,4) o <- c(1,3,2,4) A[o,o] -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Zhang Yanwei - Princeton-MRAm Sent: Thursday, August 07, 2008 10:31 AM To: r-help@r-project.org Subject: [R] Switch two rows in a matrix Hi all, I have a

Re: [R] Switch two rows in a matrix

2008-08-07 Thread Birgitle
sorry here the right thing a<-a[c(1,3,2,4),c(1,3,2,4)] B. Birgitle wrote: > > You could perhaps do it like that > > a<-a[c(1,2,4,3),] > > B. > > > Zhang Yanwei - Princeton-MRAm wrote: >> >> Hi all, >> I have a 4 by 4 matrix, and I want to switch row 2 and row 3 first, >> then switch co

Re: [R] Switch two rows in a matrix

2008-08-07 Thread Samuel Bächler
Hi Zhang Hi all, I have a 4 by 4 matrix, and I want to switch row 2 and row 3 first, then switch column 2 and column 3. Is there an easy way to do it? The following is a tedious way to get what I want. But I wonder if there is a way to simplify this. '> a=matrix(rnorm(16),4,4) '> b=a[c(2,1

Re: [R] Downloading Yahoo data

2008-08-07 Thread Shubha Vishwanath Karanth
Yes Henrique... we are connecting to the internet through a proxy... Thanks, Shubha Shubha Karanth | Amba Research Ph +91 80 3980 8031 | Mob +91 94 4886 4510 Bangalore * Colombo * London * New York * San José * Singapore * www.ambaresearch.com -Original Message- From: Henrique Dallazu

Re: [R] Switch two rows in a matrix

2008-08-07 Thread Birgitle
You could perhaps do it like that a<-a[c(1,2,4,3),] B. Zhang Yanwei - Princeton-MRAm wrote: > > Hi all, > I have a 4 by 4 matrix, and I want to switch row 2 and row 3 first, then > switch column 2 and column 3. Is there an easy way to do it? > The following is a tedious way to get what I wa

Re: [R] Union of columns of two matrices

2008-08-07 Thread Charles C. Berry
On Thu, 7 Aug 2008, Dan Davison wrote: On Wed, Aug 06, 2008 at 06:32:43PM -0400, Giuseppe Paleologo wrote: I was posed the following problem/teaser: given two matrices, come up with an "elegant" (=fast & short) function that returns a matrix with all and only the non-duplicated columns of both

Re: [R] Union of columns of two matrices

2008-08-07 Thread Giuseppe Paleologo
I think we can declare this the global minimum in terms of size. Thanks to all for their contributions. On a personal note, what escaped me was the existence of MARGIN in set-related operations. -g On Thu, Aug 7, 2008 at 11:51 AM, Charles C. Berry <[EMAIL PROTECTED]>wrote: > On Thu, 7 Aug 2008,

Re: [R] Downloading Yahoo data

2008-08-07 Thread Henrique Dallazuanna
Then, start the R with --internet2 argument. On Thu, Aug 7, 2008 at 12:08 PM, Shubha Vishwanath Karanth <[EMAIL PROTECTED]> wrote: > Yes Henrique... we are connecting to the internet through a proxy... > > Thanks, Shubha > Shubha Karanth | Amba Research > Ph +91 80 3980 8031 | Mob +91 94 4886 4510

[R] Creating an array of lists

2008-08-07 Thread Gang Chen
Hi, I want to store some number of outputs from running a bunch of analyses such as lm() into an array. I know how to do this with a one-dimensional array (vector) by creating myArray <- vector(mode='list', length=10) and storing each lm() result into a component of myArray. My question is, how

Re: [R] Downloading Yahoo data

2008-08-07 Thread Yohan Chalabi
"SVK" == "Shubha Vishwanath Karanth" <[EMAIL PROTECTED]> on Thu, 7 Aug 2008 20:38:12 +0530 SVK> Yes Henrique... we are connecting to the internet through a proxy... This is probably not a problem of connection. Make sure that you have the latest version of fImport installed. hop

[R] Append to a vector?

2008-08-07 Thread rkevinburton
This is probably an extemly easy operation I just could not find out how to do it. I simple want to append to a vector. a <- c(1,2,3,4) a <- union(a, c(5)) I want to append the value 5 or even another vector. Or is the a "better" way? Kevin __ R-he

Re: [R] Append to a vector?

2008-08-07 Thread Henrique Dallazuanna
Try this: append(a, 5) see ?append for more detail On Thu, Aug 7, 2008 at 1:38 PM, <[EMAIL PROTECTED]> wrote: > This is probably an extemly easy operation I just could not find out how to > do it. > > I simple want to append to a vector. > > a <- c(1,2,3,4) > a <- union(a, c(5)) > > I want to

[R] Where is the archive? Calling a function within a function.

2008-08-07 Thread rkevinburton
I seem to remember this topic coming up before so I decided to look at the archive and realized that I didn't know where it was. Is there a searchable archive for this list? Thank you. My question is calling a function from within a function. I have smerge <- function(d1,d2) { temp <- merge

Re: [R] Where is the archive? Calling a function within a function.

2008-08-07 Thread Mark Difford
Hi Kevin, >> Where is the archive? Start with this: ?RSiteSearch HTH, Mark. rkevinburton wrote: > > I seem to remember this topic coming up before so I decided to look at the > archive and realized that I didn't know where it was. Is there a > searchable archive for this list? Thank you. >

Re: [R] Creating an array of lists

2008-08-07 Thread Dan Davison
Gang Chen-4 wrote: > > Hi, > > I want to store some number of outputs from running a bunch of > analyses such as lm() into an array. I know how to do this with a > one-dimensional array (vector) by creating > > myArray <- vector(mode='list', length=10) > Note that in R terminology, 'myArray'

Re: [R] error in installing R packages

2008-08-07 Thread Eva Winter
Thanks for the tips. The R installation is pre-existing, I will check to see what's happening. Regards, -e -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 06, 2008 10:23 PM To: Eva Winter Cc: [EMAIL PROTECTED] Subject: Re: [R] error in insta

[R] LAPACK.dll and Excel with R 2.7.0

2008-08-07 Thread Chen, Zehao
Hello, I was building a R addin for Excel. I was able to build R.dll, export to Rdll.lib and wrap it in a Excel addin (.xll) format. Most basic functions work fine within Excel except functions that use LAPACK, e.g. eigen, solve etc. But if you use solve(..., LINPACK = T). That's fine. So apparen

Re: [R] LAPACK.dll and Excel with R 2.7.0

2008-08-07 Thread Prof Brian Ripley
On Thu, 7 Aug 2008, Chen, Zehao wrote: Hello, I was building a R addin for Excel. I was able to build R.dll, export to Rdll.lib and wrap it in a Excel addin (.xll) format. Most basic functions work fine within Excel except functions that use LAPACK, e.g. eigen, solve etc. But if you use solve(.

Re: [R] Determining model parameters

2008-08-07 Thread rkevinburton
I am trying to fit a set of data to a Weibull distribution. Because the implementation requires that I put the data in the range of 0 < x < 1 I have a "normailze" function: normalize <- function(x) { y <- (x-min(x)) / (max(x) - min(x)) y = y + 0.5 * (y == 0) -0.5 * (y == 1) retur

Re: [R] LAPACK.dll and Excel with R 2.7.0

2008-08-07 Thread Chen, Zehao
Thanks Prof. Ripley for your prompt reply. The interesting thing is when you compile the wrappers into stand alone console programs, it actually runs well. I traced the calling chain: it locates both R_HOME\bin\Rlapack.dll and R_HOME\modules\lapack.dll. With the same PATH (=C:\R\bin) and R_HOME (

[R] lattice: add vertical lines in xyplot

2008-08-07 Thread baptiste auguie
Hi list, This is a very basic question about lattice: I wish to add some vertical lines in each panel of a xyplot as demonstrated in this example: library(lattice) xx <- seq(1, 10, length=100) x <- rep(xx, 4) y <- c(cos(xx), sin(xx), xx, xx^2/10) fact <- factor(rep(c("cos", "sin", "id", "

Re: [R] lattice: add vertical lines in xyplot

2008-08-07 Thread Deepayan Sarkar
On Thu, Aug 7, 2008 at 11:54 AM, baptiste auguie <[EMAIL PROTECTED]> wrote: > Hi list, > > This is a very basic question about lattice: I wish to add some vertical > lines in each panel of a xyplot as demonstrated in this example: > >> library(lattice) >> >> xx <- seq(1, 10, length=100) >> x <- rep

[R] long run time for loop operation & matrix fill

2008-08-07 Thread rcoder
Hi everyone, I'm running some code containing an outer and inner loop, to fill cells in a 2500x1500 results matrix. I left my program running overnight, and it was still running when I checked 17 hours later. I have tested the operation on a smaller matrix and it executes fine, so I believe there

Re: [R] Creating an array of lists

2008-08-07 Thread Patrick Burns
myListArray <- array(list(NULL), c(3,2)) myListArray[[1,2]] <- list(letters, 1:4) Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and "A Guide for the Unwilling S User") Gang Chen wrote: Hi, I want to store some number of outputs from running a b

Re: [R] lattice: add vertical lines in xyplot

2008-08-07 Thread hadley wickham
> Alternatively, I tried in ggplot but here again, I get an error: > >> p <- ggplot(my.df, aes(x, y)) + >>geom_path(aes(colour = fact)) + >>facet_grid(fact2 ~ fact) + >> geom_vline(intercept = my.lines) # how do I select the >> relevant one ? If you want a d

Re: [R] Attempting to make a custom color spectrum to use inheatmap.2

2008-08-07 Thread Daniel Bernstein
Thanks everyone for the great responses! The col = c("grey", "black", rainbow(50) ) idea was the easiest for me to figure out how to implement, but the others look like the can do what I want as well. Thanks so much for the help! Regards, Daniel Warnes, Gregory R. wrote: You can assemble

[R] how to save an R object selectively?

2008-08-07 Thread carol white
Hi, How to save an R object for example a matrix or vector and not all objects created in a session (which is usually performed by save.image or q("yes"))? Best, Carol [[alternative HTML version deleted]] __ R-help@r-project.org mail

Re: [R] lattice: add vertical lines in xyplot

2008-08-07 Thread baptiste auguie
Many thanks Deepayan, it works nicely (i always need simple examples to understand the help page for some reason). Also, Hadley, I can't get this example from ggplot2's website to work: # Slopes and intercepts as data p <- ggplot(mtcars, aes(x = wt, y=mpg), . ~ cyl) + geom_point() df

Re: [R] error in installing R packages

2008-08-07 Thread Bernardo Rangel Tura
Em Qua, 2008-08-06 às 15:51 -0700, Eva Winter escreveu: > Hello, > > > > I am trying to install R packages under linux, some of the packages can > not be installed and I got the following errors, could anybody give me > suggestion on where the problem is and how to fix them? Thanks -e > (...)

Re: [R] how to save an R object selectively?

2008-08-07 Thread Henrique Dallazuanna
See ?save On Thu, Aug 7, 2008 at 5:39 PM, carol white <[EMAIL PROTECTED]> wrote: > Hi, > How to save an R object for example a matrix or vector and not all objects > created in a session (which is usually performed by save.image or q("yes"))? > > Best, > > Carol > > > > >[[alternative HTM

Re: [R] error in installing R packages

2008-08-07 Thread Eva Winter
Hi, Thanks for the help. The problem is fixed. It was because of the pre-existing installation is binary. After installing the corresponding devel version, I am able to load the packages in the proper place Best, -e -Original Message- From: Bernardo Rangel Tura [mailto:[EMAIL PROTECT

Re: [R] panel.arrows problem in custom panel function

2008-08-07 Thread Deepayan Sarkar
On Thu, Aug 7, 2008 at 7:55 AM, Gavin Simpson <[EMAIL PROTECTED]> wrote: > Dear List, > > I am writing a custom panel function and xyplot method to plot the > results of a procrustes analysis from the vegan package. > > I am having trouble getting the call to panel.arrows to work as I wish > when c

  1   2   >