[R] Changing Color of Graphics Device
Hello! Several of us here have tried to change the dark grey background color of the graphics device, without success. This grey background color only so far appears for Trellis plots. All other plots are shown with white background color. Is there any way to change this color? Regards Dassy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Réf. : [R] Changing Color of Graphics Device
Hi, If you want to change the background color of the trellis plots, you can try : trellis.device (bg=white) ... or to obtain a gray with 97% white and 3% black : trellis.device (bg=gray(0.97)) Kinds regards, François Brunschwig, Hadassa {PDMM~Basel} Pour : [EMAIL PROTECTED] [EMAIL PROTECTED] cc : oche.COM Objet : [R] Changing Color of Graphics Device Envoyé par : [EMAIL PROTECTED] ath.ethz.ch 21/08/03 08:29 Hello! Several of us here have tried to change the dark grey background color of the graphics device, without success. This grey background color only so far appears for Trellis plots. All other plots are shown with white background color. Is there any way to change this color? Regards Dassy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Weighted circular mean
Martin Biuw wrote: Hello, Once again, I posted a message without a subject line. Sorry here is the question again. Is there a simple way to modify the circ.mean function in the CircStats package to include a vector of weights to obtain a weighted average angle? Two comments: 1) circ.mean function (x) { sinr - sum(sin(x)) cosr - sum(cos(x)) circmean - atan(sinr, cosr) circmean } The function is not that hard to understand, so you might be able to answer your question yourself, don't you? 2) Please contact the author of a contributed package in order to submit a wishlist. He/she knows the functions much better and is the only one who can change things within the package, regularly. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] question about simulation.
Lily wrote: The problem has been solved. It is my mistake for not define the number of monte.carlo simulation when I am using mle.cv. Thank you all for your help! My last comment: It is your mistake not to specify required arguments, but there *is* a bug in wle. You should get an error message instead of that crash ... Uwe Ligges --- Spencer Graves [EMAIL PROTECTED] wrote: What version of R under what operating system with how much memory? What R functions are you using? Can you do a traceback()? Also, have you tried www.r-project.org - search - R site search? hope this helps. spencer graves Lily wrote: I am running a 1000 simulations, it works for 2 simulations. However, I get the following error message whenever I run it more than 3 times: The instruction at '0*11044080' referenced memory at o*3ff0. The memory could not be written. and, I can also get something like exception: access violation (0*c005). Address:0*11044080. Anybody knows what's going on? Thanks a lot! __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Changing Color of Graphics Device
Brunschwig, Hadassa {PDMM~Basel} wrote: Hello! Several of us here have tried to change the dark grey background color of the graphics device, without success. This grey background color only so far appears for Trellis plots. All other plots are shown with white background color. Is there any way to change this color? Regards Dassy Several users have already asked this question, hence you'll find the answer in the mailing list archives. See ?trellis.device which tells you about its arguments color and theme and that you can set options(lattice.theme = col.whitebg) Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] filter factors with min. freq
Hi, i use a data.frame with ~ 80.000 observations and one attribute is a factor with ~ 7300 levels. Is there a easy step which allow me to filter out the the data with minimum frequencies i.e. 20 cases per level. So existing levels with 20 cases in this factor attribute are deleted from data.frame. many thanks and regards, christian __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] filter factors with min. freq
Christian Schulz wrote: Hi, i use a data.frame with ~ 80.000 observations and one attribute is a factor with ~ 7300 levels. Is there a easy step which allow me to filter out the the data with minimum frequencies i.e. 20 cases per level. So existing levels with 20 cases in this factor attribute are deleted from data.frame. many thanks and regards, christian Why not calculating a table for that factor and removing those levels with n_i 20 ? Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Method of L-BFGS-B of optim evaluate function outside of boxconstraints
On Wednesday 20 August 2003 15:44, Shengqiao Li wrote: Hi, R guys: I'm using L-BFGS-B method of optim for minimization problem. My function called besselI function which need non-negative parameter and the besselI will overflow if the parameter is too large. So I set the constraint box which is reasonable for my problem. But the point outside the box was test, and I got error. My program and the error follows. This program depends on CircStats package. Anyone has any idea about this? No idea... I can only say that a similar behaviour of optim with method=L-BFGS-B (i.e. evaluation of the function outside the lower/upper limits) has occurred to me too. It is a rare but possible behaviour. Last June, I have sent a full description of the problem to [EMAIL PROTECTED] Regards, Adelchi Azzalini -- Adelchi Azzalini [EMAIL PROTECTED] Dipart.Scienze Statistiche, Università di Padova, Italia http://azzalini.stat.unipd.it/ (please, no ms-word/ms-excel/alike attachments) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R is mentioned on Linux Today
BeT == Berwin Turlach [EMAIL PROTECTED] on Thu, 21 Aug 2003 09:49:47 +0800 writes: BeT Hi all, people who don't follow Linux Today regularly BeT may want to check out: BeT BeT http://linuxtoday.com/developer/2003082000626OSSVDV BeT My apologies if this is considered spam. Definitely not. As a matter of fact, these are links to two articles the first of which (IBM Developerworks) was already posted here about two days ago. The reason I'm wasting bandwidth here is the 2nd one, from the UK Linuxuser journal, http://www.linuxuser.co.uk/articles/issue32/lud32-R.html This one is really amazing by its quality. It's author, Ramin Nakisa (I've BCC'ed him), really writes like a professional journalist but at the same time was able to get very good inside information particularly about the history of S and R -- I found that he even contributed a (valid!) bug report for R several years ago. Thank you, Ramin! Regards, Martin Maechler [EMAIL PROTECTED] http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Filled triangles in lattice graphics?
Hans Gardfjell wrote: Dear R users, I can get a filled triangle pointing upwards by specifying pch=17 in xyplot or lpoints, but how do I get a filled triangle that points downwards? In the standard plot function it's possible to use plot(x,y,pch=25,bg=black), but bg= doesn't seem to work with lattice and lpoints. Thanks, Hans Gardfjell Ecology and Environmental Science Umeå University, Sweden __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help In grid package that is underling package of lattice fill color is set through gp parameter. Try this plot(x,y,pch=25,gp=gpar(fill=black,col=black)) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] graphics device
Brunschwig, Hadassa {PDMM~Basel} wrote: Hi all, well i know this was probably already posted many times, couldnt find anything about it though. This is a beginner problem. I have a Trellis plot which is very large, i.e. it only shows me the last few panels (after going automatically through the first ones and stopping at the last few). When i scrole with PageUp or Page down it shows me the panels of a graph i did last time but not of the graph i plotted now. I also tried to use the dev.next() etc. functions but the showing doesnt change. I guess i dont really understand how these functions work but i would like to print the whole set of panels. Thanks for reply Dassy I'd recommend to generate PostScript or PDF output at first, then you get a document you can scroll through and printing won't be a problem. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R scripts
I have two examples here first is real basic answers your question, second handles arguments. I am interested in getting a more robust command line parser for R, perhaps using PERL GetOpt::Long as a front end is the quickest solution. #1 (answers your question) === $ more Rb #!/bin/sh R --quiet \ --no-save \ $* #2 adds arguments === $ more Rba #!/bin/sh ## ## ARG 1 is the R program to RUN ## rest of line are arguments if [ $# -eq 0 ] ; then echo echo usage: Rba RPROGRAM.r ARG1 ARG2 echo exit fi program=$1 shift cmdargs=$* gtime R --quiet \ --no-save \ $cmdargs $program __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] filter factors with min. freq
In the Hmisc package see function combine.levels On Thu, 21 Aug 2003 09:06:21 +0200 Christian Schulz [EMAIL PROTECTED] wrote: Hi, i use a data.frame with ~ 80.000 observations and one attribute is a factor with ~ 7300 levels. Is there a easy step which allow me to filter out the the data with minimum frequencies i.e. 20 cases per level. So existing levels with 20 cases in this factor attribute are deleted from data.frame. many thanks and regards, christian __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help --- Frank E Harrell Jr Prof. of Biostatistics Statistics Div. of Biostatistics Epidem. Dept. of Health Evaluation Sciences U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] levelplot behaviour for panel with constants
In the example: x = rep(c(0,0,1,1),4) y = rep(c(0,1,0,1),4) z = c(1,0,1,0,0,0,1,1,0,1,0,0,1,1,1,1) f = as.factor(c(rep(a,4),rep(b,4),rep(c,4),rep(d,4))) levelplot(z~x+y|f,data.frame(x=x,y=y,z=z,f=f)) I noted that the last (d) plot remains empty. I guess the reason for this is that the values are constant (1), but I consider it more consistent if they would get the colour of 1, and would be left blank in case they were NA's. -- Edzer __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Read date for timeserie object
Dear all, Is there a simple trick to read in data with the following format and create a Time Serie object of it? DateCountOfField2 5/10/1998 7 5/11/1998 5 5/12/1998 2 5/14/1998 1 5/15/1998 1 5/19/1998 1 5/20/1998 1 5/21/1998 1 5/24/1998 2 5/25/1998 1 5/26/1998 2 2002 ... R should recognize that some dates are not available...(NA). You can define start and end date Ok, and frequency= 365 is ok...but is it possible that recognizes the gaps? Thanks a lot, Jan __ Jan Verbesselt Research Associate Lab of Geomatics and Forest Engineering K.U. Leuven Vital Decosterstraat 102. B-3000 Leuven Belgium Tel:+32-16-329750 Fax: +32-16-329760 http://perswww.kuleuven.ac.be/~u0027178/VCard/mycard.php?name=janv http://gloveg.kuleuven.ac.be/ __ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] A logical comparison between two character strings in R
Dear All, Does anyone know how to compare two character strings in R? For eample, how to compare A-1-B with cc-1 in logical ? Cheers, Lun Li __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] graphics device
On Thursday 21 August 2003 05:04, Uwe Ligges wrote: Brunschwig, Hadassa {PDMM~Basel} wrote: Hi all, well i know this was probably already posted many times, couldnt find anything about it though. This is a beginner problem. I have a Trellis plot which is very large, i.e. it only shows me the last few panels (after going automatically through the first ones and stopping at the last few). When i scrole with PageUp or Page down it shows me the panels of a graph i did last time but not of the graph i plotted now. I also tried to use the dev.next() etc. functions but the showing doesnt change. I guess i dont really understand how these functions work but i would like to print the whole set of panels. Thanks for reply Dassy I'd recommend to generate PostScript or PDF output at first, then you get a document you can scroll through and printing won't be a problem. Uwe Ligges Also, you could set par(ask = TRUE), which will prompt you before each new page. Deepayan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] A logical comparison between two character strings in R
Lun Li [EMAIL PROTECTED] writes: Dear All, Does anyone know how to compare two character strings in R? For eample, how to compare A-1-B with cc-1 in logical ? Ehhh... Is it this that you want? A-1-B == cc-1 [1] FALSE A-1-B = cc-1 [1] TRUE A-1-B cc-1 [1] FALSE d-1-B cc-1 [1] TRUE -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] A logical comparison between two character strings in R
Dear All, Can anyone know how to compare two character strings in R? For eample, how to compare A-1-B with cc-1 in logical ? Cheers, Lun Li __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] A logical comparison between two character strings in R
Lun Li [EMAIL PROTECTED] writes: Thanks. But, my question is: pro.name[1] V1 1 B-29BT3 temp.name[1] V1 1 A-1H if(tem.name[1]==pro.name[1]){cat(ok)} Error in Ops.factor(left, right) : Level sets of factors are different How to compare them? Then they are factors, not character variables. Use as.character on both sides. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] A logical comparison between two character strings in R
Thanks. But, my question is: pro.name[1] V1 1 B-29BT3 temp.name[1] V1 1 A-1H if(tem.name[1]==pro.name[1]){cat(ok)} Error in Ops.factor(left, right) : Level sets of factors are different How to compare them? Lun Quoting Peter Dalgaard BSA [EMAIL PROTECTED]: Lun Li [EMAIL PROTECTED] writes: Dear All, Does anyone know how to compare two character strings in R? For eample, how to compare A-1-B with cc-1 in logical ? Ehhh... Is it this that you want? A-1-B == cc-1 [1] FALSE A-1-B = cc-1 [1] TRUE A-1-B cc-1 [1] FALSE d-1-B cc-1 [1] TRUE -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] A logical comparison between two character strings in R
On 21 Aug 2003 at 15:49, Lun Li wrote: Thanks. But, my question is: pro.name[1] V1 1 B-29BT3 temp.name[1] V1 1 A-1H if(tem.name[1]==pro.name[1]){cat(ok)} Error in Ops.factor(left, right) : Level sets of factors are different I suppose your variables are actually factors not characer vectors. see temp.name [1] B-29BT3 ccc-29BT3 Levels: B-29BT3 ccc-29BT3 pro.name [1] B-29BT3 B-29BT3 Levels: B-29BT3 if(temp.name[1]==pro.name[1]){cat(ok)} Error in Ops.factor(temp.name[1], pro.name[1]) : Level sets of factors are different but pro.name.ch [1] B-29BT3 B-29BT3 temp.name.ch [1] B-29BT3 ccc-29BT3 if(temp.name.ch[1]==pro.name.ch[1]){cat(ok)} ok How to compare them? make them character, see ?as.character Lun Quoting Peter Dalgaard BSA [EMAIL PROTECTED]: Lun Li [EMAIL PROTECTED] writes: Dear All, Does anyone know how to compare two character strings in R? For eample, how to compare A-1-B with cc-1 in logical ? Ehhh... Is it this that you want? A-1-B == cc-1 [1] FALSE A-1-B = cc-1 [1] TRUE A-1-B cc-1 [1] FALSE d-1-B cc-1 [1] TRUE -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Petr Pikal [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] levelplot behaviour for panel with constants
Looks like a bug. I'll investigate. Thanks, Deepayan On Thursday 21 August 2003 07:42, Edzer J. Pebesma wrote: In the example: x = rep(c(0,0,1,1),4) y = rep(c(0,1,0,1),4) z = c(1,0,1,0,0,0,1,1,0,1,0,0,1,1,1,1) f = as.factor(c(rep(a,4),rep(b,4),rep(c,4),rep(d,4))) levelplot(z~x+y|f,data.frame(x=x,y=y,z=z,f=f)) I noted that the last (d) plot remains empty. I guess the reason for this is that the values are constant (1), but I consider it more consistent if they would get the colour of 1, and would be left blank in case they were NA's. -- Edzer __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Use of Second Monitor Question
In teaching I'd like to be able to display a R-graphics window on a wall projection display keeping the R-console on the computer monitor. And so I ask--- Is there a way to move a graphics window out of the Rgui window to a second monitor leaving the R Console window in the Rgui window on the first monitor? Either a Windows or Linux solution would be just fine. --jed diem __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Read date for timeserie object
Objects of class ts are for regualrly spaced time series only. What you have is an irregular time series. On Thu, 21 Aug 2003, Jan Verbesselt wrote: Dear all, Is there a simple trick to read in data with the following format and create a Time Serie object of it? Date CountOfField2 5/10/1998 7 5/11/1998 5 5/12/1998 2 5/14/1998 1 5/15/1998 1 5/19/1998 1 5/20/1998 1 5/21/1998 1 5/24/1998 2 5/25/1998 1 5/26/1998 2 2002 ... And what does `2002' mean here? R should recognize that some dates are not available...(NA). You can define start and end date Ok, and frequency= 365 is ok...but is it possible that recognizes the gaps? R does what you program it to do, and you could instruct it to do this. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] A logical comparison between two character strings in R
Did you check any documentation on R, e.g., help(Comparison) or www.r-project.org - Manuals - An Introdunction to R? In Section 2.4 on Logical vectors, I find, The logical operators are , =, , =, == for exact equality ... . Consider the following: A-1-B == cc-1 [1] FALSE hope this helps. spencer graves Lun Li wrote: Dear All, Does anyone know how to compare two character strings in R? For eample, how to compare A-1-B with cc-1 in logical ? Cheers, Lun Li __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Use of Second Monitor Question
Jed Diem wrote: In teaching I'd like to be able to display a R-graphics window on a wall projection display keeping the R-console on the computer monitor. And so I ask--- Is there a way to move a graphics window out of the Rgui window to a second monitor leaving the R Console window in the Rgui window on the first monitor? Either a Windows or Linux solution would be just fine. Linux: out of the box, Windows: Start RGui with option --sdi, or choose SDI mode in the menu (Edit - GUI preferences ...). Uwe Ligges --jed diem __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Importing data into R
On Thu, 21 Aug 2003, Gavrilov, Pavel M wrote: Hello. I have been working with GeoDA, and have created a spatial weights file for my data. I am now looking to use R to run regressions on this data. However, I don't know and can't figure out how to get my data into R to run these regressions. I have the data in many formats, from a .dbf file to an Excel spreadsheet, but I'm not sure how to go about importing it into R. Could you help me out please? Thanks. R comes with a `Data Import/Export Manual'. Have you read it yet? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Importing data into R
On Thu, 21 Aug 2003, Gavrilov, Pavel M wrote: Hello. I have been working with GeoDA, and have created a spatial weights file for my data. I am now looking to use R to run regressions on this data. However, I don't know and can't figure out how to get my data into R to run these regressions. I have the data in many formats, from a .dbf file to an Excel spreadsheet, but I'm not sure how to go about importing it into R. Could you help me out please? Thanks. The manual for such problems available from http://cran.r-project.org/doc/manuals/R-data.pdf Torsten Sincerely, Pavel Gavrilov [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Importing data into R
On 08/21/03 12:15, Gavrilov, Pavel M wrote: I have the data in many formats, from a .dbf file to an Excel spreadsheet, but I'm not sure how to go about importing it into R. Could you help me out please? Thanks. In the documents that come with R is one called R Data Import/Export. You might take a look at that. If you can't find it, I have it on the web at http://finzi.psych.upenn.edu/R/doc/manual/R-data.html but really it should come with your distribution. -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page:http://www.sas.upenn.edu/~baron R page: http://finzi.psych.upenn.edu/ Deleting mail that says Approved Thank you! Your application Your details __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] anova(lme object)
Hi, I use lme to fit models like R res1 - lme(y~A+B, data=mydata, random=~1|subject) R res2 - lme(y~B+A, data=mydata, random=~1|subject) (only difference between these two models are the sequence in which the indep variables are written in formula) where y is continuous and A, B, and subject are factors. To get ANOVA table I used R anova(res1) R anova(res2) and found ANOVA tables corresponding to these two models are different. Is there any way I can get similar ANOVA tables from lme objects of this type? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] revisions made in Notes on R for psychology ...
Yuelin Li and I have made some revisions in our introductory document, Notes on the use of R for psychology experiments and questionnaires, which is still available through my R page (below) in html or pdf. We fixed typos. We updated and organized the list of commands. (Re-organized isn't quite right.) We made a few other additions throughout. And we revised the section on repeated-measures analysis of variance on the basis of some comments received. You will also find in my site a copy of Nels Tomlinson's reference card, which was unavailable for a while. -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page:http://www.sas.upenn.edu/~baron R page: http://finzi.psych.upenn.edu/ Deleting mail that says Approved Thank you! Your application Your details __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Read date for timeserie object
You might wish to have a look at the package 'its' for handling irregular time-series. If your data is in a .csv file, the following would enable you to handle the data in its irregular form. its.format(%m/%d/%Y) readcsvIts(filename) - Giles -Original Message- From: Jan Verbesselt [mailto:[EMAIL PROTECTED] Sent: 21 August 2003 15:07 To: [EMAIL PROTECTED] Subject: [R] Read date for timeserie object Importance: High Dear all, Is there a simple trick to read in data with the following format and create a Time Serie object of it? Date CountOfField2 5/10/1998 7 5/11/1998 5 5/12/1998 2 5/14/1998 1 5/15/1998 1 5/19/1998 1 5/20/1998 1 5/21/1998 1 5/24/1998 2 5/25/1998 1 5/26/1998 2 2002 ... R should recognize that some dates are not available...(NA). You can define start and end date Ok, and frequency= 365 is ok...but is it possible that recognizes the gaps? Thanks a lot, Jan __ __ __ Jan Verbesselt Research Associate Lab of Geomatics and Forest Engineering K.U. Leuven Vital Decosterstraat 102. B-3000 Leuven Belgium Tel:+32-16-329750 Fax: +32-16-329760 http://perswww.kuleuven.ac.be/~u0027178/VCard/mycard.php?name=janv http://gloveg.kuleuven.ac.be/ __ __ __ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help ** This is a commercial communication from Commerzbank AG.\ \ T...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Diamond graphs
Richard A. O'Keefe [EMAIL PROTECTED] wrote: Someone mentioned the new Diamond Graphs invented at Johns Hopkins. I haven't see the August 2003 issue of The American Statistician yet, but I _have_ read the press release. Same here. The fact that someone would try to patent this strikes me as outrageous; the actual amount of novelty is so tiny. Agree again. [Richards points edited for space] For R, I don't think it matters, because I think that diamond graphs are a bad idea. In short, it looks to me as though diamond graphs are something R is better off without. A few points to add to Richards comments. The proposed diamond graph is not innovative, more intuitive, or more accurate than existing graph forms. It is applicable to one limited graphing problem: a continuous (outcome) dimension and two discrete categorical dimensions. Ironically, the example http://www.jhu.edu/~gazette/2003/18aug03/18graph.html uses artificially imposed discrete categories on two continuous variables! Why not treat them as continuous? This specific problem (2 categorical, 1 continuous) presents the challenge of representing 3 dimensions on a two dimensional plane. The traditional solution is the 3D bar chart which uses perspective to represent the third dimension. There are many problems with that compromise. The two greatest being that the fixed perspective can obscure bars further back in the z (depth) dimension, and that perception of the relative size (height) of the bars is less precise due to projection of the third dimension through perspective. The perspective distortion can be corrected through stereoscopic presentation, the obstruction of bars can be corrected through animation. These solutions complete the third dimension, but will not work on a monochromatic printed page. Less expensive and more practical would be to present the data in a two dimensional matrix (as proposed in the diamond) but not to use an odd shape to convey the third dimension. The third dimension could be represented by hue (color) or brightness (shade). I suspect that actual psychometric tests would show that color or other visual representations of density would be more accurate and reliable than their proposed solution which confounds area with shape. As a caveat, I have not read the American Statistician article. I will be surprised if they present data showing that users can more accurately perceive variation in the continuous variable through their odd shape solution in contrast to either color or shade. Harold Baize, Ph.D. Research and Evaluation Youth Services Division Butte County Department of Behavioral Health [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] anova(lme object)
Yes. One way is to use anova(res1, type=marginal). Read the help page and the book (or any decent linear models book). Andy -Original Message- From: Mahbub Latif [mailto:[EMAIL PROTECTED] Sent: Thursday, August 21, 2003 12:51 PM To: [EMAIL PROTECTED] Subject: [R] anova(lme object) Hi, I use lme to fit models like R res1 - lme(y~A+B, data=mydata, random=~1|subject) R res2 - lme(y~B+A, data=mydata, random=~1|subject) (only difference between these two models are the sequence in which the indep variables are written in formula) where y is continuous and A, B, and subject are factors. To get ANOVA table I used R anova(res1) R anova(res2) and found ANOVA tables corresponding to these two models are different. Is there any way I can get similar ANOVA tables from lme objects of this type? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] pbinom
Hi, there I am new in statistics, forgive me if this question is too silly. I want to test if one alignment method is better over another one. To do this, I use a bunch of sequence pairs as benchmark and aligned them using these two method, respectively. By comparing the alignment with 3D structure superimposed alignment, I can get a score (s1 for method one and s0 for original method) for each alignment method on pairs I selected. What statistical test should I choose? I want to use a binomial test. but, It seems this test only takes two set of data, either s1s0 or s1s0. howver, in my case sometimes two methods have the same score, how to deal with the situation when s0 = s1? Or should I use paired t-test? regards John __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] anova(lme object)
On Thu, 21 Aug 2003, Mahbub Latif wrote: Hi, I use lme to fit models like R res1 - lme(y~A+B, data=mydata, random=~1|subject) R res2 - lme(y~B+A, data=mydata, random=~1|subject) (only difference between these two models are the sequence in which the indep variables are written in formula) where y is continuous and A, B, and subject are factors. To get ANOVA table I used R anova(res1) R anova(res2) and found ANOVA tables corresponding to these two models are different. Is there any way I can get similar ANOVA tables from lme objects of this type? Those are *sequential* anova tables, so should be different. Read the help page ?anova.lme to find the answer to your question. Hint: argument `type' may help. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] anova(lme object)
The different answers reflect a lack of symmetry in the data set. The standard A+B anova evaluates the effect of A by itself and B given A. The other evalutes the effect of B by itself plus A given B. They answer different questions. If you want the same answer from A+B as from B+A, you have to be clearer about what you want. For more discussion of that, see any good book on analysis of variance, including discussions of Types II and III sums of squares, e.g., from www.r-project.org - search - R site search. Judging from what they did, it seems apparent that the R developers and the S and S-Plus developers before them felt that it was best to report results in this way. hope this helps. spencer graves Mahbub Latif wrote: Hi, I use lme to fit models like R res1 - lme(y~A+B, data=mydata, random=~1|subject) R res2 - lme(y~B+A, data=mydata, random=~1|subject) (only difference between these two models are the sequence in which the indep variables are written in formula) where y is continuous and A, B, and subject are factors. To get ANOVA table I used R anova(res1) R anova(res2) and found ANOVA tables corresponding to these two models are different. Is there any way I can get similar ANOVA tables from lme objects of this type? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] automatic logging of commands
Is there an R function that automatically writes all input and output to a file? I would at least like it to log all the commands I enter, and to preferably also write the standard output to the file as well as to the screen. (The ideal would be to write the input to one file and both the input and output to another file.) I tried R2HTML for this, but I could not get it to work consistently. I am using a UNIX version of R: version _ platform powerpc-apple-darwin6.6 arch powerpc os darwin6.6 system powerpc, darwin6.6 status Patched major1 minor7.1 year 2003 month06 day 21 language R Thanks, David ___ http://www.mcg.edu/research/biostat/bickel.html David R. Bickel, Assistant Professor Medical College of Georgia Office of Biostatistics and Bioinformatics (706) 721-4697, 721-3785; Fax: 721-6294 [EMAIL PROTECTED] or [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] anova(lme object)
It is documented in ?anova.lme: anova(res1, type=marginal) and anova(res2, type=marginal) should give equivalent tables. -- Bjørn-Helge Mevik __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] automatic logging of commands
All commands are logged in the history file, if your `UNIX' (is that really a certified UNIX?) version of R supports history files. See e.g. ?savehistory. On Thu, 21 Aug 2003, David R. Bickel wrote: Is there an R function that automatically writes all input and output to a file? I would at least like it to log all the commands I enter, and to preferably also write the standard output to the file as well as to the screen. (The ideal would be to write the input to one file and both the input and output to another file.) I tried R2HTML for this, but I could not get it to work consistently. I am using a UNIX version of R: version _ platform powerpc-apple-darwin6.6 arch powerpc os darwin6.6 system powerpc, darwin6.6 status Patched major1 minor7.1 year 2003 month06 day 21 language R -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] comparing segments of a time series
Hi, I have a time series of 38 wintertime average snow depths measured at a particular meteorological station. The data appear to undergo a climate shift in the early 1980s: before the shift the mean and sd are 152 +/- 58, after the shift 92 +/- 36. The distribution is not normal; there's a hard limit at zero of course and there are outlier years with very high snowfall. I don't feel justified making a log transformation on the data, so I'd rather use distribution-free methods. I would like to have statistical justification for the statement that the snow depth in the second period is less than in the first half, and that the variability decreased as well. For the difference in central measures, I am using the (unpaired) wilcox.test, but I really have no idea how to address the question of changes in variability using nonparametric means. Any ideas? Thanks, Tony __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] anova(lme object)
You need to say library(nlme) first. Without that, ?anove.lme [in R 1.7.1 under Windows 2000] and produced for me the following: Error in help(anova.lme, htmlhelp = FALSE) : No documentation for `anova.lme' in specified packages and libraries: you could try `help.search(anova.lme)' 'help.search(anova.lme)' says anova.lme is in package nlme. hope this helps. spencer gravesw Bjørn-Helge Mevik wrote: It is documented in ?anova.lme: anova(res1, type=marginal) and anova(res2, type=marginal) should give equivalent tables. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Method of L-BFGS-B of optim evaluate function outside ofbox constraints
Thanks. log.arg worked to make sure nonnegative value. But the other side is overflow. Beyond the upper limit, the exp(arg) is large and bessel overflows even if exponentially scaled one is used. This will happen at 1/500 chance. Due to I'm doing 10,000 simulations, this problem blocked me. Regards, Li I see two problems, which I handle differently: First, if arg must be nonnegative, I program fn in terms of log.arg, so it can never become nonpositive. Second, is besselI always positive? If yes, then program fn to compute log(besselI) and use that. Standard references such as Abramowitz and Stegun (1970) Handbook of Mathematical Functions (US Gov't printing office) give asymptotic expansions that give good answers for values of arguments near very large or very small. If you test the values of the arguments, you can develop good numbers to use. Then optim should work fine. hope this helps. spencer graves Shengqiao Li wrote: Hi, R guys: I'm using L-BFGS-B method of optim for minimization problem. My function called besselI function which need non-negative parameter and the besselI will overflow if the parameter is too large. So I set the constraint box which is reasonable for my problem. But the point outside the box was test, and I got error. My program and the error follows. This program depends on CircStats package. Anyone has any idea about this? Thanks in advance. Li source code ### Dk2- function(pars,theta) { kappa- pars[1]; mu- pars[2]; IoK- besselI(kappa, nu=0); res- besselI(2*kappa, nu=0)/2/IoK^2 - mean(exp(kappa*cos(theta-mu)))/IoK; if(is.na(res)||is.infinite(res)){ print(pars); # assign(Theta, theta, env=.GlobalEnv); } return(res); } mse.Dk2- function(pars, s, n) { sum.est - SSE - numeric(2); j- 0; while(j=n){ theta- rvm(s, pi, k=pars[1]) - pi; est- optim(par=pars, fn=Dk2, lower=c(0.001, -pi), upper=c(10, pi), method=L-BFGS-B, theta=theta); i- 0; while(est$convergence!=0 i 30){ est- optim(par=est$par, fn=Dk2, lower=c(0.001, -pi), upper=c(10, pi), method=L-BFGS-B, theta=theta); i- i+1; } if(est$convergence!=0) { #print(j); next; } else { j- j+1; } #est- nlm(p=pars, f=Dk2, theta=theta); mu.hat- est$par[2]; while(mu.hat -pi) mu.hat- mu.hat + 2*pi; while(mu.hat pi) mu.hat- mu.hat -2*pi; est- c(est$par[1], mu.hat); sum.est - sum.est + est; SSE - SSE + (est - pars)^2; } Est - sum.est/n; Bias- Est - pars; MSE- SSE/n; res- c(Kappa=pars[1], Kappa.hat= Est[1], Kappa.Bias=Bias[1], Kappa.MSE=MSE[1], Mu.hat=Est[2], Mu.MSE=MSE[2]) return(res); } kappas - c(0.01, 0.05, 0.1, 0.20, 0.5, 1, 2, 5); N- 1; for ( s in c(5, 10, 20, 30, 50)){ cat(\nSample size = , s); cat(\n=\n); res- NULL; for(i in 1:8){ res- rbind(res, mse.Dk2(c(kappas[i], 0), s, N)); } print(round(res,4)); } #Error message. -32.7 is far lower then the lower limit 0.001. Sample size = 5 = [1] -32.736857 -3.141593 Error in optim(par = pars, fn = Dk2, lower = c(0.001, -pi), upper = c(10, : L-BFGS-B needs finite values of fn In addition: Warning messages: 1: NaNs produced in: besselI(x, nu, 1 + as.logical(expon.scaled)) 2: NaNs produced in: besselI(x, nu, 1 + as.logical(expon.scaled)) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] levelplot behaviour for panel with constants
On Thursday 21 August 2003 07:42, Edzer J. Pebesma wrote: In the example: x = rep(c(0,0,1,1),4) y = rep(c(0,1,0,1),4) z = c(1,0,1,0,0,0,1,1,0,1,0,0,1,1,1,1) f = as.factor(c(rep(a,4),rep(b,4),rep(c,4),rep(d,4))) levelplot(z~x+y|f,data.frame(x=x,y=y,z=z,f=f)) I noted that the last (d) plot remains empty. I guess the reason for this is that the values are constant (1), but I consider it more consistent if they would get the colour of 1, and would be left blank in case they were NA's. -- Edzer Redefining panel.levelplot as in the attached file should fix the problem. Deepayan panel.levelplot - function(x, y, z, zcol, subscripts, at = mean(z), shrink, labels = NULL, label.style = c(mixed, flat, align), contour = TRUE, region = TRUE, col = add.line$col, lty = add.line$lty, lwd = add.line$lwd, cex = add.text$cex, font = add.text$font, col.text = add.text$col, ..., col.regions) { label.style - match.arg(label.style) x - as.numeric(x[subscripts]) y - as.numeric(y[subscripts]) fullZrange - range(as.numeric(z), na.rm = TRUE) # for shrinking z - as.numeric(z[subscripts]) zcol - as.numeric(zcol[subscripts]) ## Do we need a zlim-like argument ? shrinkx - c(1, 1) shrinky - c(1, 1) if (!missing(shrink)) { if (is.numeric(shrink)) { shrinkx - rep(shrink, length = 2) shrinky - rep(shrink, length = 2) } else if (is.list(shrink)) { shrinkx - rep(shrink[[1]], length = 2) shrinky - rep(shrink[[1]], length = 2) if (x %in% names(shrink)) shrinkx - rep(shrink$x, length = 2) if (y %in% names(shrink)) shrinky - rep(shrink$y, length = 2) } else warning(Invalid shrink, ignored) } scaleWidth - function(z, min = .8, max = .8, zl = range(z, na.rm = TRUE)) { if (diff(zl) == 0) rep(.5 * (min + max), length(z)) else min + (max - min) * (z - zl[1]) / diff(zl) } if (any(subscripts)) { ## sorted unique values of x ux - sort(unique(x[!is.na(x)])) ## actual box boundaries (x axis) bx - c(3 * ux[1] - ux[2], ux[-length(ux)] + ux[-1], 3 * ux[length(ux)] - ux[length(ux)-1]) / 2 ## dimension of rectangles lx - diff(bx) ## centers of rectangles cx - (bx[-1] + bx[-length(bx)])/2 ## same things for y uy - sort(unique(y[!is.na(y)])) by - c(3 * uy[1] - uy[2], uy[-length(uy)] + uy[-1], 3 * uy[length(uy)] - uy[length(uy)-1]) / 2 ly - diff(by) cy - (by[-1] + by[-length(by)])/2 idx - match(x, ux) idy - match(y, uy) if (region) grid.rect(x = cx[idx], y = cy[idy], width = lx[idx] * scaleWidth(z, shrinkx[1], shrinkx[2], fullZrange), height = ly[idy] * scaleWidth(z, shrinky[1], shrinky[2], fullZrange), default.units = native, gp = gpar(fill=col.regions[zcol], col = NULL)) if (contour) { add.line - trellis.par.get(add.line) add.text - trellis.par.get(add.text) ux - as.double(ux) uy - as.double(uy) ord - order(x, y) m - z[ord] + 10e-12 ## some problems otherwise for (i in seq(along = at)) { val - .Call(calculateContours, m, ux, uy, as.double(at[i]), length(ux), length(uy), PACKAGE=lattice) if (length(val[[1]]) 3) { if (is.null(labels)) lsegments(val[[1]], val[[2]], val[[3]], val[[4]], col = col, lty = lty, lwd = lwd) else { if (label.style == flat) { slopes - (val[[4]] - val[[2]]) / (val[[3]] - val[[1]]) textloc - which(abs(slopes) == min(abs(slopes)))[1] ##skiploc - numeric(0) rotangle - 0 } else if (label.style == align) { rx - range(ux) ry - range(uy) depth - pmin( (val[[1]] + val[[3]] - 2 * rx[1])/diff(rx), (2 * rx[2] - val[[1]] - val[[3]])/diff(rx), (val[[2]] + val[[4]] - 2 * ry[1])/diff(ry), (2 * ry[2] - val[[2]] - val[[4]])/diff(ry)) textloc - which(depth == max(depth))[1]
Re: [R] automatic logging of commands
Prof. Ripley, Thank you for directing me to savehistory; that is what I needed. Apple's Darwin OS is derived from BSD UNIX, but it is not certified by SCO. I found a way to redirect all R standard input and output to a file with this command from a UNIX terminal: /usr/local/bin/R | tee filename.txt Unlike savehistory, that will not work on non-UNIX systems. David On 8/21/03 1:52p, Prof Brian Ripley [EMAIL PROTECTED] wrote: All commands are logged in the history file, if your `UNIX' (is that really a certified UNIX?) version of R supports history files. See e.g. ?savehistory. On Thu, 21 Aug 2003, David R. Bickel wrote: Is there an R function that automatically writes all input and output to a file? I would at least like it to log all the commands I enter, and to preferably also write the standard output to the file as well as to the screen. (The ideal would be to write the input to one file and both the input and output to another file.) I tried R2HTML for this, but I could not get it to work consistently. I am using a UNIX version of R: version _ platform powerpc-apple-darwin6.6 arch powerpc os darwin6.6 system powerpc, darwin6.6 status Patched major1 minor7.1 year 2003 month06 day 21 language R ___ http://www.mcg.edu/research/biostat/bickel.html David R. Bickel, Assistant Professor Medical College of Georgia Office of Biostatistics and Bioinformatics (706) 721-4697, 721-3785; Fax: 721-6294 [EMAIL PROTECTED] or [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Method of L-BFGS-B of optim evaluate function outside ofbox constraints
Hope this bug will be fixed in the future. Li On Wednesday 20 August 2003 15:44, Shengqiao Li wrote: Hi, R guys: I'm using L-BFGS-B method of optim for minimization problem. My function called besselI function which need non-negative parameter and the besselI will overflow if the parameter is too large. So I set the constraint box which is reasonable for my problem. But the point outside the box was test, and I got error. My program and the error follows. This program depends on CircStats package. Anyone has any idea about this? No idea... I can only say that a similar behaviour of optim with method=L-BFGS-B (i.e. evaluation of the function outside the lower/upper limits) has occurred to me too. It is a rare but possible behaviour. Last June, I have sent a full description of the problem to [EMAIL PROTECTED] Regards, Adelchi Azzalini -- Adelchi Azzalini [EMAIL PROTECTED] Dipart.Scienze Statistiche, Università di Padova, Italia http://azzalini.stat.unipd.it/ (please, no ms-word/ms-excel/alike attachments) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] automatic logging of commands
The piping UNIX command that I just suggested is better than nothing, but writes backspaces or other invisible characters to the file, sometimes in place of characters that were visible on the screen. Some kind of R command that writes everything that appears on the screen to a file would be better. David On 8/21/03 1:52p, Prof Brian Ripley [EMAIL PROTECTED] wrote: All commands are logged in the history file, if your `UNIX' (is that really a certified UNIX?) version of R supports history files. See e.g. ?savehistory. On Thu, 21 Aug 2003, David R. Bickel wrote: Is there an R function that automatically writes all input and output to a file? I would at least like it to log all the commands I enter, and to preferably also write the standard output to the file as well as to the screen. (The ideal would be to write the input to one file and both the input and output to another file.) I tried R2HTML for this, but I could not get it to work consistently. I am using a UNIX version of R: version _ platform powerpc-apple-darwin6.6 arch powerpc os darwin6.6 system powerpc, darwin6.6 status Patched major1 minor7.1 year 2003 month06 day 21 language R ___ http://www.mcg.edu/research/biostat/bickel.html David R. Bickel, Assistant Professor Medical College of Georgia Office of Biostatistics and Bioinformatics (706) 721-4697, 721-3785; Fax: 721-6294 [EMAIL PROTECTED] or [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] automatic logging of commands
On Thu, 21 Aug 2003, David R. Bickel wrote: The piping UNIX command that I just suggested is better than nothing, but writes backspaces or other invisible characters to the file, sometimes in place of characters that were visible on the screen. Under actual UNIX, that is not so: the characters in the file are those sent to the terminal. Perhaps your terminal does things you do not expect. Many decent UNIX terminal windows allow you to save their contents, BTW. Some kind of R command that writes everything that appears on the screen to a file would be better. You can always contribute one (see the R startup banner). Not that I think this is the job of a statistics package under UNIX, when other tools exist: you might also like to investigate ESS under Emacs, which can I believe do what you want. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Virus in Mail entdeckt / Virus found in the message
Absender Diese Nachricht wurde automatisch generiert von: Mail Scanner, Universitaet Osnabrueck, Rechenzentrum E-Mail: [EMAIL PROTECTED] Informationen Der Mail Scanner hat eine infizierte Mail entdeckt, die Ihre Absender-Adresse traegt. Diese Mail ist *nicht* an die Empfaenger weitergeleitet worden. Absender: [EMAIL PROTECTED] Empfaenger: [EMAIL PROTECTED] Virus-Beschreibung (englisch) Email data: MessageID: [EMAIL PROTECTED] From: [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: Subject: Re: Your application Scanning part [] Scanning part [movie0045.pif] Attachment validity check: passed. Virus identity found: W32/Sobig-F Massnahmen Moeglicherweise ist Ihre Absender-Adresse ohne Ihr Wissen verwendet worden. Sollte sich Ihr Rechner als viren-frei herausstellen, betrachten Sie diese Mail nur als Benachrichtigung, dass Viren unter missbraeuchlicher Verwendung Ihrer Absender-Adresse verschickt worden sind. In diesem Fall sind keine weiteren Massnahmen notwendig. Andernfalls pruefen Sie bitte den Datei-Anhang (Attachment) auf den gemeldeten Virus (Virus identity found), bevor Sie die Mail erneut versenden. Hinweise zur Desinfektion finden Sie auf der Heimatseite von Sophos unter http://www.sophos.com. Mit freundlichen Gruessen Mail Scanner, Universitaet Osnabrueck, Rechenzentrum E-Mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] how to specify format of floats for the output file
I'd like to write some numbers to an external file that looks pretty (e.g, decimal points aligned, same number of decimals). For example, if using sprintf(), %5.1f can be used to specify the format of the float to be printed on screen. How can I do the same if I want to write an output file instead? I have tried cat and write.table, but none of them worked so far. Thanks in advance, Ping __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] how to specify format of floats for the output file
sprintf() returns a character string that you then can write to file using cat() or some of its friends. Henrik Bengtsson Dept. of Mathematical Statistics @ Centre for Mathematical Sciences Lund Institute of Technology/Lund University, Sweden (+2h UTC) +46 46 2229611 (off), +46 708 909208 (cell), +46 46 2224623 (fax) h b @ m a t h s . l t h . s e, http://www.maths.lth.se/~hb/ On Thu, 21 Aug 2003 [EMAIL PROTECTED] wrote: I'd like to write some numbers to an external file that looks pretty (e.g, decimal points aligned, same number of decimals). For example, if using sprintf(), %5.1f can be used to specify the format of the float to be printed on screen. How can I do the same if I want to write an output file instead? I have tried cat and write.table, but none of them worked so far. Thanks in advance, Ping __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Importing data into R
On Thu, 21 Aug 2003, Gavrilov, Pavel M wrote: Hello. I have been working with GeoDA, and have created a spatial weights file for my data. I am now looking to use R to run regressions on this data. However, I don't know and can't figure out how to get my data into R to run these regressions. GeoDa spatial weights files may be read into R using the read.gal() and read.gwt2nb() functions in the contributed package spdep. These functions have been improved by the authors of GeoDa to play well with its output. read.geoda() in spdep is a wrapper for read.csv(). I have the data in many formats, from a .dbf file to an Excel spreadsheet, but I'm not sure how to go about importing it into R. Could you help me out please? Thanks. These more general questions are handled - as many have pointed out - in the data import/export manual: http://cran.r-project.org/doc/manuals/R-data.pdf Sincerely, Pavel Gavrilov [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] NOTICE - Attachments removed
Some of the files attached are blocked due to Telenor security policy and risk for virus. Filenames: document_all.pif The message was addressed to: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] comparing segments of a time series
Tony - I happen to have a copy of Erich L. Lehmann and H.J.M D'Abrera (1975) Nonparametrics: Statistical Methods based on Ranks. Holden-Day, SF, sitting beside me on my desk this afternoon. What you want is covered in Section 2.7L on pp. 104-105, titled Scale tests with unknown location. Lehmann says: As was pointed out in Ch. 1 Sec. 6, the assumption made there -- and in the preceding Secs. 7I and 7J -- that the two [samples] being compared measure the same quantity, often cannot be trusted. If xi and eta denote the quantities measured [in the two samples], it is then natural to estimate xi and eta by estimates, say, hat{xi} and hat{eta} and to apply the scale test to the adjusted observations X_1 - hat{xi} [etc]. The significance level of the resulting test will be affected by the substitution of hat{xi} and hat{eta} for xi and eta, but one may hope that the effect will not be serious and that asymptotically the significance level will retain its value. Conditions under which this is the case are given by Sukhatme (1958), Raghavachari (1965a) and Gross (1966). I don't think the situation has changed much in the ensuing 30 years. There probably isn't any exact test for your situation of unknown location. I highly recommend Lehmann as a reference, especially Section 1.6, pp. 32-34. - tom blackwell - u michigan medical school - ann arbor - On Thu, 21 Aug 2003, Tony Marlboro wrote: I have a time series of 38 wintertime average snow depths measured at a particular meteorological station. The data appear to undergo a climate shift in the early 1980s: before the shift the mean and sd are 152 +/- 58, after the shift 92 +/- 36. The distribution is not normal; there's a hard limit at zero of course and there are outlier years with very high snowfall. I don't feel justified making a log transformation on the data, so I'd rather use distribution-free methods. I would like to have statistical justification for the statement that the snow depth in the second period is less than in the first half, and that the variability decreased as well. For the difference in central measures, I am using the (unpaired) wilcox.test, but I really have no idea how to address the question of changes in variability using nonparametric means. Any ideas? Thanks, Tony __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Use of Second Monitor Question
On 21 Aug 2003 at 16:51, Uwe Ligges wrote: Slightly off-topic, but: we are about to buy a data show to put up permanent in an aula. All data shows I have seen use the monitor port directly, so the monitor is blacked out. Is it possible to have a set up where I can see both on the monitor and the audience the projection? From the answer to this Q, it seems that would work well with R. Kjetil Halvorsen Jed Diem wrote: In teaching I'd like to be able to display a R-graphics window on a wall projection display keeping the R-console on the computer monitor. And so I ask--- Is there a way to move a graphics window out of the Rgui window to a second monitor leaving the R Console window in the Rgui window on the first monitor? Either a Windows or Linux solution would be just fine. Linux: out of the box, Windows: Start RGui with option --sdi, or choose SDI mode in the menu (Edit - GUI preferences ...). Uwe Ligges --jed diem __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Diamond graphs
On Thu, 21 Aug 2003, Baize, Harold wrote: Richard A. O'Keefe [EMAIL PROTECTED] wrote: Someone mentioned the new Diamond Graphs invented at Johns Hopkins. I haven't see the August 2003 issue of The American Statistician yet, but I _have_ read the press release. Same here. The fact that someone would try to patent this strikes me as outrageous; the actual amount of novelty is so tiny. Miss out a lot of stuff here Less expensive and more practical would be to present the data in a two dimensional matrix (as proposed in the diamond) but not to use an odd shape to convey the third dimension. The third dimension could be represented by hue (color) or brightness (shade). I suspect that actual psychometric tests would show that color or other visual representations of density would be more accurate and reliable than their proposed solution which confounds area with shape. As a caveat, I have not read the American Statistician article. I will be surprised if they present data showing that users can more accurately perceive variation in the continuous variable through their odd shape solution in contrast to either color or shade. Since no-one so far has replied with a reference to Cleveland, I guess I will. Cleveland in Elements of Graphing Data reports on his experiments in graphical perception. He has examined the accuracy of decoding information which has been graphically encoded using various approaches. Colour hue, colour saturation and density (amount of black) are the poorest of all the approaches he considers, and rank below area and volume. The bias involved in using area and volume to represent numerical quantities is an additional complication which I believe Richard O'Keefe also mentioned. For those who are not aware of Cleveland's work, it would be fair to say that you see his influence (and that of others from Bell Labs) every time you ask R to produce a graph. David Scott _ David Scott Department of Statistics, Tamaki Campus The University of Auckland, PB 92019 AucklandNEW ZEALAND Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 Email: [EMAIL PROTECTED] Graduate Officer, Department of Statistics Webmaster, New Zealand Statistical Association: http://www.stat.auckland.ac.nz/nzsa/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] LDA in R: how to extract full equation, especially constant term
Hi, Having dipped my toe into R a few times over the last year or two, in the last few weeks I've been using it more and more; I'm now a thorough convert. I've just joined the list, because although it's great, I do have this problem... I'm using linear discriminant analysis for binary classification, and am happy with the classification performance using predict(). What I'd like to do now is extract the equation for this classifier, for use elsewhere (in Perl/Python code). I know that I can get the means and scaling factors from the predict() object, but I'm having trouble computing the constant term. From reading Venables Ripley and Hastie/Tibshirani/Friedman, I know the priors play a role in adjusting the cut-point from zero (for equally sized classes), based on the relative sizes of the two classes. But when I try to do the computation, I don't get a value that agrees with that returned by predict(). I've seen a post about this problem in the past, but it was never really answered by anyone who was familiar with R/S-PLUS. Can anyone help me with this? I guess I'm really wondering how R is computing the constant term in its discriminant function. Thanks, -Frank Gibbons PhD, Computational Biologist, Harvard Medical School BCMP/SGM-322, 250 Longwood Ave, Boston MA 02115, USA. Tel: 617-432-3555 Fax: 617-432-3557 http://llama.med.harvard.edu/~fgibbons __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] graphic widow overwrite
Hi, I am running a loop to plot multiple plots. In s-plus, it shows multiple pages in the graphic window to allow checking on each plot. but in R, the next plot always overwrite the previous one, so i can only have the last plot produced, is there a way to have multiple pages in the graphic window just like S-plus does? Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] graphic widow overwrite
No, I don't think so. That's a feature not implemented in R. - tom blackwell - u michigan medical school - ann arbor - On Thu, 21 Aug 2003, array chip wrote: I am running a loop to plot multiple plots. In s-plus, it shows multiple pages in the graphic window to allow checking on each plot. but in R, the next plot always overwrite the previous one, so i can only have the last plot produced, is there a way to have multiple pages in the graphic window just like S-plus does? Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] graphic widow overwrite
On Thu, 21 Aug 2003, array chip wrote: Hi, I am running a loop to plot multiple plots. In s-plus, it shows multiple pages in the graphic window to allow checking on each plot. but in R, the next plot always overwrite the previous one, so i can only have the last plot produced, is there a way to have multiple pages in the graphic window just like S-plus does? Under Windows you can turn on plot recording in the graphic window menu. -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] nls fitting inside a loop in S-Plus
Hi, this following problem is a S-Plus problem, I know many guys here are also experts in S-plus, so I am posting here, too. Thanks I encountered a weird problem of fitting nls inside a loop, it works well in R, but not in S-plus. The code is: data1-cbind(c(2.87,1.66,0.44,-0.78,-2.00,-3.21,-4.43,-5.65,2.87,1.66,0.44,-0.78,-2.00,-3.21,-4.43,-5.65),c(-0.69,-1.91,-3.13,-4.34,-5.56,-6.78,-7.99,-9.21,-0.69,-1.91,-3.13,-4.34,-5.56,-6.78,-7.99,-9.21)) data2-cbind(c(8.05,6.50,5.03,4.37,4.03,3.92,3.87,3.89,7.84,6.27,4.74,4.14,3.76,3.69,3.69,3.71),c(8.07,6.94,5.59,4.43,3.66,3.00,2.64,2.40,8.09,6.90,5.56,4.44,3.50,2.71,2.48,2.08)) par(mfrow=c(2,2)) for (i in 1:2) { conc-data1[,i] signal-data2[,i] fit-nls(signal~SSfpl(conc,A,B,xmid,scal)) p.conc-data.frame(conc=(1:99)*(max(conc)-min(conc))/100+min(conc)) plot(as.numeric(p.conc[,1]),as.numeric(predict(fit,newdata=p.conc)),type='l',col=4) } When the above code was run in R, it worked very well, but when it was run in S-plus, it gave me the following error: Problem in data.frameAux.list(x, na.strings = na.strings, stringsAsFactors ..: arguments imply differing number of rows: 4, 3, 2, 16, 4, 4, 4, 4, 16, 1, 1, 1, 1 Also, If I only run the loop for only 1 cycle (either No.1 or No.2 by setting for (i in 1:1) or for (i in 2:2)), the code worked ok in S-Plus, so the problem has nothing to do with my data. If I replace fit-nls(signal~SSfpl(conc,A,B,xmid,scal)) with fit-lm(signal~conc), then the code worked well in both R and S-Plus. So it seems the problem only pertain to the nls function. Can anyone pinpoint the problem for me? Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] graphic widow overwrite
You may prefer to use S-PLUS if it does precisely what you want. In R, you could use postscript() or pdf() to save all the graphs to a file and then view them at your leisure. There is always par(ask=TRUE) if you wanted to look at them on the screen. Regards, Andrew C. Ward CAPE Centre Department of Chemical Engineering The University of Queensland Brisbane Qld 4072 Australia [EMAIL PROTECTED] Quoting array chip [EMAIL PROTECTED]: Hi, I am running a loop to plot multiple plots. In s-plus, it shows multiple pages in the graphic window to allow checking on each plot. but in R, the next plot always overwrite the previous one, so i can only have the last plot produced, is there a way to have multiple pages in the graphic window just like S-plus does? Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Use of Second Monitor Question
On Thu, 21 Aug 2003 17:55:34 -0400, kjetil brinchmann halvorsen wrote: On 21 Aug 2003 at 16:51, Uwe Ligges wrote: Slightly off-topic, but: we are about to buy a data show to put up permanent in an aula. All data shows I have seen use the monitor port directly, so the monitor is blacked out. Is it possible to have a set up where I can see both on the monitor and the audience the projection? From the answer to this Q, it seems that would work well with R. Most reasonably new laptops allow the display to show in both places. (There may be limitations on the resolution to accommodate this.) The original question was about showing different things on each monitor: the console visible to the speaker, and graphics visible to the audience. I don't know of any PC laptops that do this, but I think some Macs can. At least that was my interpretation of a minor flap before a presentation at UWO where the projector showed the desktop and the laptop screen showed the stuff the audience was supposed to see. I think to do it on a desktop PC you just need to add an extra video card. Duncan Murdoch __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Use of Second Monitor Question
Duncan Murdoch [EMAIL PROTECTED] writes: Most reasonably new laptops allow the display to show in both places. (There may be limitations on the resolution to accommodate this.) Nearly any modern Windows laptop should be able to dual head (the LCD and the display panel/projector, as adjacent screens). The original question was about showing different things on each monitor: the console visible to the speaker, and graphics visible to the audience. I don't know of any PC laptops that do this, but I think some Macs can. At least that was my interpretation of a minor flap before a presentation at UWO where the projector showed the desktop and the laptop screen showed the stuff the audience was supposed to see. PC laptops definitely can, even under XFree86/Linux. (i.e. have the left portion of the display be on the LCD, the right portion on the external video-out (connected to a projector/display panel). It is easier to do this on Mac, of course. (it's useful for having notes on the LCD, while the presentation is on the projector, for example). For desktops, you can use 2 video cards (in which case one would usually be a PCI-based, and the other AGP, so the quality may be unequal), but many of the intermediate/expensive video cards ($90US and up, i.e. Radeon 9000) have dual outputs; for about $130 and up, you can actually find dual digitial outputs, which are very nice if you've got digital capable LCD monitors. (or want to do stereoscopic displays, which is why I care...). best, -tony -- A.J. Rossini [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW : FAX=206-543-3461 | moving soon to a permanent office FHCRC: 206-667-7025 FAX=206-667-4812 | Voicemail is pretty sketchy/use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] converting factor to numeric
Hola! The R FAQ says: 7.12 How do I convert factors to numeric? It may happen that when reading numeric data into R (usually, when reading in a file), they come in as factors. If f is such a factor object, you can use as.numeric(as.character(f)) to get the numbers back. More efficient, but harder to remember, is as.numeric(levels(f))[as.integer(f)] In any case, do not call as.numeric() or their likes directly. But trying to follow the advice: (this is without package method attached, but the results are the same with): First doing as one shouldn't: table( as.numeric(EdadC) ) 1 2 3 4 5 20 99 157 127 74 Doing as the FAQ says: table( as.numeric(as.character(EdadC)) ) character(0) Warning message: NAs introduced by coercion or: table( as.numeric(levels(EdadC))[as.integer(EdadC)] ) character(0) Warning message: NAs introduced by coercion ? Kjetil Halvorsen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] WorldSecure notification
A non-business-related attachment was removed from this message before it was delivered. Please use your personal mail account for this type of correspondence. If the attachment removed was a business necessity, please contact the PA HelpDesk at 701-3200. Thank You, Peter Ghosh IT Network Manager, IT Operations __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] converting factor to numeric
Kjetil - EdadC seems to have only five levels, anyway. What are those five levels ? Are they strings which it would make sense to interpret as numeric ? as.numeric() obviously thinks they are not. - tom blackwell - u michigan medical school - ann arbor - On Thu, 21 Aug 2003, kjetil brinchmann halvorsen wrote: 7.12 How do I convert factors to numeric? It may happen that when reading numeric data into R (usually, when reading in a file), they come in as factors. If f is such a factor object, you can use as.numeric(as.character(f)) to get the numbers back. More efficient, but harder to remember, is as.numeric(levels(f))[as.integer(f)] In any case, do not call as.numeric() or their likes directly. But trying to follow the advice: (this is without package method attached, but the results are the same with): First doing as one shouldn't: table( as.numeric(EdadC) ) 1 2 3 4 5 20 99 157 127 74 Doing as the FAQ says: table( as.numeric(as.character(EdadC)) ) character(0) Warning message: NAs introduced by coercion or: table( as.numeric(levels(EdadC))[as.integer(EdadC)] ) character(0) Warning message: NAs introduced by coercion Kjetil Halvorsen __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] subscript out of range message
Hi All: I was recently working with a dataset on arsenic poisoning. Among the variables in the dataset, I used the following three variables to produce crosstabulations (variable names: FOLSTAT, GENDER, ASBIN; all three were categorical variables, FOLSTAT denoted follow up status for the subjects and had seven levels, GENDER denoted sex (two levels: male,female), and ASBIN denoted binarized arsenic concentrations (two levels: 0.05, 0.05 denoting less than 0.05 mg/L and more than 0.05 mg/L respectively). To illustrate, I used the following code for crosstabulation: x - table(FOLSTAT,GENDER,ASBIN) # from the results, I then wanted to subset a table for the ASBIN value 0.05 I used the following code to subset the table: y - x[,,ASBIN=0.05] # When I do this, R throws an error message stating subscript out of range. However, it runs fine if I change the labels for my ASBIN variable from 0.05 and =0.05 to words like Nonexposed and Exposed respectively. I searched the archives and the documentations for this, but could not find a solution. I understand that sometimes it is more expressive to use expressions like 0.05 (or something similar) as headings in cross-tabulations. What was I doing incorrectly? Would greatly appreciate your insight. I use: R version: 1.7.1 OS: Windows XP Home TIA, Arin Basu __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] subscript out of range message
[EMAIL PROTECTED] wrote: Hi All: I was recently working with a dataset on arsenic poisoning. Among the variables in the dataset, I used the following three variables to produce crosstabulations (variable names: FOLSTAT, GENDER, ASBIN; all three were categorical variables, FOLSTAT denoted follow up status for the subjects and had seven levels, GENDER denoted sex (two levels: male,female), and ASBIN denoted binarized arsenic concentrations (two levels: 0.05, 0.05 denoting less than 0.05 mg/L and more than 0.05 mg/L respectively). To illustrate, I used the following code for crosstabulation: x - table(FOLSTAT,GENDER,ASBIN) # from the results, I then wanted to subset a table for the ASBIN value 0.05 I used the following code to subset the table: y - x[,,ASBIN=0.05] Two errors. 1) Your logical index won't work. For the second level of ASBIN, use x[,,2]. Since the third dimension of the table x has only 2 elements (one for each level of ASBIN), sending it a logical vector that is as long as your number of subjects (N) is only going to confuse it. It's going to run out of levels of table. And it did - subscript out of ... 1) Is this a cut-and-paste error? y - x[,,ASBIN=0.05] It won't work anyway, but for future reference, logical equals is ==, not =. In other words, == is a question, = is an assignment. Cheers Jason -- Indigo Industrial Controls Ltd. 64-21-343-545 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Reducing matrix dimension
Hi, I wonder whether someone can help me with this query. I have a 12(cols) by 9(rows) matrix X. I need to reduce this matrix so that it contains 'n' columns (eg. reduce X into a 3 by 9 matrix). What is the best method to do this in R? Thank you in advance for your help! Hannah __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] subscript out of range message
On Thu, 21 Aug 2003 [EMAIL PROTECTED] wrote: I was recently working with a dataset on arsenic poisoning. Among the variables in the dataset, I used the following three variables to produce crosstabulations (variable names: FOLSTAT, GENDER, ASBIN; all three were categorical variables, FOLSTAT denoted follow up status for the subjects and had seven levels, GENDER denoted sex (two levels: male,female), and ASBIN denoted binarized arsenic concentrations (two levels: 0.05, 0.05 denoting less than 0.05 mg/L and more than 0.05 mg/L respectively). To illustrate, I used the following code for crosstabulation: x - table(FOLSTAT,GENDER,ASBIN) # from the results, I then wanted to subset a table for the ASBIN value 0.05 I used the following code to subset the table: y - x[,,ASBIN=0.05] # When I do this, R throws an error message stating subscript out of range. However, it runs fine if I change the labels for my ASBIN variable from 0.05 and =0.05 to words like Nonexposed and Exposed respectively. I've tried to reproduce this behavior using R-1.7.1 on redhat 8.0 linux. I can come close: I can get an error message: subscript out of bounds, not out of range. Seems to me that the variable name and equals sign are ignored. I can use any variable name I like, even ones that aren't in my workspace. Seems that matching is done by position in the string of commas, not by the variable name, and I can only get the error message subscript out of bounds when I've goofed up the matching by position - for example, when I try to subscript the third dimension using a string value from dimnames(x)[[2]] or dimnames(x)[[1]]. Please try this again and see whether all the commas are there for matching by position. I think R ignores the presence of ASBIN= in your example above. - tom blackwell - u michigan medical school - ann arbor - I searched the archives and the documentations for this, but could not find a solution. I understand that sometimes it is more expressive to use expressions like 0.05 (or something similar) as headings in cross-tabulations. What was I doing incorrectly? Would greatly appreciate your insight. I use: R version: 1.7.1 OS: Windows XP Home TIA, Arin Basu __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Reducing matrix dimension
help(Subscript) On Fri, 22 Aug 2003 [EMAIL PROTECTED] wrote: Hi, I wonder whether someone can help me with this query. I have a 12(cols) by 9(rows) matrix X. I need to reduce this matrix so that it contains 'n' columns (eg. reduce X into a 3 by 9 matrix). What is the best method to do this in R? Thank you in advance for your help! Hannah __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] a pickle with ranks and reals?
I predicted that y would increase as x increased. However, I only made the prediction on the ranks of the scores. The ranks don't correlate with predicted. And, I don't think a regression on the ranks is warranted. However, the actual scores do yield a significant slope for b, and a significant R^2 using a linear regression (y is the value and x is the predicted rank). What should my argument be here? Should I have endorsed using the actual scores instead of ranks to begin for some reason that doesn't have anything to do with my current result? :) Oh, on another note, I can use rcorr to get the Spearman correlations, but I'd like to be able to just add the ranks as a column. I was going to just use order and add a simple factor. But, that doesn't deal with ties correctly. And, I also wanted to analyze correlations subject by subject and compare my two groups. However, there doesn't seem to be a good way to get this. I tried using by with cor. However, this requires binding x and y which causes cor to return a matrix (if you could pass it x and y separate it would just return a number). given data frame s x y subj 4 7 harry 5 1 harry 6 9 harry 2 4 steve 3 7 steve ... i'd like to be able to produce r subj .12 harry .52 steve ... any tips? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help