Re: [R] turning labels into a vector

2005-05-16 Thread Simon Blomberg
Try WBS.labs - as.vector(WBS) WBS.labs[1] substr(WBS.labs[1],1,1) etc.. Cheers, Simon. Hello 1/ 'priors' is a table looking like: W123 T678 S789 23 42 11 12 35 9 etc 2/ WBS - labels(priors) gives me a result of class list and length 1 looking like: W123 T678

Re: [R] turning labels into a vector

2005-05-16 Thread Simon Blomberg
Umm. Again... Try WBS.labs - as.vector(WBS[[1]]) WBS.labs[1] substr(WBS.labs[1],1,1) etc.. Cheers, Simon. Hello 1/ 'priors' is a table looking like: W123 T678 S789 23 42 11 12 35 9 etc 2/ WBS - labels(priors) gives me a result of class list and length 1

Re: [R] row.names need reordering

2005-05-16 Thread Prof Brian Ripley
On Mon, 16 May 2005, Anders Schwartz Corr wrote: The row.names in my matrix seem to be out of order. I don't remember putting row.names in in the first place, I don't see what use they are, and they are out of order (perhaps because I sorted them at one point when the data was in data.frame

[R] branch cuts of atan()

2005-05-16 Thread Robin Hankin
Hi the following gave me a shock: atan(2) [1] 1.107149 atan(2+0i) [1] -0.4636476+0i or, perhaps more of a gotcha: atan(1.0001+0i) [1] -0.7853482+0i atan(0.+0i) [1] 0.7853482+0i evidently atan()'s branch cuts aren't where I thought they were. Where do I look for documentation on this?

Re: [R] plotting gam curve against predictors

2005-05-16 Thread Gavin Simpson
Suresh Krishna wrote: Sonya Ku wrote: Hi I am just beginning to learn R and have fitted several GAM to my species presense/absence data. I have used plot(x,y) using fitted.values as a y variable against predictors. However, it is hard to see general relationships where there is wide spread in

[R] graphic

2005-05-16 Thread Faouzi LYAZRHI
Hi, poids taillefumeursexesportetat 85184ouihomme1malade 65175ouihomme1malade 74180ouihomme2gueri 79175ouihomme2malade 71165nonhomme3gueri 80185nonhomme3gueri 75

Re: [R] Mental Block with PCA of multivariate time series!

2005-05-16 Thread Gavin Simpson
Laura Quinn wrote: Please could someone point me in the right direction as I appear to be having a total mental block with fairly basic PCA problem! I have a large dataframe where rows represent independent observations and columns are variables. I am wanting to perform PCA sequentially on blocks

Re: [R] branch cuts of atan()

2005-05-16 Thread Prof Brian Ripley
On Mon, 16 May 2005, Robin Hankin wrote: Hi the following gave me a shock: atan(2) [1] 1.107149 atan(2+0i) [1] -0.4636476+0i or, perhaps more of a gotcha: atan(1.0001+0i) [1] -0.7853482+0i atan(0.+0i) [1] 0.7853482+0i evidently atan()'s branch cuts aren't where I thought they were. Where do

Re: [R] Mental Block with PCA of multivariate time series!

2005-05-16 Thread Laura Quinn
Sorry, I don't think I made myself clear enough with my initial query! I am wishing to investigate the temporal evolution of the pca: if we assume that every 50 rows of my data frame is representitive of, for instance, 1 day of data, I am hoping to automate a process whereby a pca is performed on

Re: [R] graphic

2005-05-16 Thread Petr Pikal
Hallo See lattice temp-read.table(clipboard, header=T) temp poids taille fumeur sexe sport etat 1 85184oui homme 1 malade 2 65175oui homme 1 malade 3 74180oui homme 2 gueri 4 79175oui homme 2 malade 5 71165non

[R] Fitting Contour to Data Points

2005-05-16 Thread Laura Quinn
Apologies for the mass mailing today! I am attempting to produce a contour plot for phsical data on a map matrix. I have a small number of data points which each has an (x,y) co-ordinate together with a corresponding value which I would like to cvreate a contour plot for. I have tried the

Re: [R] Mental Block with PCA of multivariate time series!

2005-05-16 Thread Gavin Simpson
Laura Quinn wrote: Sorry, I don't think I made myself clear enough with my initial query! I am wishing to investigate the temporal evolution of the pca: if we assume that every 50 rows of my data frame is representitive of, for instance, 1 day of data, I am hoping to automate a process whereby a

Re: [R] Mental Block with PCA of multivariate time series!

2005-05-16 Thread Pierre BADY
hi all ... again I'm sorry ... my answer doesn't deal with the subject. off-topic ;( Pierre At 10:33 16/05/2005 +0100, Laura Quinn wrote: Sorry, I don't think I made myself clear enough with my initial query! I am wishing to investigate the temporal evolution of the pca: if we assume that

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
Dear David, I would like to use summarize(Hmisc) and print.xtable(xtable) in a single Sweave document, but a conflict with the 'label' function prohibits this at the moment! Would you be able to correct the conflicting code? I will gladly test the new package! I have tried latex(Hmisc) to

Re: [R] Fitting Contour to Data Points

2005-05-16 Thread Gavin Simpson
Laura Quinn wrote: Apologies for the mass mailing today! I am attempting to produce a contour plot for phsical data on a map matrix. I have a small number of data points which each has an (x,y) co-ordinate together with a corresponding value which I would like to cvreate a contour plot for. I have

Re: [R] Suppressing warning messages

2005-05-16 Thread Martin Maechler
UweL == Uwe Ligges [EMAIL PROTECTED] on Sun, 15 May 2005 16:41:22 +0200 writes: UweL Kjetil Brinchmann Halvorsen wrote: Tolga Uzuner wrote: How do I suppress the following ? Warning messages: 1: the condition has length 1 and only the first element will

Re: [R] How to make label in multi plot

2005-05-16 Thread Muhammad Subianto
Dear Dr. Paul Murrel, Yes, this is exactly what I need. Thank's you very much. Best wishes, Muhammad Subianto On this day 5/16/2005 5:36 AM, Paul Murrell wrote: Hi (cc'ed to Pierre Lapointe because this should answer the question about [R] Centered overall title with layout() as well) Muhammad

[R] parsing speed

2005-05-16 Thread Federico Calboli
Hi everyone, I have a question on parsing speed. I have two functions: F1 F2 As things are now, F2 calls F1 internally: F2 = function(x){ if (something == 1){ y = F1(x) } if (something ==2){ do whatever } } *Assuming there could be some difference*, is is faster to use the code as written

Re: [R] branch cuts of atan()

2005-05-16 Thread Robin Hankin
Professor Ripley thanks for this. Always good to know that I'm not missing any documentation! The source is clear; formula 4.4.39 effectively has a branch cut at |z|=1. A 'n' S show the standard branch cuts in their figure 4.4, which are different (they were the ones I was expecting).

[R] a problem sourcing a file using chdir=TRUE

2005-05-16 Thread Luca Scrucca
Dear R-users, I used to give commands such as: source(file=~/path/to/file.R, chdir=TRUE) but with the latest v. 2.1.0 it does not seem to work anymore. I tried to figure out what it was going on and it seems that the string for which class(file) [1] character is changed to class(file) [1]

Re: [R] branch cuts of atan()

2005-05-16 Thread Prof Brian Ripley
On Mon, 16 May 2005, Robin Hankin wrote: Professor Ripley thanks for this. Always good to know that I'm not missing any documentation! The source is clear; formula 4.4.39 effectively has a branch cut at |z|=1. A 'n' S show the standard branch cuts in their figure 4.4, which are different (they

RE: [R] Fitting Contour to Data Points

2005-05-16 Thread Liaw, Andy
You can use the akima package to interpolate to a regular grid, then plot that. Another choice is to fit a smooth surface, using any number of smoothers available in R and CRAN. Andy From: Laura Quinn Apologies for the mass mailing today! I am attempting to produce a contour plot for

Re: [R] a problem sourcing a file using chdir=TRUE

2005-05-16 Thread Prof Brian Ripley
There was a pre-existing bug. ?source in 2.0.1 says file: a connection or a character string giving the name of the file or URL to read from. yet it contained if (chdir (path - dirname(file)) != .) { You cannot reasonably run dirname() on a connection or a URL, and it throws

RE: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Liaw, Andy
One possible solution without renaming the functions is to add namespace to either xtable or Hmisc. Given the size of Hmisc, it probably would be much easier to do that with xtable. With namespace in xtable, you can do xtable:::label() to refer to the label() in xtable specifically. Andy

Re: [R] Mental Block with PCA of multivariate time series!

2005-05-16 Thread Jean Thioulouse
Laura Quinn [EMAIL PROTECTED] wrote: I am wishing to investigate the temporal evolution of the pca: if we assume that every 50 rows of my data frame is representitive of, for instance, 1 day of data, I am hoping to automate a process whereby a pca is performed on every 50 rows of data and the

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Gabor Grothendieck
Even without a namespace one could explicitly reference the label in xtable via: xtable.label - get(label, package:xtable) On 5/16/05, Liaw, Andy [EMAIL PROTECTED] wrote: One possible solution without renaming the functions is to add namespace to either xtable or Hmisc. Given the size of

[R] constraint optimization

2005-05-16 Thread Ingmar Visser
Dear All, I have an optimization problem of the form: l=A*p=u where l and u are vectors of lower and upper bounds, p is a vector of parameters and A a linear constraint matrix. When l=u, it is easy to reparametrize in which case the result is a new set of parameters p' to be optimized. My

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
Hi Andy and Gabor, Thanks for your help so far! I am discovering another R dimension. Trying to put my head around all thisthe conflict actually exposes itself when calling summarize(Hmisc). Summarize(Hmisc) calls label internally, so I can not call it explicitly. Simply calling

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Gabor Grothendieck
Do you need label in both xtable and Hmisc? If you only need it in Hmisc and not in xtable then just be sure you have loaded xtable first and Hmisc second. This: search() will give you the search path. It will find the first one on the search path so if Hmisc is before xtable (which would

[R] get plot in a window when running R in the shell

2005-05-16 Thread bogdan romocea
Dear useRs, On a GNU/Linux box I want to run some code from the command line. This works #!/bin/sh R --vanilla -q --gui=X11 code.r however I want the plots to appear in a window (as it happens when the code is run interactively) instead of being saved in 'Rplots.ps'. Is that doable? Thank

RE: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Liaw, Andy
You need to add the namespace to the source package, by adding a NAMESPACE file. There's an R News article by Prof. Tierney on how to do this. Also see the `Writing R Extensions' manual. You should get the package maintainer to do that, as that constitute a change in the package source code.

Re: [R] get plot in a window when running R in the shell

2005-05-16 Thread Barry Rowlingson
bogdan romocea wrote: however I want the plots to appear in a window (as it happens when the code is run interactively) instead of being saved in 'Rplots.ps'. Is that doable? You could explicitly startup an X11 graphics device before your first plot in your R source code, something like: x11()

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
I tried to follow your suggestions, but without success: Error: couldn't find function xtable.mylabel- ... resulting from the code below. Any suggestions? Thanks, Sander. library(xtable) xtable.mylabel - get(label, package:xtable) library(Hmisc) # provides summarize set.seed(1) temperature -

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread David B. Dahl
Sander, Thanks for pointing out the conflict between Hmisc and xtable. I am not sure I have a good solution. My understand of the namespace solution is that packages can specify which variables to export for use by the package users. The label function is not an internal function, rather one

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Sander Oom
Hi David, Thanks for creating and supporting xtable. Glad I can contribute by pointing out problems! An earlier response from Frank Harrell Jr. suggests that the responsibility to resolve the conflict lies primarily with you, as Hmisc 'was there first'. Not sure how disputes over package

RE: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Liaw, Andy
For fixing the problem you have, you need: xtable.mylabel- - get(label-.xtable, package:xtable) I.e., you need the replacement function. One possibility of resolving the conflict, as I communicated with Frank, is to make label() and label-() in Hmisc the S3 default methods, as xtable defines

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Gabor Grothendieck
That seems like a good solution. The one problem is that both packages would need their own label generic functions if they are to operate independently of each other so if they were both loaded the last one loaded would give a warning that the label generic from the first loaded package is

Re: [R] How to convert color to black white - Solve

2005-05-16 Thread Muhammad Subianto
Dear Uwe, Thank for you advice. Now, I know how to do with my color printer to print black and white. James Holtman have advise me about that. Then I use a simple color like this to use my picture. print.bw4 -c(blueF = #FF, redF = #FF,

[R] sink stack memory??

2005-05-16 Thread Anubhav Manglick
Dear R-mailers I want to store data in a seperate file named 'XYZ' so I uses sink function for it i runs the loop , say 100 times, and so every of the 100 times the function is called the result must go to the file. But after soem time of running it says Error in sink(C:/XYZ, append = TRUE) :

[R] memory and step()

2005-05-16 Thread Dimitri Joe
Hi there, I'm trying to perform a step(), using variables from a data set with 32.000 observations. The upper model is not so long - (x1 + x2 + x3)^2 - where x1...x3 are the explanatory variables. Yet, I got a memory problem when performing it. The message is the following: Error: cannot

RE: [R] Mental Block with PCA of multivariate time series!

2005-05-16 Thread Ignacio Colonna
Is this along the lines of what you are trying to do? sim.data-data.frame(matrix(rnorm(350*10),350,10)) day-seq(1:350) sim.data-data.frame(day,sim.data) pc1.load.all-NULL pc2.load.all-NULL for (i in seq(0,300,by=50)){ sim.data.i-subset(sim.data,sim.data$dayisim.data$day(i+50))

Re: [R] Conflict between xtable and Hmisc when using Sweave?

2005-05-16 Thread Gabor Grothendieck
Using label as an lvalue (i.e. on the left hand side of the assignment) causes it to refer to a different function, not label itself. Any any rate, looking at your example, it seems that you don't actually need to use Hmisc and xtable at the same time so just make sure that whichever you want

Re: [R] sink stack memory??

2005-05-16 Thread Uwe Ligges
Anubhav Manglick wrote: Dear R-mailers I want to store data in a seperate file named 'XYZ' so I uses sink function for it i runs the loop , say 100 times, and so every of the 100 times the function is called the result must go to the file. But after soem time of running it says Error in

Re: [R] memory and step()

2005-05-16 Thread Uwe Ligges
Dimitri Joe wrote: Hi there, I'm trying to perform a step(), using variables from a data set with 32.000 observations. The upper model is not so long - (x1 + x2 + x3)^2 - where x1...x3 are the explanatory variables. Yet, I got a memory problem when performing it. The message is the following:

[R] Solutions? Intro Stats with R - Dalgaard

2005-05-16 Thread graek just graek
Hi, I'm going through the book Introductory Statistics with R by Dalgaard to teach myself R. At the end of each chapter there are some exercises. Does anyone know of any place on the net where someone has posted the answers to these? I've looked at the author's and the publisher's site

[R] Mixed-effects model with lagged endogenous variables and autocorrelated residuals

2005-05-16 Thread Revilla,AJ (pgt)
Dear all, I am dealing with a nonlinear model of the form yt = A*exp(-B*T)*Yt-1, where T represents time and Yt-1 accounts for the accumulated values of y from T=0 to t-1. The problem of the models is that the error terms are autocorrelated, so I have to deal with a model combining

[R] =?utf-8?q?Nuevo_buz=C3=B3n_de_correo-_New_mailbox?=

2005-05-16 Thread [EMAIL PROTECTED]
Estimado: Por medio de la presente notifico que hemos cambiado el dominio de Anew e-Business Distribution por el siguiente: anew.com.ve Mucho agradezco tomar en cuenta que ahora mi nueva dirección de correo será [EMAIL PROTECTED] Mil gracias Saludos Kam Fai Leon Hello, I notify you that

Re: [R] Solutions? Intro Stats with R - Dalgaard

2005-05-16 Thread Peter Dalgaard
graek just graek [EMAIL PROTECTED] writes: Hi, I'm going through the book Introductory Statistics with R by Dalgaard to teach myself R. At the end of each chapter there are some exercises. Does anyone know of any place on the net where someone has posted the answers to these? I've

[R] A question about bugs.R: functions for running WinBUGs from R

2005-05-16 Thread Li, Jia
Dear R users, I've found bugs.R : the functions for running WinBUGs from R that is writen by Dr. Andrew Gelman who is a professor from Columbia University. The bugs.R would be very useful for me, and I think many of you know it as well. I followed the instuctions on Dr. Gelman's web to install

[R] predict problem

2005-05-16 Thread Weiwei Shi
Hi, there: I have a question on predict() function. I built a set of trees using rpart and when I do prediction, I got the following error: Error in model.frame.default(Terms, newdata, na.action = act, xlev = attr(object , : factor V19 has new level(s) 45 Execution halted I think the

[R] isotonic regression

2005-05-16 Thread Nathan Leon Pace, MD, MStat
Hi, In Order Restricted Statistical Inference by Robertson et al (Chapter 1) there is an algorithm for isotonic regression with two or more independent variables. Has this been implemented anywhere in R? Thanks, Nathan Nathan Leon Pace, MD, MStat University of Utah Salt Lake City, UT 84132

Re: [R] multinom(): likelihood of model?

2005-05-16 Thread Brooks Miner
Professor Ripley, Thanks very much. You comments were very helpful. I've got it (almost) all figured out now. My model is for discrete data (discrete response AND predictors). The issue I'm stuck on is that my saturated model does NOT predict exactly; the constant is ~1874.052. Here is

Re: [R] parsing speed

2005-05-16 Thread Duncan Murdoch
Federico Calboli wrote: Hi everyone, I have a question on parsing speed. I have two functions: F1 F2 As things are now, F2 calls F1 internally: F2 = function(x){ if (something == 1){ y = F1(x) } if (something ==2){ do whatever } } *Assuming there could be some difference*, is is faster to use the

RE: [R] parsing speed

2005-05-16 Thread Berton Gunter
(just my additional $.02) ... and as a general rule (subject to numerous exceptions, caveats, etc.) 1) it is programming and debugging time that most impacts overall program execution time; 2) this is most strongly impacted by code readability and size (the smaller the better); 3) both of which

[R] Omitting NAs in aggregate.ts()

2005-05-16 Thread Waichler, Scott R
I have a time series vector (not necessarily ts class) that has NAs in it. How can I omit the NAs when using aggregate.ts() to compute a function on each window? If there is at least one non-NA value in each window, I'd like to proceed with evaluating the function; otherwise, I would like NA

[R] how to use list index to get vector

2005-05-16 Thread Luke
I have a simple question, but I couldn't find the answer in R manuals. Assume I have a list: foo - list() foo[[1]] - c(1, 2, 3) foo[[2]] - c(11,22,33) foo[[3]] - c(111,222,333) foo [[1]] [1] 1 2 3 [[2]] [1] 11 22 33 [[3]] [1] 111 222 333 How to use list index to get a vector of, say, the

Re: [R] how to use list index to get vector

2005-05-16 Thread Gabor Grothendieck
On 5/16/05, Luke [EMAIL PROTECTED] wrote: I have a simple question, but I couldn't find the answer in R manuals. Assume I have a list: foo - list() foo[[1]] - c(1, 2, 3) foo[[2]] - c(11,22,33) foo[[3]] - c(111,222,333) foo [[1]] [1] 1 2 3 [[2]] [1] 11 22 33 [[3]] [1] 111

Re: [R] how to use list index to get vector

2005-05-16 Thread Gabor Grothendieck
Its the indexing function written in ordinary function form. That is, foo[1:2] can be written as [(foo, 1:2) On 5/16/05, Luke [EMAIL PROTECTED] wrote: Yes, it works. Althought I can understand the help page of sapply, I don't know why it works. What is [? -Luke On 5/16/05, Gabor

Re: [R] how to use list index to get vector

2005-05-16 Thread Luke
Hi Gabor, thanks a lot. I understand it now. But Andrew's method is easier for me to understand. Can I extend my question? I have a data file, every line has such format: 2:102 5:85 ... The number before colon is data entry index, the number after colon is data entry value, and other data entries

RE: [R] how to use list index to get vector

2005-05-16 Thread Liaw, Andy
If you have the data in files in such format, with one entry per line, you can do something like: dat - matrix(scan(fileWithData, sep=:), ncol=2, byrow=TRUE) Then the first column of dat would be the indices, and the second column would be the values. Andy From: Luke Hi Gabor, thanks a

[R] The error in R while using bugs.R function

2005-05-16 Thread Li, Jia
Dear R users, I followed the instuctions on Dr. Gelman's web to install all of documents that bugs.R needs, but when I try to run the school example that the web posted in R, I got an error: couldn't find function bugs, what's wrong? Thanks, Jia

[R] install.packages parameters

2005-05-16 Thread Janet Elise Rosenbaum
Hello. R is having some trouble installing a package because it passed arguments to gcc which were non-existent directories and files. It also didn't find g77, although it's in a directory in my $PATH; I tricked it by making a sym link in /usr/bin. What file does R get these parameters

[R] NA erase your data trick

2005-05-16 Thread Anders Schwartz Corr
Oops, I just erased all my data using this gizmo that I thought would replace -9 with NA. A) Can I get my tcn5 back? B) How do I do it right next time, I learned my lesson, I'll never do it again, I promise! Anders Corr for(i in 1:dim(tcn5)[2]){ ##for the number of columns +

Re: [R] multinom(): likelihood of model?

2005-05-16 Thread Prof Brian Ripley
On Mon, 16 May 2005, Brooks Miner wrote: Professor Ripley, Thanks very much. You comments were very helpful. I've got it (almost) all figured out now. My model is for discrete data (discrete response AND predictors). The issue I'm stuck on is that my saturated model does NOT predict