Re: [R] multiple tapply

2008-08-07 Thread glaporta
R: great software and wonderful community! Thanx guys, Gianandrea -- View this message in context: http://www.nabble.com/multiple-tapply-tp18868063p18886279.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing

[R] gridBase and new.page() / grid.newpage()

2008-08-07 Thread Peter Cowan
Hello all, I'm trying to write a function using the gridBase package. I'd like to push several base subplots to a larger plot constructed with grid. However, I'm having trouble getting consistent results when running the function when the plotting window (quartz) is closed, when it is left open a

Re: [R] grid layout scaling viewport width based solely on height

2008-08-07 Thread Peter Cowan
Paul, On Wed, Aug 6, 2008 at 1:40 PM, Paul Murrell <[EMAIL PROTECTED]> wrote: >> I'm trying to write a function that produces a main plotting region >> with several square plots along the right side. Ideally the size of >> right side plots will scale only with the height of the entire plot, >> ye

Re: [R] Vista problem -- can't type commands at prompt

2008-08-07 Thread Gabor Grothendieck
Try using Rgui.exe (or Rgui.bat if you are using batchfiles) rather than R. On Thu, Aug 7, 2008 at 9:33 PM, Tim Calkins <[EMAIL PROTECTED]> wrote: > Hi All - > > I recently moved to Vista and reinstalled R. I am able to run R as I > typically do (R.exe from the command prompt), and it can work we

[R] Vista problem -- can't type commands at prompt

2008-08-07 Thread Tim Calkins
Hi All - I recently moved to Vista and reinstalled R. I am able to run R as I typically do (R.exe from the command prompt), and it can work well. However, if I switch windows to, say, firefox or excel or anything else, when I return to the R prompt it no longer works. I am able to use the up and

[R] Fwd: histogram - freq=FALSE - density computation

2008-08-07 Thread Jörg Groß
If the bars are chosen at unit spacings it will sum to one. How can I do that? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provid

Re: [R] histogram - freq=FALSE - density computation

2008-08-07 Thread Duncan Murdoch
On 07/08/2008 6:55 PM, Jörg Groß wrote: Hi, I don't understand what hist(x, freq=FALSE) does. At first I thought it would be just the relative frequencies instead of the absolute frequencies, by just computing "frequencies / n" in every category. But with a small dataset the y-values (de

[R] histogram - freq=FALSE - density computation

2008-08-07 Thread Jörg Groß
Hi, I don't understand what hist(x, freq=FALSE) does. At first I thought it would be just the relative frequencies instead of the absolute frequencies, by just computing "frequencies / n" in every category. But with a small dataset the y-values (densities) don't sum to one. Is there a wa

Re: [R] Covariance matrix

2008-08-07 Thread Moshe Olshansky
Just interchange rows 2 and 3 and then columns 2 and 3 of the original covariance matrix. --- On Fri, 8/8/08, Zhang Yanwei - Princeton-MRAm <[EMAIL PROTECTED]> wrote: > From: Zhang Yanwei - Princeton-MRAm <[EMAIL PROTECTED]> > Subject: [R] Covariance matrix > To: "r-help@r-project.org" > Recei

Re: [R] help with longitudinal data plot

2008-08-07 Thread Bert Gunter
try xyplot() in lattice Something like: xyplot(score ~age, group = subject,data = your frame, type= "b") -- Bert Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Robert Terwilliger Sent: Thursday, August 07, 2008 3:02 PM To: r-help@r-project.org

Re: [R] Creating an array of lists

2008-08-07 Thread Gang Chen
Yes, both array of lists and list of lists work well as desired. Thanks a lot! Gang On Thu, Aug 7, 2008 at 4:05 PM, Patrick Burns <[EMAIL PROTECTED]> wrote: > myListArray <- array(list(NULL), c(3,2)) > myListArray[[1,2]] <- list(letters, 1:4) > > Patrick Burns > [EMAIL PROTECTED] > +44 (0)20 8525

[R] help with longitudinal data plot

2008-08-07 Thread Robert Terwilliger
Dear R Help, I am attempting to make a plot of longitudinal data, a sample data frame of which is shown below. I'd like to show all of the subjects in the same plot, with a set of connecting line segments for each subject. 'age' would be the x-axis and 'score' would be the y-axis. subject ag

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

2008-08-07 Thread Bert Gunter
outer() trades off space for speed. It *does* vectorize calculations (= perform the loops in the underlying C code). The apply() family of functions (eapply,mapply and rapply are other base R versions that you missed; there are others in packages) are basically just efficiently written looping fun

[R] 3d kriging et al

2008-08-07 Thread Matthew.Findley
R Users: ...been working with the sp and gstat packages for the past couple of days in an effort to analyze a set of ~ 200 soil samples collected from various eastings, northings, and depths and containing a wide range of measured hydrocarbon concentrations. Thus far, I've managed to import th

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

2008-08-07 Thread Roland Rau
Hi rcoder, rcoder wrote: 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 execut

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

2008-08-07 Thread Rolf Turner
On 8/08/2008, at 8:39 AM, carol white 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"))? Two approaches: (1) Clean up your workspace so that it contains only the objects you

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

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] 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 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] 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

[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] 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

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] 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

[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] 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] 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] 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 (

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 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(.

[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] 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

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] 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. >

[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] 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] 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] 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] 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 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

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] 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] 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] 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 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] 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 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] 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] 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] 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

[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] 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

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] 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] 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),

[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]

[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

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

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] 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.

[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] 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

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

[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] 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

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

[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

[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] 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] 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

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

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] 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 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] 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] 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] 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] 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] 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 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] 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] 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] 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] 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] 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] 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] 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] 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] 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 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] 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

[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

[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] 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] 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

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

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

[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

  1   2   >