[R] two ggplot and colour=x question
Hi I am using ggplot with the aesthetic=list(..., colour=x, ...) ggplot() ggline() I have four different values in x (ren, cyn, mixed, bare) and I have two questions 1) I would like to assign specific colours to the values, i.e. green, red, blue and brown. How can I do this? I did not understand map_colour_brewer. 2) I don't want the legend top be plot. How can I disable the legend to be plotted? Thanks Rainer -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)86 516 2782 Fax:+27 - (0)21 808 3304 (w) Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] cohen kappa for two-way table
Dylan Beaudette wrote: Greetings, I am a bit confused by the results returned by the functions: cohen.kappa {concord} classAgreement {e1071} when using a two-way table. for example, if I have an matrix A, and a similar matrix B (same dimensions), then: matrix A and B can be found: http://casoilresource.lawr.ucdavis.edu/drupal/files/a_40.txt http://casoilresource.lawr.ucdavis.edu/drupal/files/b_40.txt A - matrix(unlist( read.table('a_40.txt'), use.names=FALSE), ncol=14) B - matrix(unlist( read.table('b_40.txt'), use.names=FALSE), ncol=14) If I interpret this correctly, you are considering the numbers in A and B to be nominal variables representing levels of some data attribute. What cohen.kappa wants is: 1(type=counts) a matrix of counts where each cell represents the number of methods (rows are different methods) that classified the data objects into levels (columns are different levels). 2(type=scores) a matrix of scores where each cell represents the level assigned by a method (rows again) to a data object (columns are data objects here). If your numbers are counts, you can get a sensible kappa for _each_ matrix. If your numbers are scores, you can get a sensible kappa by specifying type=scores for _each_ matrix As far as I can see, you are computing a sparsely populated table of the two matrices and passing that, and I don't see how that can give a meaningful result. I suspect that the numbers might be counts in the first place, but they are being used as scores. Secondly, when using the classAgreements() function I get different numbers: I'll let someone who knows more about the classAgreement function deal with this. Jim __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R2WinBUGS and calling WinBUGS in Crossover MAC BETA
Ben Bolker wrote: Kenneth Benoit kbenoit at tcd.ie writes: Hi there - I have a question for any of you who use R2WinBUGS to call WinBUGS using the useWINE option in that package. I have Codeweaver's Crossover emulator installed on my Intel Mac with WinBUGS working fine if I start it from Crossover. But there is supposed to be a way to start it directly from a command line, which I could pass to the R2WinBUGS using the bugs(..., useWINE=something) argument. Has anyone tried this yet? Thanks! useWINE=TRUE. You may have to set some environment variables (e.g. WINE is the path to your WINE executable). It's supposed to just work out of the box. I have some fixes that I've been meaning to upload to complement the existing stuff, but haven't. If you run into trouble drop me a line. Ben Bolker Many thanks for that quick reply. I have tried useWINE=TRUE but this does not work on the Mac. I am using CrossOver for Mac Beta (6.0.0b2). When I call: bugs(..., useWINE=TRUE, newWINE=TRUE) then I get this message: Error in if (!nchar(WINEPATH)) { : argument is of length zero I think the problem is that the command line call for cxoffice (similar to wine) is different on the Mac from the Linux version. For instance I have the following application bundles: /Applications/CrossOver.app/ ~/Applications/CrossOver/WinBUGS14.app but I cannot figure out how to start WinBUGS14.app from the command line. If I did then I could supply this command to bugs(..., WINE=). Best, Ken __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Switch and integer
I searched the help list and the manual, but I do not find my mistake. Switch is working with character , with integer, but not in the third example Regards Knut count1 - 0 test =c(3,9,3,9,3,9,8,9,8,9,8,9,3,9,3,9,5,9,3,9,1,2,7,9,3,9,1,1,2,2,3,9,2,1,2,5,9,8,9,1,2) count1 - 0 for (i in 1:length(test)) switch (EXPR=test[i], 5 = print(test[i]), 6 = print(test[i]), 7 = print(test[i]), 8 = print(test[i]), 9 = print(test[i]) ) count1 # example from helpfile for(i in c(-1:3,9)) print(switch(i, 1,2,3,4)) # not working test =c(3,9,3,9,3,9,8,9,8,9,8,9,3,9,3,9,5,9,3,9,1,2,7,9,3,9,1,1,2,2,3,9,2,1,2,5,9,8,9,1,2) count1 - 0 for (i in 1:length(test)) switch (EXPR=test[i], 4 = count1 - count1 +1, 5 = count1 - count1 +1, 6 = count1 - count1 +1, 7 = count1 - count1 +1, 8 = count1 - count1 +1 ) count1 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] barplot - how to force vertical axis to cover entire plot area
Hi, Etienne, I've seen this while working with barplot and never been able to understand the general rule, but by setting ylim high enough, I've always been able to draw a y axis covering the biggest values. Could you send a data subset to reproduce the issue? Thanks. Best, Ricardo -- Ricardo Rodríguez Your XEN ICT Team Etienne[EMAIL PROTECTED] 7/12/2006 01:43 I'm using barplot with the following call: barplot(stat_data[[5]][,],axes=TRUE,axisnames=TRUE,axis.lty=1,xlab=xlab,ylab=ylab,beside=TRUE,las=1,font.lab=2,font.axis=1,legend.text=TRUE) On some data, the vertical axis does not cover the whole plot area and the last tick mark is smaller than the maximum value. I tried setting the ylim values but even with that, some plots are still not OK, it just shrinks the length of the bars. Attached is a png example of the problem. I hope it gets through. Thanks, Etienne __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Switch and integer
From the help entry for switch: If the value of EXPR is an integer between 1 and nargs()-1 then the corresponding element of ... is evaluated and the result returned. So, for integers you don't give names to the elements in ... This should work: test=c(3,9,3,9,3,9,8,9,8,9,8,9,3,9,3,9,5,9,3,9,1,2,7,9,3,9,1,1,2,2,3,9,2,1,2,5,9,8,9,1,2) count1 - 0 for (i in 1:length(test)) switch(EXPR=test[i], NULL, NULL, NULL, count1 - count1 +1, count1 - count1 +1, count1 - count1 +1, count1 - count1 +1, count1 - count1 +1, NULL ) count1 On 11/12/06, Knut Krueger [EMAIL PROTECTED] wrote: I searched the help list and the manual, but I do not find my mistake. Switch is working with character , with integer, but not in the third example Regards Knut count1 - 0 test =c(3,9,3,9,3,9,8,9,8,9,8,9,3,9,3,9,5,9,3,9,1,2,7,9,3,9,1,1,2,2,3,9,2,1,2,5,9,8,9,1,2) count1 - 0 for (i in 1:length(test)) switch (EXPR=test[i], 5 = print(test[i]), 6 = print(test[i]), 7 = print(test[i]), 8 = print(test[i]), 9 = print(test[i]) ) count1 # example from helpfile for(i in c(-1:3,9)) print(switch(i, 1,2,3,4)) # not working test =c(3,9,3,9,3,9,8,9,8,9,8,9,3,9,3,9,5,9,3,9,1,2,7,9,3,9,1,1,2,2,3,9,2,1,2,5,9,8,9,1,2) count1 - 0 for (i in 1:length(test)) switch (EXPR=test[i], 4 = count1 - count1 +1, 5 = count1 - count1 +1, 6 = count1 - count1 +1, 7 = count1 - count1 +1, 8 = count1 - count1 +1 ) count1 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Switch and integer
Knut Krueger Knut-krueger at einthal.de writes: Switch is working with character , with integer, but not in the third example ... # not working test = c(3,9,3,9,3,9,8,9,8,9,8,9,3,9,3,9,5,9,3,9,1,2,7,9,3,9,1,1, 2,2,3,9,2,1,2,5, 9,8,9,1,2) count1 - 0 for (i in 1:length(test)) switch (EXPR=test[i], 4 = count1 - count1 +1, 5 = count1 - count1 +1, 6 = count1 - count1 +1, 7 = count1 - count1 +1, 8 = count1 - count1 +1 ) count1 switch has a different behavior when an integer is use, which is a bit hidden in the term corresponding. If the value of EXPR is an integer between 1 and nargs()-1 then the corresponding element of ... is evaluated and the result returned. So something like the example below might come close to what you want. In each case you have to add the default last item to avoid a NULL. In the case of no match, if there's a further argument in switch that one is returned, otherwise NULL. Dieter test =c(4,5,8,1,13) count1 - 0 for (i in 1:length(test)) { count1 - switch (EXPR=as.character(test[i]), 4 = count1 +1, 5 = count1 +1, 6 = count1 +1, 7 = count1 +1, 8 = count1 +1, count1 ) } count1 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Experimental Design with R
Erin: You may want to examine this PDF in the contributed documentation area of R-project: http://cran.r-project.org/doc/contrib/Vikneswaran-ED_companion.pdf -- Eric Rexstad Research Unit for Wildlife Population Assessment Centre for Research into Ecological and Environmental Modelling University of St. Andrews St. Andrews Scotland KY16 9LZ +44 (0)1334 461833 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] solving non linear system of eq
Paulino Perez Rodriguez perpdgo at colpos.mx writes: How can I solve a non linear system of equations using R? Have your tried to enter nonlinear equations into http://search.r-project.org? Dieter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] FW: R
Hi Ricky / AJ Progress of sorts. I got passed the last problem by looking at the makefiles but run in to the next one, see below. It has created files in /contrib/R-2.4.0. there is an R under /contrib/R-2.4.0/bin/R. Running it gives :- /contrib/R-2.4.0/bin/R R version 2.4.0 (2006-10-03) Copyright (C) 2006 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. *** caught segfault *** address 40b843f0, cause 'memory not mapped' Traceback: 1: .Call(La_dgesv, a, b, tol, PACKAGE = base) 2: solve.default(rgb) 3: solve(rgb) 4: drop(whitexyz %*% solve(rgb)) 5: make.rgb(red = c(0.625, 0.34), green = c(0.28, 0.595), blue = c(0.155, 0.07), gamma = 1.8, white = D65, name = Apple RGB) 6: eval(expr, envir, enclos) 7: eval(i, envir) 8: sys.source(codeFile, env, keep.source = keep.source) 9: try(sys.source(codeFile, env, keep.source = keep.source)) 10: loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) 11: try({ ns - loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) dataPath - file.path(which.lib.loc, package, data) env - attachNamespace(ns, pos = pos, dataPath = dataPath)}) 12: library(package, lib.loc = lib.loc, character.only = TRUE, logical = TRUE, warn.conflicts = warn.conflicts, keep.source = keep.source, version = version) 13: require(pkg, quietly = TRUE, warn.conflicts = FALSE, character.only = TRUE, save = FALSE) 14: .First.sys() Possible actions: 1: abort (with core dump) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Selection: 14 aborting ... Segmentation fault (core dumped) The make command fails with :- make[4]: Leaving directory `/contrib/R-2.4.0/src/library/grDevices/src' *** caught segfault *** address 4084b2f0, cause 'memory not mapped' Traceback: 1: .Call(La_dgesv, a, b, tol, PACKAGE = base) 2: solve.default(rgb) 3: solve(rgb) 4: drop(whitexyz %*% solve(rgb)) 5: make.rgb(red = c(0.625, 0.34), green = c(0.28, 0.595), blue = c(0.155, 0.07), gamma = 1.8, white = D65, name = Apple RGB) 6: eval(expr, envir, enclos) 7: eval(i, envir) 8: sys.source(codeFile, env, keep.source = keep.source) 9: try(sys.source(codeFile, env, keep.source = keep.source)) 10: loadNamespace(package, lib.loc, keep.source, TRUE, TRUE) 11: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source, compress = compress) 12: tools:::makeLazyLoading(grDevices) aborting ... /bin/sh: 18508 Memory fault(coredump) make[3]: *** [all] Error 139 make[3]: Leaving directory `/contrib/R-2.4.0/src/library/grDevices' make[2]: *** [R] Error 1 make[2]: Leaving directory `/contrib/R-2.4.0/src/library' make[1]: *** [R] Error 1 make[1]: Leaving directory `/contrib/R-2.4.0/src' make: *** [R] Error 1 Do not hold out much hope from mailing list, as they did not answer my last email, but have included it anyway. Cheers Derek Derek McPhee Information Services Queen's University Belfast e-mail [EMAIL PROTECTED] Tel 028 90973840 Fax 028 90975066 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Weighted averaging partial least squares regression
Hello, is it possible in R to calculate a Weighted averaging partial least squares regression? I'm not firm in statistics and didn't found anything about weighted averaging in combination with PLS in the help archives. Or is it possible to develop a workaround with the pls-package? thanks for help in advance Andreas Plank -- _ Dipl. Biol. Andreas Plank FU Berlin Institute of Geological Science Department Palaeontology Malteserstr. 74-100, House D 12249 Berlin Germany phone.: +49(0)30-83870-271 fax.: +49(0)30-83870-745 http://userpage.fu-berlin.de/~jevers/plank_a.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] FW: R
[EMAIL PROTECTED] wrote: Hi Ricky / AJ Progress of sorts. I got passed the last problem by looking at the makefiles but run in to the next one, see below. It has created files in /contrib/R-2.4.0. there is an R under /contrib/R-2.4.0/bin/R. Running it gives :- /contrib/R-2.4.0/bin/R R version 2.4.0 (2006-10-03) Copyright (C) 2006 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. *** caught segfault *** address 40b843f0, cause 'memory not mapped' Traceback: 1: .Call(La_dgesv, a, b, tol, PACKAGE = base) 2: solve.default(rgb) 3: solve(rgb) 4: drop(whitexyz %*% solve(rgb)) 5: make.rgb(red = c(0.625, 0.34), green = c(0.28, 0.595), blue = c(0.155, 0.07), gamma = 1.8, white = D65, name = Apple RGB) 6: eval(expr, envir, enclos) 7: eval(i, envir) 8: sys.source(codeFile, env, keep.source = keep.source) 9: try(sys.source(codeFile, env, keep.source = keep.source)) 10: loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) 11: try({ ns - loadNamespace(package, c(which.lib.loc, lib.loc), keep.source = keep.source) dataPath - file.path(which.lib.loc, package, data) env - attachNamespace(ns, pos = pos, dataPath = dataPath)}) 12: library(package, lib.loc = lib.loc, character.only = TRUE, logical = TRUE, warn.conflicts = warn.conflicts, keep.source = keep.source, version = version) 13: require(pkg, quietly = TRUE, warn.conflicts = FALSE, character.only = TRUE, save = FALSE) 14: .First.sys() Possible actions: 1: abort (with core dump) 2: normal R exit 3: exit R without saving workspace 4: exit R saving workspace Selection: 14 aborting ... Segmentation fault (core dumped) The make command fails with :- make[4]: Leaving directory `/contrib/R-2.4.0/src/library/grDevices/src' *** caught segfault *** address 4084b2f0, cause 'memory not mapped' Traceback: 1: .Call(La_dgesv, a, b, tol, PACKAGE = base) 2: solve.default(rgb) 3: solve(rgb) 4: drop(whitexyz %*% solve(rgb)) 5: make.rgb(red = c(0.625, 0.34), green = c(0.28, 0.595), blue = c(0.155, 0.07), gamma = 1.8, white = D65, name = Apple RGB) 6: eval(expr, envir, enclos) 7: eval(i, envir) 8: sys.source(codeFile, env, keep.source = keep.source) 9: try(sys.source(codeFile, env, keep.source = keep.source)) 10: loadNamespace(package, lib.loc, keep.source, TRUE, TRUE) 11: code2LazyLoadDB(package, lib.loc = lib.loc, keep.source = keep.source, compress = compress) 12: tools:::makeLazyLoading(grDevices) aborting ... /bin/sh: 18508 Memory fault(coredump) make[3]: *** [all] Error 139 make[3]: Leaving directory `/contrib/R-2.4.0/src/library/grDevices' make[2]: *** [R] Error 1 make[2]: Leaving directory `/contrib/R-2.4.0/src/library' make[1]: *** [R] Error 1 make[1]: Leaving directory `/contrib/R-2.4.0/src' make: *** [R] Error 1 Do not hold out much hope from mailing list, as they did not answer my last email, but have included it anyway. They might not have had enough information to go on (and r-devel had been a better target). Things like OS and computer versions. (I can't seem to find the earlier report though). Looks like you have broken lapack libraries, so you may want to upgrade them or override the selection made during the configure phase. Make sure to read http://cran.r-project.org/doc/manuals/R-admin.html and in particular Appendix A3 which discusses some of these issues. Cheers Derek Derek McPhee Information Services Queen's University Belfast e-mail [EMAIL PROTECTED] Tel 028 90973840 Fax 028 90975066 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] (no subject)
Want to start your own business? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Switch and integer
David Barron schrieb: If the value of EXPR is an integer between 1 and nargs()-1 then the corresponding element of ... is evaluated and the result returned. Thank you, I wondered about the integer between 1 and nargs()-1 and the example from the help file for(i in c(-1:3,9)) print(switch(i, 1,2,3,4)) No see I that the 1,2,3,4 is the output not the value, but it's not very clear for me ho it works. I will try to find it out ... The switch for Integer is very different from C++ or Pascal .. maybe this was the reason for the problem. Regards Knut __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] monte carlo simulation in R
i want to learn about monte carlo simulation in R, also about variance reduction techniques in monte carlo, especialy antithetic variates and control variates. can you give me an example of the code? or where i can find the journal or article or guide? thx for the answers... __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] upside down image/data
Dear R-community, I am looking for some simple advice - I have a matrix (therefore 2 dimensional) of global temperature. Having read R-help I think that when I ask R to image() or levelplot() my matrix will it actually appear upside down - I think I therefore need to use the line: levelplot(temperature.matrix[,ncol(output.temp):1], ) to get it looking like it was on the globe due to the matrix rows increasing in number down the matrix in its dimensions on longitude and latitude but the y-axis coordinates increase up the axis. Can anyone simply tell me whether this is correct as I find it very hard to know which way up my data should be and I cannot tell which is correct simply by looking at it! Many thanks for your time in reading this problem, Jenny Barnes ~~ Jennifer Barnes PhD student - long range drought prediction Climate Extremes Department of Space and Climate Physics University College London Holmbury St Mary, Dorking Surrey RH5 6NT 01483 204149 07916 139187 Web: http://climate.mssl.ucl.ac.uk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Small Rcmdr issue
Dear Alan, I've noticed that problem too, and have no idea why it happens. The function that's executed when you select Exit - From Commander and R is pretty simple: closeCommanderAndR - function(){ response - closeCommander() if (response == cancel) return() cat(\n) quit(save=no) } If anyone knows how I can fix the problem, I'd be happy to so do. Regards, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Jackson Sent: Sunday, December 10, 2006 11:21 PM To: r-help@stat.math.ethz.ch Subject: [R] Small Rcmdr issue Just installed Rcmdr on a Linux box. When I exit from both Rcmdr and R together from the regular Rcmdr exit menu, it leaves my xterm with stty -echo, so that nothing that is typed appears. If I exit only Rcmdr, and then exit R normally, everything is okay (stty echo). Other than that minor irritant, everything seems to work just fine. Linux 2.6.16-gentoo-r3 Athlon 64 X2 3800+ R version 2.4.0 (2006-10-03) Rcmdr Version 1.2-5 -- -- - | Alan K. Jackson| To see a World in a Grain of Sand | | [EMAIL PROTECTED] | And a Heaven in a Wild Flower, | | www.ajackson.org | Hold Infinity in the palm of your hand | | Houston, Texas | And Eternity in an hour. - Blake | __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Small Rcmdr issue
John Fox wrote: Dear Alan, I've noticed that problem too, and have no idea why it happens. The function that's executed when you select Exit - From Commander and R is pretty simple: closeCommanderAndR - function(){ response - closeCommander() if (response == cancel) return() cat(\n) quit(save=no) } If anyone knows how I can fix the problem, I'd be happy to so do. I think I've seen this outside Rcmdr too, possibly with R-g tk but I can't seem to reproduce it now. I don't think it's your problem, but if you get a handle on where the issue lies, please let us know. (Of course, you can always just reset the terminal or blind-type stty sane, but it would be nicer to get rid of the issue altogether). -p Regards, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alan Jackson Sent: Sunday, December 10, 2006 11:21 PM To: r-help@stat.math.ethz.ch Subject: [R] Small Rcmdr issue Just installed Rcmdr on a Linux box. When I exit from both Rcmdr and R together from the regular Rcmdr exit menu, it leaves my xterm with stty -echo, so that nothing that is typed appears. If I exit only Rcmdr, and then exit R normally, everything is okay (stty echo). Other than that minor irritant, everything seems to work just fine. Linux 2.6.16-gentoo-r3 Athlon 64 X2 3800+ R version 2.4.0 (2006-10-03) Rcmdr Version 1.2-5 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] organizing stats from a list of models
Hi there, I have a list of models (about 600 glm models) and I included the prefix mod_ on their name. Now I would like retrieve the list from the R environment and save their AICs (and other info) on a table. I´m trying something like: - y-runif(20,min=0,max=1) x1-runif(20,min=0,max=1) x2-runif(20,min=0,max=1) mymod_1 -glm(y~x1) mymod_2-glm(y~x2) mymod_3-glm(y~x1+x2) model.list-ls(pat=mymod_) model.list [1] mymod_1 mymod_2 mymod_3 - Now I would like have something like model_name call AIC mymod_1 glm(y~x1) 13.11942 mymod_2 glm(y~x2) 13.11942 mymod_3 glm(y~x1+x2) 13.11942 How can I do that? All the best, Miltinho - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Getting DataFrame Name from Text String
Hi, I have the following simple function Testfunc = function(x) { Test = subset(x, var1 = 1000) } Suppose I have a dataframe «dat1» then the command Testfunc(dat1) gives a correct result. The problem is that the name of dataframe to be used in the function can be found in a vector (Dfname). The value of the vector can change in eg. Dfname = « dat1 » Or Dfname = « dat2 » Or ... How can I pass this string into the function so that the correct database is used. Thx for helping me out. Bert __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] two ggplot and colour=x question
I am using ggplot with the aesthetic=list(..., colour=x, ...) ggplot() ggline() I have four different values in x (ren, cyn, mixed, bare) and I have two questions 1) I would like to assign specific colours to the values, i.e. green, red, blue and brown. How can I do this? I did not understand map_colour_brewer. There's not really an easy way to do this at the moment. However, you can create a new variable containing the colours you want to use and then use a manual scale so they aren't converted automatically: df$colour - c(red,blue,yellow,orange)[df$myvar] p - ggplot(data=df, aes=list(x=x,y=y,colour=colour) scmanual(p, colour) 2) I don't want the legend top be plot. How can I disable the legend to be plotted? If you use a manual scale (as above) there won't be a legend, or more generally you can do: p$legend.position - none to turn of the legend (see ?ggopt for other options) Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] filled.contour and NA's
I'm trying to do a filled.contour plot where some points are labelled as NA. How do I could plot this kind of graphics, so NA points are coloured black, keeping the levels of remaining points. NA's values represent land points (meaningless), and what I want to plot is the levels of a variable over the sea. You can also do this using ggplot, although you don't have quite as much control over the appearance of the contours (you do get more control over other things) install.packages(ggplot, dep=T) library(ggplot) # Set up appropriate data structure dimnames(ene) - list(y, x) names(dimnames(ene)) - c(y, x) enem - melt(ene) p - ggplot(na.omit(enem), aes=list(x=x, y=y, z=value, fill=value)) p - ggtile(p) p - ggcontour(p) scfillgradient(p) scfillgradient(p, low=white, high=blue) Regards, Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] two ggplot and colour=x question
Thanks a lot for your help - I'll try it out and let you know if I still have problems. Rainer hadley wickham wrote: I am using ggplot with the aesthetic=list(..., colour=x, ...) ggplot() ggline() I have four different values in x (ren, cyn, mixed, bare) and I have two questions 1) I would like to assign specific colours to the values, i.e. green, red, blue and brown. How can I do this? I did not understand map_colour_brewer. There's not really an easy way to do this at the moment. However, you can create a new variable containing the colours you want to use and then use a manual scale so they aren't converted automatically: df$colour - c(red,blue,yellow,orange)[df$myvar] p - ggplot(data=df, aes=list(x=x,y=y,colour=colour) scmanual(p, colour) 2) I don't want the legend top be plot. How can I disable the legend to be plotted? If you use a manual scale (as above) there won't be a legend, or more generally you can do: p$legend.position - none to turn of the legend (see ?ggopt for other options) Hadley -- Rainer M. Krug, Dipl. Phys. (Germany), MSc Conservation Biology (UCT) Department of Conservation Ecology and Entomology University of Stellenbosch Matieland 7602 South Africa Tel:+27 - (0)72 808 2975 (w) Fax:+27 - (0)86 516 2782 Fax:+27 - (0)21 808 3304 (w) Cell: +27 - (0)83 9479 042 email: [EMAIL PROTECTED] [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] organizing stats from a list of models
I have a list of models (about 600 glm models) and I included the prefix mod_ on their name. Now I would like retrieve the list from the R environment and save their AICs (and other info) on a table. I´m trying something like: I have some (rather un)tested code: findmodels - function(modeltype = lm, dataset, pattern) { ls - ls(.GlobalEnv, pattern=pattern) mods - ls[sapply(ls, function(x) inherits(get(x), modeltype))] if (!missing(dataset)) { data.name - function(x) as.character(x$call[[data]]) mods - mods[sapply(mods, function(x) data.name == dataset)] } models - lapply(mods, get) class(models) - c(ensemble, class(models)) models } summary.ensemble - function(object, ...) { fits - data.frame(t(sapply(object, function(mod) { sum - summary(mod) c( df = .df(mod), logL = logLik(mod), AIC = -AIC(mod), BIC = -AIC(mod, k=log(length(fitted(mod, R2 = sum$r.squared, adjR2 = sum$adj.r.squared ) }))) fits$model - factor(names(object)) rownames(fits) - paste(m, fits$model, sep=) fits } Hopefully that should give you an idea on how to proceed. Regards, Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Weighted averaging partial least squares regression
Quoting Andreas Plank [EMAIL PROTECTED]: Hello, is it possible in R to calculate a Weighted averaging partial least squares regression? I'm not firm in statistics and didn't found anything about weighted averaging in combination with PLS in the help archives. Or is it possible to develop a workaround with the pls-package? Nothing in R that is publicly available. It is certainly possible to modify the pls package (I did so for package cocorresp, but that does something slightly different to what you want). Steve Juggins is writing an R package that includes WA-PLS, you might wish to contact him to see if there is an early version available that you might use. His University web pages are here: http://www.campus.ncl.ac.uk/staff/Stephen.Juggins/ And you'll find his email address on them. HTH Gavin Simpson thanks for help in advance Andreas Plank -- _ Dipl. Biol. Andreas Plank FU Berlin Institute of Geological Science Department Palaeontology Malteserstr. 74-100, House D 12249 Berlin Germany phone.: +49(0)30-83870-271 fax.: +49(0)30-83870-745 http://userpage.fu-berlin.de/~jevers/plank_a.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Getting DataFrame Name from Text String
consider get or as.name __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] DOE teaching suggestions?
Hi, Erin: Also, have you seen the BHH2 package, companion to Box, Hunter and Hunter (2005) Statistics for Experimenters, 2nd ed. (Wiley)? Hope this helps. Spencer Graves Are you planning to have them design and conduct an actual physical experiment as part of the class? You may know that Bill Hunter (the second Hunter of Box, Hunter Hunter) wrote articles about doing this, and I found it extremely helpful. Things happen with real physical experiments that can't be duplicated with any kind of computer simulation. I think I've gotten good results assigning team projects of their own choosing. I found it necessary to have design review presentations in the middle of the class. These presentations give you feedback on their understanding of the class material to that date. They also give you an opportunity to suggest improvements before they actually do the experiment. This is not what you asked, but I hope you find it useful, anyway. Best Wishes, Spencer Graves Erin Hodgess wrote: Dear R People: I will be teaching an undergraduate Design of Experiments class in the Spring Semester. It will be very much an applied course. My question, please: has anyone used R for a course like this, please? I've tried Rcmdr for a regression course and just plain command line for a time series course. Should I use Rcmdr, or teach them to use the command line, OR is there something else, please? Thanks in advance! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] double boostrap with clusterApplyLB
Dear R-Users, we are using a linux-cluster with RMPI and the snow package. We would like to do a double boostrap. We have a general function that implements the first boostrap (the outer) and we are wondering if we can include another bootstrap (the inner) in the same general function including another clusterApplyLB. For example: general function = function(...) { clusterApplyLB(cl, fun,...) } where fun is the function for the inner boostrap outer bootstrap = clusterApplyLB(cl,general function,...) Does R accept this kind of expression? Thank you very much in advance, Michela and Marco __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to write a two-way interaction as a random effect in a lmer model?
Dear All, I am working with linear mixed-effects models using the lme4 package in R. I created a model with the lmer function including some main effects, a two-way interaction and a random effect. Now I am searching how I could incorporate an interaction between the random effect and one of the fixed effects. I tried to express the interaction in: recap_random3-lmer(breath~handling+stress+stress:handling+(1|rnr)+(0|rn r:stress)) however R gives me the following error message : Error in eval(expr, envir, enclos) : fl[[2]] must be a factor of length 1744 In addition: Warning messages: 1: numerical expression has 1744 elements: only the first used in: rnr:stress 2: numerical expression has 1744 elements: only the first used in: rnr:stress If I fit this model in SPSS, this gives me output, but I don't know whether I can trust that. Therefore I went to look for an alternative: After looking at the help function in R for lmer I deduced these models. Examples from R (fm1 - lmer(Reaction ~ Days + (Days|Subject), sleepstudy)) (fm2 - lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject), sleepstudy)) anova(fm1, fm2) My models would then look like this: recap_random0-lmer(breath~handling+stress (1|rnr)) recap_random1-lmer(breath~handling+stress (1|rnr)+(0+stress|rnr)) However, I do not know how to interpret the results. Does the model see stress|rnr as an interaction between stress and rnr, or did it take stress nested in rnr. summary(recap_random1) Linear mixed-effects model fit by REML Formula: breath ~ handling + stress + stress:handling + (1 | rnr) + (0 + stress | rnr) AIC BIC logLik MLdeviance REMLdeviance 9748 9781 -4868 9719 9736 Random effects: Groups NameVariance Std.Dev. rnr (Intercept) 55.6711 7.4613 # BUT rnr stress 15.2805 3.9090 # Does this output line express the interaction??? Residual 7.4567 2.7307# If not, how should the interaction output look like? number of obs: 1744, groups: rnr, 217; rnr, 217 Fixed effects: Estimate Std. Error t value (Intercept) 28.164471 0.716359 39.32 handling 0.012477 0.0123301.01 stress 0.636979 0.4160111.53 Correlation of Fixed Effects: (Intr) hndlng stress handling-0.645 stress -0.517 0.667 Could anybody please give me an advice how to solve this problem? Which way is correct to express interaction in the random factors? How should the output look like? Thank you in advance, Eva Fucikova Msc. Eva Fucikova Netherlands Institute of Ecology (NIOO-KNAW) PO Box 40 ZG Heteren The Netherlands tel.: +31 (0)26 4791248 Email:[EMAIL PROTECTED] *** [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Difference in outputs of random mixed effect models (lmer function)
Dear all, I am using lme4 library (lmer function) for random mixed effect model. I came across different outputs using R versions 2.2.1 and 2.4.0. I am not sure whether it is due to new version of R or that of lme4 library. I am looking forward to know which version of R and lme4 library will give me the correct outputs. Best wishes, Syed M. Jamal Utrecht University - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] similarity test with R
x=c(3.05176E-05,0.000457764,0.003204346,0.0138855,0.04165649,0.09164429,0.1527405,0.1963806,0.1963806,0.1527405,0.09164429,0.04165649,0.0138855,0.003204346,0.000457764,3.05176E-05) y=c(0.306,0.0004566,0.0031985,0.0139083,0.0415539,0.0917678,0.1528134,0.1962831,0.1962994,0.1527996,0.0917336,0.0415497,0.0139308,0.0031917,0.0004529,0.301) I tried chisq.test, t-test, prop.test, etc, but the p-value is very high, which is not 'statistically significant'. With these data sets, I want to compare the similarity, which it is very close to identical if you plot them.I am wondering if there is any test that can verify the similarity of the two data sets. thx much ej __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] similarity test with R
Ethan Johnsons wrote: x=c(3.05176E-05,0.000457764,0.003204346,0.0138855,0.04165649,0.09164429,0.1527405,0.1963806,0.1963806,0.1527405,0.09164429,0.04165649,0.0138855,0.003204346,0.000457764,3.05176E-05) y=c(0.306,0.0004566,0.0031985,0.0139083,0.0415539,0.0917678,0.1528134,0.1962831,0.1962994,0.1527996,0.0917336,0.0415497,0.0139308,0.0031917,0.0004529,0.301) I tried chisq.test, t-test, prop.test, etc, but the p-value is very high, which is not 'statistically significant'. With these data sets, I want to compare the similarity, which it is very close to identical if you plot them.I am wondering if there is any test that can verify the similarity of the two data sets. thx much http://finzi.psych.upenn.edu/R/Rhelp02a/archive/82001.html library(equivalence) ej __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 512-0171 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Getting DataFrame Name from Text String
Hello, I think assign() makes a better job Regards, Carlos. On 12/11/06, Vladimir Eremeev [EMAIL PROTECTED] wrote: consider get or as.name __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] lmer message
Dear All, I am using lmer to fit a glmm model using the PQL approximation. My data is not a Bernoulli (0/1) but a binomial one. The first thing I noticed is that the method gives me the approximated covariance matrix for the random effects but nothing about the residuals. In addition, I have the following estimation that I do not know what deos it mean: Estimated scale (compare to 1 ) 75043946. However, when I use the glmmPQL method to fit this model then the problem doesn't arise, i.e. I have the estimated covariance matrix for the random effects as well as the standard deviation of the residuals. I would be very grateful for any comments and/or explanation. Thank you in advance, Bernard - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] DOE teaching suggestions?
Hi, Erin: Also, have you seen the BsMD package (Bayes Screening and Model Discrimination), also discussed in Box Hunger and Hunter (2005). Spencer Graves ## Also, have you seen the BHH2 package, companion to Box, Hunter and Hunter (2005) Statistics for Experimenters, 2nd ed. (Wiley)? Hope this helps. Spencer Graves Are you planning to have them design and conduct an actual physical experiment as part of the class? You may know that Bill Hunter (the second Hunter of Box, Hunter Hunter) wrote articles about doing this, and I found it extremely helpful. Things happen with real physical experiments that can't be duplicated with any kind of computer simulation. I think I've gotten good results assigning team projects of their own choosing. I found it necessary to have design review presentations in the middle of the class. These presentations give you feedback on their understanding of the class material to that date. They also give you an opportunity to suggest improvements before they actually do the experiment. This is not what you asked, but I hope you find it useful, anyway. Best Wishes, Spencer Graves Erin Hodgess wrote: Dear R People: I will be teaching an undergraduate Design of Experiments class in the Spring Semester. It will be very much an applied course. My question, please: has anyone used R for a course like this, please? I've tried Rcmdr for a regression course and just plain command line for a time series course. Should I use Rcmdr, or teach them to use the command line, OR is there something else, please? Thanks in advance! Sincerely, Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Solution of Rcmdr Problem in Quantian OS, Thanks...
As you know, i have problem about Rcmdr in the 2.4.0 version of R, it can't be run properly in Quantian due to that Tcl/Tk does not support it. But, now, with helps from Dirk Eddelbuettel, problem was solved. The solution is just that reinstallation of R from debian packages not by compiling of 2.4.0 version source code. During the process, i noticed a srange thing, that is, if i start R in root user mode, result is: R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.0 (2005-04-18), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. Loading Tcl/Tk interface ... Xlib: connection to :0.0 refused by server Xlib: No protocol specified Error in fun(...) : this isn't a Tk applicationcouldn't connect to display :0.0 Error: .onLoad failed in 'loadNamespace' for 'tcltk' Fatal error: unable to restore saved data in .RData [EMAIL PROTECTED]:/home/mutlay/r# So, console kick me out of R. But in ordinary user mode, there is no problem and with capabilities() command all of them are TRUE: R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.0 (2005-04-18), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. Loading Tcl/Tk interface ... done [Previously saved workspace restored] capabilities() jpeg pngtcltk X11 http/ftp sockets libxml fifo TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE cledit IEEE754iconv TRUE TRUE TRUE Unfortunately, i can't interpret this case. If it is possible, i expect some comments on this case. Thanks to Dirk... Sincerely -- Ýbrahim Mutlay [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R and LaTeX
David Kaplan [EMAIL PROTECTED] wrote: Hi all, I have started using LaTeX for writing papers and I have heard that R works well with LaTeX. I'm specifically interested in how I can have LaTeX read in R generated graphics - for example graphs formed by matplot, or other such processes. Does anyone out there use LaTeX and can point me in the right direction? David David-- The basic paradigm is to save the graph from R in encapsulated Postscript format. The procedure can vary slightly by the OS you are using R under. Under Windows, I usually generate the graphics in the windows() device, then use savePlot to save it to eps. In Latex, you can put \usepackage{graphicx} in the document preamble and something like \begin{figure}[!th] \includegraphics[height=8in]{figurename.eps}\\ \end{figure} into the text to put the figure in a float. To put in exactly where the statement occurs, omit putting it into a figure environment. HTH, --Mike -- Mike Prager, NOAA, Beaufort, NC * Opinions expressed are personal and not represented otherwise. * Any use of tradenames does not constitute a NOAA endorsement. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] set up directory for R when I start R
Dieter Menne [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Aimin Yan aiminy at iastate.edu writes: I want to set default directory for R when I start R. How to do this? ?setwd In Windows, I prefer the method described in http://tolstoy.newcastle.edu.au/R/help/00b/2454.html I learned a similar trick by using Regedit to set the registry keys directly. (Years ago someone showed me this trick to start a DOS session). Apparently, either \Directory\shell or \Folder\shell do the same thing. Do you know if there is a difference? I checked and your suggestion can be modified to even specify a http_proxy, if needed: For example, this works for me under Windows XP, including the proxy server, from any directory chosen using Windows Explorer: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Folder\shell\R\command] @=C:\\Program Files\\R\\R-2.4.0\\bin\\Rgui.exe http_proxy=http://proxy01:8080 http_proxy_user=ask --- The above was the exported registry key from what I set manually using RegEdit. I used simply R instead of Run R, like you suggested. efg Earl F. Glynn Bioinformatics Stowers Institute for Medical Research __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Cannot scale my map
Dear list, I have the following problem: I want to plot my data and display a map at the same graph. The problem is that my map is not properly sized (is very small). It appears at the bottom-left side of the output. I am using the following R commands: { plot(Time, col=lightgrey) title(Connections per Minute) map(world, fill=TRUE, lwd=0.25, col=green, add=TRUE) box() } Please note that Time contains data in the following format: 00:00 00:01 ... 22:04, etc. Can you please help me? many thanks in advance, Mihalis. --- Show me a Mac user, and I 'll show you a creative user. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] behavior of ewma function
I have the ewma function as shown below. I think I copied it from an oldSplus help page on filter and then modified it with a lot of help from Achim. ewma-function(x,lambda = 1, init = x[1]) { rval-filter(lambda*coredata(x),filter=(1-lambda),method=recursive,ini t=init) rval-zoo(coredata(rval),index(x)) rval } It sort of works but , if there are NA values in the input series such as x-c(NA,2,3,4,5,NA,6,7,8,9,10,11,12,13,14,15) y-ewma(x,.01) y 1 2 3 4 5 6 7 8 9101112131415 16 0.000 0.020 0.0498000 0.0893020 0.1384090 NA 0.000 0.070 0.1493000 0.2378070 0.3354289 0.4420746 0.5576539 0.6820774 0.8152566 0.9571040 So, ewma starts off with a zero if there is an NA and this is misleading in terms of the exponentially weighted moving average numbers calculated going forward. Maybe this has something to do Woth the fact that I set init equal x[1] ? The NA in the 6th spot is fine but is there any way to 1) return an NA value when the input into the series is an NA ? 2) start the exponentially weighted moving average at the next non NA value ? So, essentually, for the example above, I would prefer the output to be NA, 2, 2*.01 + .99*3 = 2.99, 2.99*.01 + .99*4 = 3.9899, 3.9899*.01+ 0.99*5 = 4.989, 4.989 ( because of the NA ), 4.989*.01 + 0.99* 6 = 5.989 etc. This might be too complex to get but atleast is it possible to get NA where the inputs were NA and not use zeros for smoothing going forward ? Thanks. P.S : The code in ewma may look a little different than one is used to but that is because it is sometimes run with The inputs being zoo objects so coredate and index are needed. This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] behavior of ewma function
I just had an idea but I'm not sure how to do it. Create a non NA series ( which I can do ) and smooth that series ( whh I can do ). Then, after that smoothed series is created, put the NAs back into the smoothed series in their appropriate places ( which I don't know how to do ). If anyone does know how to do that, the help would be appreciated. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Leeds, Mark (IED) Sent: Monday, December 11, 2006 3:15 PM To: r-help@stat.math.ethz.ch Subject: [R] behavior of ewma function I have the ewma function as shown below. I think I copied it from an oldSplus help page on filter and then modified it with a lot of help from Achim. ewma-function(x,lambda = 1, init = x[1]) { rval-filter(lambda*coredata(x),filter=(1-lambda),method=recursive,ini t=init) rval-zoo(coredata(rval),index(x)) rval } It sort of works but , if there are NA values in the input series such as x-c(NA,2,3,4,5,NA,6,7,8,9,10,11,12,13,14,15) y-ewma(x,.01) y 1 2 3 4 5 6 7 8 9101112131415 16 0.000 0.020 0.0498000 0.0893020 0.1384090 NA 0.000 0.070 0.1493000 0.2378070 0.3354289 0.4420746 0.5576539 0.6820774 0.8152566 0.9571040 So, ewma starts off with a zero if there is an NA and this is misleading in terms of the exponentially weighted moving average numbers calculated going forward. Maybe this has something to do Woth the fact that I set init equal x[1] ? The NA in the 6th spot is fine but is there any way to 1) return an NA value when the input into the series is an NA ? 2) start the exponentially weighted moving average at the next non NA value ? So, essentually, for the example above, I would prefer the output to be NA, 2, 2*.01 + .99*3 = 2.99, 2.99*.01 + .99*4 = 3.9899, 3.9899*.01+ 0.99*5 = 4.989, 4.989 ( because of the NA ), 4.989*.01 + 0.99* 6 = 5.989 etc. This might be too complex to get but atleast is it possible to get NA where the inputs were NA and not use zeros for smoothing going forward ? Thanks. P.S : The code in ewma may look a little different than one is used to but that is because it is sometimes run with The inputs being zoo objects so coredate and index are needed. This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Multiple Imputation / Non Parametric Models / Combining Results
At 08:12 08/12/2006, Simon P. Kempf wrote: Dear R-Users, The following question is more of general nature than a merely technical one. Nevertheless I hope someone get me some answers. I am in no sense an expert in this area but since it seems that noone else has answered so far; I wonder whether the mitools package from CRAN helps? I have been using the mice package to perform the multiple imputations. So far, everything works fine with the standard regressions analysis. However, I am wondering, if it is theoretically correct to perform nonparametric models (GAM, spline smoothing etc.) with multiple imputed datasets. If yes, how can I combine the results in order to show the uncertainty? In the research field of real estate economics, the problem of missing data is often ignored respectively unmentioned. However, GAM, spline smoothing etc. become increasingly popular. In my research, I would like to use multiple imputed datasets and GAM, but I am unsure how present single results. Again I want to apologize that this is a rather theoretical statistical question than a technical question on R. Thanks in advance for any hints and advices. Simon Simon P. Kempf Dipl.-Kfm. MScRE Immobilienökonom (ebs) Wissenschaftlicher Assistent Büro: IREBS Immobilienakademie c/o ebs Immobilienakademie GmbH Berliner Str. 26a 13507 Berlin Privat: Dunckerstraße 60 10439 Berlin Mobil: 0176 7002 6687 Email: mailto:[EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] Michael Dewey http://www.aghmed.fsnet.co.uk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Cannot scale my map
On Tuesday 12 December 2006 09:07, Mihalis Tsoukalos wrote: Dear list, I have the following problem: I want to plot my data and display a map at the same graph. The problem is that my map is not properly sized (is very small). It appears at the bottom-left side of the output. I am using the following R commands: { plot(Time, col=lightgrey) title(Connections per Minute) map(world, fill=TRUE, lwd=0.25, col=green, add=TRUE) box() } Please note that Time contains data in the following format: 00:00 00:01 ... 22:04, etc. Can you please help me? Well, the only way a map(..., add=TRUE) will work is if the original scale is in the order of latitude and longitude in degrees. It is not clear exactly how the data you are plotting relates to the map you want. If you just want the map as a 'background', then you will need to rescale one or other of the plots. Hope this helps, Ray Brownrigg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Cannot scale my map
On Mon 11 Dec 2006, at 22:32 , Ray Brownrigg wrote: On Tuesday 12 December 2006 09:07, Mihalis Tsoukalos wrote: Dear list, I have the following problem: I want to plot my data and display a map at the same graph. The problem is that my map is not properly sized (is very small). It appears at the bottom-left side of the output. I am using the following R commands: { plot(Time, col=lightgrey) title(Connections per Minute) map(world, fill=TRUE, lwd=0.25, col=green, add=TRUE) box() } Please note that Time contains data in the following format: 00:00 00:01 ... 22:04, etc. Can you please help me? If you just want the map as a 'background', then you will need to rescale one or other of the plots. Dear Ray, thanks for answering. I just want the map as a background but I do not know how to rescale it. Can anyone help me? thanks! Mihalis. --- Show me a Mac user, and I 'll show you a creative user. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] set up directory for R when I start R
On 12/11/2006 2:21 PM, Earl F. Glynn wrote: Dieter Menne [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] Aimin Yan aiminy at iastate.edu writes: I want to set default directory for R when I start R. How to do this? ?setwd In Windows, I prefer the method described in http://tolstoy.newcastle.edu.au/R/help/00b/2454.html I learned a similar trick by using Regedit to set the registry keys directly. (Years ago someone showed me this trick to start a DOS session). Apparently, either \Directory\shell or \Folder\shell do the same thing. Do you know if there is a difference? Folders are shell objects, directories are file system objects. Normally the file system is mapped to folders, but there are other folders too, e.g. the network neighbourhood, printers, etc. Duncan Murdoch I checked and your suggestion can be modified to even specify a http_proxy, if needed: For example, this works for me under Windows XP, including the proxy server, from any directory chosen using Windows Explorer: Windows Registry Editor Version 5.00 [HKEY_CLASSES_ROOT\Folder\shell\R\command] @=C:\\Program Files\\R\\R-2.4.0\\bin\\Rgui.exe http_proxy=http://proxy01:8080 http_proxy_user=ask --- The above was the exported registry key from what I set manually using RegEdit. I used simply R instead of Run R, like you suggested. efg Earl F. Glynn Bioinformatics Stowers Institute for Medical Research __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] I think this modified ewma function works if anyone is interested
I think this modified version of ewma works for anyone who is interested. It gets rid of any NAs, smoothes the resulting series and then puts the NAs back in at their correct spots. The only catch is that the input has to be a zoo object. Sometimes I shock myself. ewmab-function(x,lambda = 1, init = x[1]) { oldindex-index(x) temp-as.vector(!is.na(x)) x-x[temp] rval-filter(lambda*coredata(x),filter=(1-lambda),method=recursive,ini t=init) nonmissingzoo-zoo(matrix(coredata(rval),nc=1),index(x)) rval-merge(zoo(,oldindex),nonmissingzoo) rval } This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] global option settings for grid and lattice?
Hi Zepu Zhang wrote: Hello, I'd like to be able to set options for grid and lattice globally, once for all subsequent plots, just like what ps.options() does. I walked through the functions of Grid and didn't find it. The following are related things that are available: get.gpar() trellis.par.set() any ideas? thanks. ps.options() sets the defaults for a PostScript output device. It has no effect, for example, on screen output. The top-level grid viewport takes most of its default settings from the device, so it should pick up ps.options() settings (WHEN you are drawing to a PostScript device). All grid drawing uses default settings from the current viewport unless explicitly overridden, so ps.options() settings should carry through to your drawing (IF you are only using grid). Lattice decides for itself what the default graphics settings should be (again, based on the type of device you are drawing to, but using lattice defaults, NOT ps.options() defaults). You might want to look at ?trellis.device and read about themes to gain control over default lattice settings. Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] hermite and Bezier splines
Does anyone know how to do hermite or Bezier splines in R? I can find Matlab routines, but really need to implement them in R. Failing that I'd be interested in other conformal splines. I need to smooth and interpolate animal tracking data. Antarctic Wildlife Research Unit School of Zoology University of Tasmania PO Box 252-05 Hobart TAS, 7001 Australia Phone: (0)3 6226 2645 Fax:(0)3 6226 2745 http://www.zoo.utas.edu.au/awru/ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem with sas.get function in Hmisc
Thomas, As F Harrel in a preceding message told me that you are the maintainer of Hmisc package, I write directly to you, with copy to the Rhelp list in case someone encountered the same problem and find some benefit in the response. I used quite often the function sas.get in Hmisc library which I is very, very useful. But, as trying to reuse it today it seems not to function anymore. I tried everything I could imagine this afternoon, with no success. Here is my last test. 'datatest' is a very simple SAS dataset (V9.1) with only 3 variables, 100 obs, no format. Sas.get produces this ouput : bs2m - sas.get(library=C:/test,datatest) Syntaxe du nom de fichier, de r‚pertoire ou de volume incorrecte. Error in sas.get(library = C:/test, datatest) : SAS job failed with status 1 In addition: Warning message: 'cmd' execution failed with error code 1 in: shell(cmd, wait = TRUE, intern = output) In the R temp directory there is only one file : SaS678418be.3.sas, containing the usual SAS program (macro and macro call). I can run it from R with : sys(sas -sysin C:/Temp/RtmpuC23qb/SaS678418be.3.sas) character(0) and I get two files with dict (SaS678418be.1.sas) and data (SaS678418be.2.sas). So the SAS step seems to work fine. Do you have an idea of what went wrong ? I tried to run old R progs with sas.get which used to work, and have the same problem. Thank you in advance. version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor 4.0 year 2006 month 10 day03 svn rev39566 language R version.string R version 2.4.0 (2006-10-03) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] EBimage package for materials science
Dear R users, In last R News, a new package was appeared. EBimage image processing package seems so powerful. But in R News, it is used for the images of cells under microscope. So, i wonder whether there is anyone who use this package for materials science applications such as determination of mean diameter of particles, fibers or pores, estimation of porosity or covering factor. Sincerely... -- Ýbrahim Mutlay [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] a web interface to identify()
i have a function like this: # show a plot and run a script when the user clicks on a plot, # where the script arguments correspond to the user-selected point. blah - function(x, y) { plot(y~x) n - identify(x=x, y=y) com - system(command=paste(bleh, names(y)[n])) } i would like to do this via a web page instead of x11() etc. eg: 1) a user clicks on an image in their web browser 2) the i,j coordinate is sent to the server 3) a single R process determines the nearest data point 4) the server sends a new page to the client, based on attributes of the selected data point i've browsed the R web interface options and frankly don't know which to pick, or maybe they are all overkill for what i am trying to accomplish? perhaps the easiest thing to do is use ismap to capture the i,j coords, the receiving cgi script connects to an R process for the data lookup, and then responds to the browsing client appropriately. the data set involved is very large, so i'd need a single R process sitting there waiting for such queries in order to avoid initializeload time - this is the part i am particularly unclear how to do. any ideas/suggestions/guidance on the best approach would be much appreciated. thank you. -- +--+ | Jon Stearley (505) 845-7571 (FAX 844-9297) | | Sandia National Laboratories Scalable Systems Integration | +--+ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] implementation of t.test
Hi, there: for some reason, I need to look at t.test at coding level. Can anyone here suggest a place to start with? thanks. -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] strings as factors
Hi, To be able to match cases with a benchmark I need to have a data.frame with a character id variable. however, I am surprised why this seems to be so hard. In fact I was unable to succeed. Here is what I tried: test1 -expand.grid(ID = 1:2, sex = c(male,female)) is(test1[,2]) [1] factor oldClass test2 -expand.grid(ID = 1:2, sex = c('male','female')) is(test2[,2]) [1] factor oldClass test3 -expand.grid(ID = 1:2, sex = I(c(male,female))) is(test3[,2]) [1] factor oldClass test4 -expand.grid(ID = 1:2, sex = I(c('male','female'))) is(test4[,2]) [1] factor oldClass options(stringsAsFactors = FALSE) options(stringsAsFactors) $stringsAsFactors [1] FALSE test5 -expand.grid(ID = 1:2, sex = I(c('male','female'))) is(test5[,2]) [1] factor oldClass is there anyway I can get sex to be a character? Arnab _ Visit MSN Holiday Challenge for your chance to win up to $50,000 in Holiday __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Combining bitmaps and plots - file too large
Hello, I wish to draw a bitmap image and a standard plot in a split window, multiple times, output to a pdf eg. library(pixmap) pdf(test.pdf) for(i in 1:50) { par(mfrow=c(1,2)) p1 = read.pnm(paste(img,i,.ppm,sep=)) plot(x,y) } dev.off() The end result is a pdf file 1GB, obviously not very portable. The .ppm's I'm using are around 1MB so they are not some huge resolution. I've tried several different methods of optimising .pdfs externally (eg. ps2pdf -dPDFSETTINGs=\screen) without much luck. Any suggestions? Regards, Jared __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Hourly Time Series
I have hourly data for approximately 21 days in the following format DateIDHourIDMetrics 200609200xx 200609201xx The hour ids correspond to one hour windows starting 00:00 to 23:59. I have never dealt with TS data before. What is the best way to handle this data? TS objects or use the Zoo package? Thanks in advance. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] implementation of t.test
On Mon, 11 Dec 2006, Weiwei Shi wrote: Hi, there: for some reason, I need to look at t.test at coding level. Can anyone here suggest a place to start with? You mean how to read the code?? Like this: t.test # print the function function (x, ...) UseMethod(t.test) environment: namespace:stats # that told me 't.test' has S3 methods methods(t.test) [1] t.test.default* t.test.formula* Non-visible functions are asterisked # that told me what they were # and that I need ':::' to see them page(stats:::t.test.default,print) page(stats:::t.test.formula,print) # looks like you want to study t.test.default see ?methods ?::: HTH [...] Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://biostat.ucsd.edu/~cberry/ La Jolla, San Diego 92093-0717 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] strings as factors
Here is a possibility: test - expand.grid(id = 1:2, sex = c('male', 'female')) sapply(test, class) id sex integer factor test - transform(test, sex = as.character(sex)) sapply(test, class) id sex integer character But I am surprised at the reason you give for needing it as a character vector, because factors often act as character vectors under matching anyway. sexf - factor(test[[2]]) sexf [1] male male female female Levels: female male which(sexf %in% male) [1] 1 2 which(sexf == male) [1] 1 2 Bill Venables -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alexander Nervedi Sent: Tuesday, 12 December 2006 10:09 AM To: r-help@stat.math.ethz.ch Subject: [R] strings as factors Hi, To be able to match cases with a benchmark I need to have a data.frame with a character id variable. however, I am surprised why this seems to be so hard. In fact I was unable to succeed. Here is what I tried: test1 -expand.grid(ID = 1:2, sex = c(male,female)) is(test1[,2]) [1] factor oldClass test2 -expand.grid(ID = 1:2, sex = c('male','female')) is(test2[,2]) [1] factor oldClass test3 -expand.grid(ID = 1:2, sex = I(c(male,female))) is(test3[,2]) [1] factor oldClass test4 -expand.grid(ID = 1:2, sex = I(c('male','female'))) is(test4[,2]) [1] factor oldClass options(stringsAsFactors = FALSE) options(stringsAsFactors) $stringsAsFactors [1] FALSE test5 -expand.grid(ID = 1:2, sex = I(c('male','female'))) is(test5[,2]) [1] factor oldClass is there anyway I can get sex to be a character? Arnab _ Visit MSN Holiday Challenge for your chance to win up to $50,000 in Holiday __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help on determining operating system
Dear list, I am an R user and I also write my own package in R(sometime i need to write in C), and right now i am thinking about buying a new workstation--and i am trying to decide if i should get a mac with OS X or a linux machine (for example Dell). I have experience using R on linux (but i have been just a user and never been a admin) but i am hesitating of managing a linux system on my own (btw I would like to have my new workstation to be used as a server), so right now I am leaning toward of buying a Mac Pro. But from the website, it sounds like R doesnt work quite well with Mac operating system yet...so I was wondering if anybody here have any experiences of using/developing R package on a Mac machine? Is it smooth enough? (oh by the way, i am not a Mac user yet, Windows has been the primary operating system that i used, but after hearing many good things of OS X, I am really interested in switching over.) any suggestions are appreciated! Ying Ying Lu Assistant Professor Dept. Sociology U-Colorado at Boulder __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to define w matrix in my case?
hello list, I have N agricultural fields (some of them share borders, some don't) with ph as the variable of interest. Since I want to test the spatial autocorrelation, I need to come up with the w matrix. The first and easy way that came to my brain was the binary relationship, i.e., the w matrix is all 1s and 0s with 1 meaning two fields sharing border and 0 not. So I checked the distribution of the N fields, and I manually defined a NxN matrix with 1s and 0s. I list the variable of interest (ph) as a vector with N elements, and plan to use moran or moran.test to test the spatial autocorrelation. However, I had difficulty to run the code. Anyone has suggestions about my case where the areal/lattice data are irregular? Please also let me know if moran or moran.test is the correct command to use. Thanks. XY __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help on determining operating system
On Tue 12 Dec 2006, at 06:40 , LU YING wrote: Dear list, I am an R user and I also write my own package in R(sometime i need to write in C), and right now i am thinking about buying a new workstation--and i am trying to decide if i should get a mac with OS X or a linux machine (for example Dell). I have experience using R on linux (but i have been just a user and never been a admin) but i am hesitating of managing a linux system on my own (btw I would like to have my new workstation to be used as a server), so right now I am leaning toward of buying a Mac Pro. But from the website, it sounds like R doesnt work quite well with Mac operating system yet...so I was wondering if anybody here have any experiences of using/developing R package on a Mac machine? Is it smooth enough? (oh by the way, i am not a Mac user yet, Windows has been the primary operating system that i used, but after hearing many good things of OS X, I am really interested in switching over.) any suggestions are appreciated! Ying Hi Ying. I am using R on both a PowerMac and a MacBook. I do not do any development but as far as using R I do not have any problems. Please note that software such as Parallels (http:// www.parallels.com), allows you to run Linux on a Mac Intel (such as Mac Pro) without problems, in case you need it. Feel free to ask more questions, Mihalis. Mac for Productivity, Unix for Development, and Windows for Solitaire __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] multiple x-axis labels on plot
hi, how can i set multiple x-axis labels on a plot? in effect, i want to set 2 x-axis labels and values on the tick marks. is it possible to have one running on the bottom (as is the default) and another running across the top of a plot? like: xlab-1 - | | | | - xlab-0 thanks. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] surface plot
Hi, I have been trying to make a surface plot using R - I came across functions like plot.surface, surface but I could not use these functions as they seem to be in FOO package which I cannot load. I also want to make a plane that fits the surface plot. Can anyone help? divya [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.