Re: [R] Should there be an R-beginners list?
On 11/25/13 09:04, Rich Shepard wrote: On Sun, 24 Nov 2013, Yihui Xie wrote: Mailing lists are good for a smaller group of people, and especially good when more focused on discussions on development (including bug reports). The better place for questions is a web forum. I disagree. Mail lists push messages to subscribers while web fora require one to use a browser, log in, then pull messages. Not nearly as convenient. Well expressed Rich. I agree with you completely. cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] GADM Data Download
Dear All, Please consider the snippet at the end of the email. I often download some maps (in the R format) from http://www.gadm.org/ However, when I run (typically more than once) a variation of the script below (based on http://bit.ly/1b3W0Aa ), I often get Error in load(url(paste(http://gadm.org/data/rda/;, fileName, _adm, : cannot open the connection In addition: Warning message: In load(url(paste(http://gadm.org/data/rda/;, fileName, _adm, : cannot open: HTTP status was '504 Gateway Time-out' Does anybody know if gadm blocks repeated attempts to retrieve the same data? I am not talking about saturated its bandwidth, just retrieving a few tens of Mb per day at most. Many thanks Lorenzo ##à ## you will need the sp-package library('sp') ## load a file from GADM (you just have to specify the countries special part of the file name, like ARG for Argentina. Optionally you can specify which level you want to have loadGADM - function (fileName, level = 0, ...) { load(url(paste(http://gadm.org/data/rda/;, fileName, _adm, level, .RData, sep = ))) gadm } ## the maps objects get a prefix (like ARG_ for Argentina) changeGADMPrefix - function (GADM, prefix) { GADM - spChFIDs(GADM, paste(prefix, row.names(GADM), sep = _)) GADM } ## load file and change prefix loadChangePrefix - function (fileName, level = 0, ...) { theFile - loadGADM(fileName, level) theFile - changeGADMPrefix(theFile, fileName) theFile } ## this function creates a SpatialPolygonsDataFrame that contains all maps you specify in fileNames. ## E.g.: ## spdf - getCountries(c(ARG,BOL,CHL)) ## plot(spdf) # should draw a map with Brasil, Argentina and Chile on it. getCountries - function (fileNames, level = 0, ...) { polygon - sapply(fileNames, loadChangePrefix, level) polyMap - do.call(rbind, polygon) polyMap } spdf - getCountries(c(ITA,FRA, DEU,BEL, LUX, ESP, FIN, SWE,DNK, POL, PRT, CZE, SVK, SVN, GBR, IRL, ROU, HUN, NLD, AUT, BGR,GRC, EST,LVA, LTU,CYP,MLT, HRV, CHE )) save(spdf,file=gadm_data.Rdata) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Y-axis label not plotting
Dear R community I am trying to make an XY plot that shows temperature (y axis) as a function of time (x axis) but I am having some problems. When I use the code shown below: 1. my plot does not show any of the y-axis labels even though there is plenty of white space there (i.e.: I am getting no y-axis title, and no y-axis labels at each tick mark). Is my command syntax incorrect? 2. Also, I was wondering... is there a way to tell R to plot the last 30 days of data in the x-axis? Thank you so much in advance!! Here's my code so far: bdata=read.table('cleandata.asc',header=FALSE) dates1 - strptime(paste(bdata$V2, bdata$V3), format=%m/%d/%Y %H:%M:%S) temp1 = bdata[,4] par(mar=c(5, 6, 4, 2)) plot(dates1, temp1,type=o,col=red,pch=20,xlab=x axis, main=my plot, ylab=y axis, ylim=c(0,40), yaxp = c(0,40,10)) PS: just fyi, my data looks like this: temp1 [1] 6.81 26.81 26.81 26.81 26.87 26.87 26.87 26.87 27.06 27.06 27.06 27.06 [13] 27.06 27.06 27.06 27.06 27.06 27.06 27.06 27.06 27.06 27.06 27.06 27.06 [25] 27.06 27.06 27.06 27.06 27.06 27.06 27.06 27.06 27.06 27.06 27.06 27.06 [37] 27.06 27.06 27.06 27.06 27.06 27.00 27.00 27.06 27.06 27.06 27.00 27.00 [49] 27.06 27.00 27.00 27.00 27.00 27.00 27.00 27.00 27.00 26.94 26.94 26.94 [61] 26.94 27.00 26.94 26.94 26.94 26.94 26.94 26.94 26.94 26.94 26.94 27.00 [73] 26.94 26.94 26.94 26.94 26.94 26.94 26.94 26.94 26.94 dates1 [1] 2013-01-12 18:10:28 HST 2013-10-24 18:10:43 HST [3] 2013-10-29 18:10:49 HST 2013-11-14 18:10:52 HST [5] 2013-11-14 18:12:10 HST 2013-11-14 18:12:12 HST [7] 2013-11-14 18:12:21 HST 2013-11-14 18:12:22 HST [9] 2013-11-14 18:17:10 HST 2013-11-14 18:17:11 HST [11] 2013-11-14 18:17:13 HST 2013-11-14 18:17:14 HST [13] 2013-11-14 18:17:15 HST 2013-11-14 18:17:17 HST [15] 2013-11-14 18:17:18 HST 2013-11-14 18:17:20 HST [17] 2013-11-14 18:17:21 HST 2013-11-14 18:17:22 HST [19] 2013-11-14 18:17:24 HST 2013-11-14 18:17:25 HST [21] 2013-11-14 18:17:26 HST 2013-11-14 18:17:28 HST [23] 2013-11-14 18:17:29 HST 2013-11-14 18:17:30 HST [25] 2013-11-14 18:17:32 HST 2013-11-14 18:17:33 HST [27] 2013-11-14 18:17:34 HST 2013-11-14 18:17:36 HST [29] 2013-11-14 18:17:37 HST 2013-11-14 18:17:38 HST [31] 2013-11-14 18:17:40 HST 2013-11-14 18:17:41 HST [33] 2013-11-14 18:17:42 HST 2013-11-14 18:17:44 HST [35] 2013-11-14 18:17:45 HST 2013-11-14 18:17:46 HST [37] 2013-11-14 18:18:47 HST 2013-11-14 18:18:48 HST [39] 2013-11-14 18:18:50 HST 2013-11-14 18:18:51 HST [41] 2013-11-14 18:18:52 HST 2013-11-14 18:18:54 HST [43] 2013-11-14 18:18:55 HST 2013-11-14 18:18:56 HST [45] 2013-11-14 18:18:58 HST 2013-11-14 18:18:59 HST [47] 2013-11-14 18:19:10 HST 2013-11-14 18:19:11 HST [49] 2013-11-14 18:19:12 HST 2013-11-14 18:19:14 HST [51] 2013-11-14 18:19:15 HST 2013-11-14 18:19:16 HST [53] 2013-11-14 18:19:18 HST 2013-11-14 18:19:19 HST [55] 2013-11-14 18:19:20 HST 2013-11-14 18:19:22 HST [57] 2013-11-14 18:19:23 HST 2013-11-14 18:20:24 HST [59] 2013-11-14 18:20:26 HST 2013-11-14 18:20:27 HST [61] 2013-11-14 18:20:29 HST 2013-11-14 18:20:30 HST [63] 2013-11-14 18:20:31 HST 2013-11-14 18:20:33 HST [65] 2013-11-14 18:20:34 HST 2013-11-14 18:20:35 HST [67] 2013-11-14 18:20:37 HST 2013-11-14 18:20:38 HST [69] 2013-11-14 18:20:39 HST 2013-11-14 18:20:41 HST [71] 2013-11-14 18:20:42 HST 2013-11-14 18:20:43 HST [73] 2013-11-14 18:20:45 HST 2013-11-14 18:20:46 HST [75] 2013-11-14 18:20:47 HST 2013-11-14 18:20:49 HST [77] 2013-11-14 18:20:50 HST 2013-11-14 18:20:51 HST [79] 2013-11-14 18:20:53 HST 2013-11-14 18:20:54 HST [81] 2013-11-14 18:20:55 HST [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] MANOVA Question
I'm running a MANOVA on survey data. The dependent variables are the ranking of each DV. So the respondent was asked to rank 7 different subject lines, each subject line is a DV with what the respondent ranked as datum. I had the code running yesterday, had a computer crash, then had to rewrite plus append some new data. Now it's not working. And I didn't think I'd run into a problem with putting all 7 DV's in the model, but I think maybe that's it. But I can't understand why it ran yesterday, and not today... Any help? Here's my code: Man_SubLine - manova(cbind(Subline1, Subline2, Subline3, Subline4, Subline5, Subline6, Subline7) ~ Var1 + Var2 + Var 3 + Var4 + Var5, data=heisenberg) summary(Man_SubLine) Here's some example data: Var1 Var2 Var3 Var4 Var5 Subline1 Subline2 Subline3 Subline4 Subline5 Subline6 Subline7 4 6.5 6.5 6.5 6 1 2 3 5 7 4 6 6 4.5 4 6 6 7 1 2 3 4 5 6 3 4.5 5 6 3 4 1 2 3 5 7 6 4.5 6 5 5.5 5 4 1 2 3 5 7 6 4.5 3.5 6 4 6 5 1 2 4 3 6 7 6 4.5 1 5 5 7 6 1 2 4 5 3 5 5.5 7 7 4 4 2 1 3 6 7 5 3.5 4.5 6 3 6 1 3 6 2 4 5 7 2.5 6 4.5 5 5 1 7 6 5 4 2 3 4 5 6.5 5 6.5 7 3 5 6 2 4 1 3.5 5 5.5 4.5 6 7 1 2 4 3 5 6 2 3 4 2.5 6 7 1 4 5 6 3 2 4 4 2.5 5 4.5 2 3 1 4 7 5 6 4 6 6 6.5 7 2 6 5 1 4 7 3 2 5 4 1.5 4.5 1 5 7 2 6 3 4 4.5 3.5 5.5 3.5 6 5 2 1 3 4 7 6 2.5 5 5.5 4 5 4 3 2 1 6 5 7 6 6.5 6 6.5 6 1 4 5 2 7 3 6 2 7 7 7 6 4 2 5 3 1 7 6 3 5.5 6.5 4.5 6.5 1 6 2 7 4 5 3 3 4.5 6.5 1 5 1 2 3 4 5 6 7 2.5 5.5 4.5 4.5 3.5 7 1 6 2 3 5 4 4 6.5 6 4 6.5 2 6 3 5 1 7 4 3 6.5 4 5.5 7 4 1 2 7 6 5 3 2 6.5 7 7 5.5 7 6 5 4 3 2 1 4.5 7 6.5 5 6 5 3 2 1 7 6 4 5 6.5 7 7 7 7 2 1 4 5 3 6 5.5 5.5 6 6 5.5 7 2 3 1 4 5 6 2 4.5 5 4.5 4.5 1 2 3 5 6 4 7 5.5 4.5 6 4.5 4 6 2 1 3 4 7 5 3.5 4 6.5 5.5 4 4 2 1 3 6 7 5 6.5 5.5 6 6 6 6 2 3 1 4 5 7 1 4 5 6 4.5 4 1 6 7 2 5 3 3 7 6 6.5 4 6 2 1 5 3 4 7 5 7 6.5 7 6.5 7 2 3 1 4 6 5 2 5.5 6 7 2.5 5 2 3 1 4 6 7 4 6.5 7 6 7 4 3 2 1 5 7 6 4.5 5 5 1.5 7 7 3 4 2 6 1 5 4 6 4.5 7 5 3 1 2 5 4 6 7 5.5 6.5 6.5 6 5 6 3 4 1 2 7 5 4 7 7 7 5.5 5 2 1 7 6 4 3 3.5 4 3 3 6 1 7 6 2 5 3 4 6.5 7 5 3.5 6 7 2 3 4 1 6 5 6.5 6.5 7 6.5 6 4 3 2 1 5 7 6 3 4 5 5.5 4 1 2 3 4 6 5 7 1 4 4.5 3.5 6 7 1 2 3 5 4 6 4.5 4.5 6 3.5 3.5 3 1 2 4 6 5 7 1 2 7 7 1 4 1 2 3 5 6 7 3.5 5.5 4.5 4 6 3 1 2 4 5 6 7 4 5.5 3.5 5.5 5 5 1 4 3 7 6 2 2.5 4 4 6 6 7 2 6 3 4 5 1 5 3.5 6 5 3 6 1 5 7 2 4 3 1.5 4.5 2.5 5.5 6 4 1 2 7 3 6 5 4.5 5.5 6 6 4.5 4 2 3 1 5 6 7 7 7 4.5 6 7 4 2 3 1 5 7 6 4.5 5 5.5 4 6 7 1 3 5 2 6 4 1.5 4.5 4 3.5 5 7 1 2 3 4 5 6 3 7 6.5 4 4 6 2 1 3 4 5 7 2.5 5.5 4 2 4.5 7 2 1 5 3 6 4 6.5 6 4.5 4.5 6.5 2 4 3 1 5 6 7 6.5 6.5 6.5 6.5 6.5 4 2 1 3 5 7 6 6 5 6 5.5 6 2 7 6 4 3 5 1 2.5 5.5 4 4 3.5 5 1 3 6 2 7 4 2.5 5 2.5 5 4.5 2 1 5 6 4 3 7 7 5 7 7 7 3 1 2 4 5 7 6 1 6 3 3.5 5.5 7 2 3 1 5 6 4 2.5 2.5 3 2.5 3.5 2 3 4 1 5 6 7 4.5 3.5 6 5.5 4.5 7 4 2 3 1 5 6 1 5.5 6 4.5 6 6 5 2 1 7 3 4 4 5 5 2.5 3.5 7 5 4 2 1 6 3 3 5.5 6.5 6 5.5 5 1 3 2 4 6 7 2 6 6 3.5 6.5 6 3 2 1 4 7 5 5 7 7 7 6.5 2 4 3 6 7 5 1 5 4 6 3 5.5 3 1 2 4 5 7 6 1 4 4 1 7 4 1 2 3 5 7 6 2.5 5.5 6.5 6 6 4 3 2 1 5 7 6 3.5 4 5 3 6 2 1 4 3 7 5 6 4 6.5 6 6 6 1 3 4 2 6 5 7 2.5 5.5 4.5 3.5 4 4 1 6 3 5 7 2 6 5.5 4.5 4 4.5 2 3 1 4 5 7 6 2.5 3 5 6 2 4 2 6 1 5 7 3 3 4.5 4.5 2 6 5 1 6 7 4 2 3 4.5 5.5 6 7 5.5 1 5 2 4 3 7 6 4 5 5 3 6.5 4 3 1 2 6 5 7 1.5 5 4 4 5 2 7 4 5 6 3 1 6.5 7 5.5 4 6.5 5 3 4 1 2 7 6 5.5 6.5 6.5 6 6.5 1 4 3 2 5 7 6 1 6.5 6.5 6.5 1 4 6 1 3 5 7 2 1 4.5 6 4 5.5 2 1 7 3 4 5 6 6 6.5 5.5 6.5 5.5 2 5 4 3 1 7 6 3.5 6 5.5 6.5 5 4 1 2 3 5 7 6 5.5 6 6.5 6 7 2 3 4 1 7 6 5 6.5 5 3.5 5.5 6.5 3 2 1 4 7 5 6 2.5 2.5 6 3.5 3.5 5 1 2 3 4 7 6 6.5 6.5 6 6.5 6 4 1 2 3 5 7 6 3.5 3.5 3.5 2.5 6 7 1 3 2 6 4 5 3.5 2 4 5.5 5 5 1 2 3 4 6 7 5 5.5 7 5.5 4.5 2 1 3 4 5 7 6 3 6.5 6.5 6 4.5 5 4 3 1 2 6 7 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Tinn-R user guide (latex sources) available on GitHub
Dears user, The Tinn-R User Guide is completely written in LaTeX and the idea behind this to be available on GitHub is that it has contributions from multiple users. If you find something that you would like to include or impruve: please, fell free to make it better. This User Guide have been developing under both OS: Windows and Linux. Under Windows: we have been using Tinn-R as editor and MikTeX as compiler. Under Linux: we have been using Vim (with LaTeX-Box plugin) as editor and TexLive as compiler. Link: https://github.com/jcfaria/Tinn-R-User-Guide Regards, -- ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ Jose Claudio Faria Estatistica UESC/DCET/Brasil joseclaudio.faria at gmail.com Telefones: 55(73)3680.5545 - UESC 55(73)9100.7351 - TIM 55(73)8817.6159 - OI ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Y-axis label not plotting
On 11/27/2013 05:32 PM, Luke M wrote: Dear R community I am trying to make an XY plot that shows temperature (y axis) as a function of time (x axis) but I am having some problems. When I use the code shown below: 1. my plot does not show any of the y-axis labels even though there is plenty of white space there (i.e.: I am getting no y-axis title, and no y-axis labels at each tick mark). Is my command syntax incorrect? 2. Also, I was wondering... is there a way to tell R to plot the last 30 days of data in the x-axis? Thank you so much in advance!! Here's my code so far: bdata=read.table('cleandata.asc',header=FALSE) dates1- strptime(paste(bdata$V2, bdata$V3), format=%m/%d/%Y %H:%M:%S) temp1 = bdata[,4] par(mar=c(5, 6, 4, 2)) plot(dates1, temp1,type=o,col=red,pch=20,xlab=x axis, main=my plot, ylab=y axis, ylim=c(0,40), yaxp = c(0,40,10)) PS: just fyi, my data looks like this: Hi Luke, Thanks for including the data. When I plot it, I get both y axis label and y axis tick labels. If you only want the last 30 days, you could select them like this: last30-dates1 = strptime(2013-10-14,%Y-%m-%d) plot(dates1[last30],temp1[last30],type=o,col=red,pch=20, xlab=x axis, main=my plot, ylab=y axis, ylim=c(0,40), yaxp = c(0,40,10)) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Tinn-R user guide (latex sources) available on GitHub
Thank you for doing this! On Wed, Nov 27, 2013 at 11:22 AM, Jose Claudio Faria joseclaudio.fa...@gmail.com wrote: Dears user, The Tinn-R User Guide is completely written in LaTeX and the idea behind this to be available on GitHub is that it has contributions from multiple users. If you find something that you would like to include or impruve: please, fell free to make it better. This User Guide have been developing under both OS: Windows and Linux. Under Windows: we have been using Tinn-R as editor and MikTeX as compiler. Under Linux: we have been using Vim (with LaTeX-Box plugin) as editor and TexLive as compiler. Link: https://github.com/jcfaria/Tinn-R-User-Guide Regards, -- ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ Jose Claudio Faria Estatistica UESC/DCET/Brasil joseclaudio.faria at gmail.com Telefones: 55(73)3680.5545 - UESC 55(73)9100.7351 - TIM 55(73)8817.6159 - OI ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Mathematical Modelling, Statistics and Bio-Informatics tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Should there be an R-beginners list?
StackOverflow has certainly its merits, although I miss a bit the good ol' Oxford sarcasm gems you find in this list. This said : Beginner's list. Bad, bad idea. First rule in my classes is: RTFI (Read The Fucking Internetzz). Anybody using R should be able to do a basic Google search. A beginner's list is not going to help them in learning that. If beginners do the effort of following the posting guidelines, netiquette or any other guide to getting help on the internet, they can safely use this list. Cheers Joris On Wed, Nov 27, 2013 at 9:47 AM, Rolf Turner r.tur...@auckland.ac.nzwrote: On 11/25/13 09:04, Rich Shepard wrote: On Sun, 24 Nov 2013, Yihui Xie wrote: Mailing lists are good for a smaller group of people, and especially good when more focused on discussions on development (including bug reports). The better place for questions is a web forum. I disagree. Mail lists push messages to subscribers while web fora require one to use a browser, log in, then pull messages. Not nearly as convenient. Well expressed Rich. I agree with you completely. cheers, Rolf Turner __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Joris Meys Statistical consultant Ghent University Faculty of Bioscience Engineering Department of Mathematical Modelling, Statistics and Bio-Informatics tel : +32 9 264 59 87 joris.m...@ugent.be --- Disclaimer : http://helpdesk.ugent.be/e-maildisclaimer.php [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Space in label name
Hi I am doing a cluster analysis and I have some troubles with the label names. In the text file I have my data in, the first row contains the names of the samples. They are called FFPE Tumor 2, Fresh Frozen Tumor 2 etc. But when the cluster is made the label names contains periods instead of space in the name. I can't figure out how to change this, so I get spaces in the label names. I hope someone can help? The code I have used is: #Set where you want to save your images/clusters setwd(/Users/gban/Desktop/Lung Cancer/PAXgene article figures/PAXgene cluster + Venn analysis) #Read in data data-read.table(/Users/gban/Desktop/Lung Cancer/PAXgene article figures/PAXgene cluster + Venn analysis/BetaValue_ALL_tumo1_dup2_Codename.txt,sep=\t,dec=,,header=TRUE) # Throw out rows with missing values. data = na.omit(data) #Turn the data into a matrix Data_matrix-as.matrix(data) #Calculate the distance Data_dist-dist(t(data)) #Make the cluster hc = hclust(Data_dist,method=ward) # reduced label size par(cex=0.7, mar=c(5, 8, 4, 1)) plot(hc, xlab=, ylab=, main=, sub=, axes=FALSE) par(cex=1) title(xlab=, ylab=, main=Cluster analysis) axis(2) The cluster output: [cid:D57BB82B-3ACF-4681-BCA8-D8202EA34294@eduroam.net.au.dk] Kind regards Gitte Brinch Andersen Ph.d student Department of Biomedicine Wilhelm Meyers Allé 4 Aarhus Universitet DK-8000 Aarhus C E-mail: gitt...@hum-gen.au.dkmailto:gitt...@hum-gen.au.dk __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] xtable: custom row.names, move caption to top
With xtable, I'm producing one-way tables from table objects in horizontal form as shown below. I'd like to change the labels used for the rows and move the caption to the top of the table, as is typically standard for tables. I can hand-edit, but would prefer to do it in code. data(Saxony, package=vcd) library(xtable) saxtab - xtable(t(addmargins(Saxony)), digits=0, caption=Number of male children in 6115 Saxony families of size 12) print(saxtab) print(saxtab) % latex table generated in R 3.0.1 by xtable 1.7-1 package % Wed Nov 27 09:12:16 2013 \begin{table}[ht] \centering \begin{tabular}{rrr} \hline 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ \hline 1 3 24 104 286 670 1033 1343 1112 829 478 181 45 7 6115 \\ \hline \end{tabular} \caption{Number of male children in 6115 Saxony families of size 12} \end{table} The desired form looks like this, with row.names = c(Males ($k$), Families ($n_k$)) % latex table generated in R 3.0.1 by xtable 1.7-1 package % Tue Nov 26 14:56:02 2013 \begin{table}[ht] \caption{Number of male children in 6115 Saxony families of size 12} \label{tab:saxtab} \centering \begin{tabular}{l|rr} \hline Males ($k$) 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ \hline Families ($n_k$) 3 24 104 286 670 1033 1343 1112 829 478 181 45 7 6115 \\ \hline \end{tabular} \end{table} -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. Chair, Quantitative Methods York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 4700 Keele StreetWeb: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Etimating time to run an analysis?
Hi everyone, I'm new to this list and have searched R help prior for an answer to this question, without luck. If I'm posting in error, please forgive. I'm thinking about using package MuMIn to do multimodel inference with logistic regression. I have many (25) possible predictors and am curious if there is a way to estimate how long the dredge command might take to run? Any suggestions most welcome. Thanks, erika [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Buse's GLS R2
Thanks very much Pascal. That is a very useful package! On Wed, Nov 27, 2013 at 1:26 AM, Pascal Oettli kri...@ymail.com wrote: Hello, Using 'sos': library(sos) findFn('buse') Hope this helps, Pascal On 27 November 2013 14:55, Sheri O'Connor socon...@lakeheadu.ca wrote: I was wondering if anyone knew of a package that contained a function of Buse's (http://www.jstor.org/stable/2683631 ) GLS R2 equation? If not, I would greatly appreciate any pointers about how I would implement Buse's equation using the results from nlme::gls function! Thanks very much for your time, Sheri BTW, I would be happy to send along the article. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Pascal Oettli Project Scientist JAMSTEC Yokohama, Japan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Conditional error bars
How can I condition any error bar function that use the arrows() function, such as 'CI.plot' (see example below) or 'error.bars', to draw only upper error bar (upper CI) if the bar value (mean) is positive and the lower error bar (lower CI) if bar value is negative? CI.plot - function(mean, se,length, ylim=c(-5, max(CI.H)), ...) { CI.H - mean+se CI.L - mean-se xvals - barplot(mean, ylim=ylim, ...) # Plot bars arrows(xvals, mean, xvals, CI.H, angle=90,length=length) arrows(xvals, mean, xvals, CI.L, angle=90,length=length) } CI.plot(D,SE,0.01) thanks, -- \m/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Conditional error bars
Change your two lines arrows(xvals, mean, xvals, CI.H, angle=90,length=length) arrows(xvals, mean, xvals, CI.L, angle=90,length=length) to the one line arrows(xvals, mean, xvals, mean + sign(mean) * se, angle=90, length=length) (I would also use a scatter plot instead of a barplot for this sort of thing and draw both error bars. I think the bars give a misleading impression of what is going on.) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of raz Sent: Wednesday, November 27, 2013 7:23 AM To: r-help@r-project.org Subject: [R] Conditional error bars How can I condition any error bar function that use the arrows() function, such as 'CI.plot' (see example below) or 'error.bars', to draw only upper error bar (upper CI) if the bar value (mean) is positive and the lower error bar (lower CI) if bar value is negative? CI.plot - function(mean, se,length, ylim=c(-5, max(CI.H)), ...) { CI.H - mean+se CI.L - mean-se xvals - barplot(mean, ylim=ylim, ...) # Plot bars arrows(xvals, mean, xvals, CI.H, angle=90,length=length) arrows(xvals, mean, xvals, CI.L, angle=90,length=length) } CI.plot(D,SE,0.01) thanks, -- \m/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xtable: custom row.names, move caption to top
You get the cation to the top of the table with print( saxtab, caption.placement = top ) Formatting the table the way you want can be done like this - I did not manage to carry the LaTeX math formatting for the row names over ($k$ and $n_k$)but the rest should be very much what you want: saxtab - t( as.data.frame( addmargins( Saxony ) ) ) rownames( saxtab ) - c( Males (k), Families (n_k) ) saxtab - xtable( saxtab, digits = 0, caption = Number of male children in 6115 Saxony families of size 12, align = l|rr ) print( saxtab, caption.placement = top, include.colnames = FALSE, hline.after = c( NULL, 0, nrow( saxtab ) ) ) % latex table generated in R 3.0.2 by xtable 1.7-1 package % Wed Nov 27 17:41:17 2013 \begin{table}[ht] \centering \caption{Number of male children in 6115 Saxony families of size 12} \begin{tabular}{l|rr} \hline Males (k) 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ Families (n\_k) 324 104 286 670 1033 1343 1112 829 478 18145 7 6115 \\ \hline \end{tabular} \end{table} On Wednesday 27 November 2013 09:24:22 Michael Friendly wrote: With xtable, I'm producing one-way tables from table objects in horizontal form as shown below. I'd like to change the labels used for the rows and move the caption to the top of the table, as is typically standard for tables. I can hand-edit, but would prefer to do it in code. data(Saxony, package=vcd) library(xtable) saxtab - xtable(t(addmargins(Saxony)), digits=0, caption=Number of male children in 6115 Saxony families of size 12) print(saxtab) print(saxtab) % latex table generated in R 3.0.1 by xtable 1.7-1 package % Wed Nov 27 09:12:16 2013 \begin{table}[ht] \centering \begin{tabular}{rrr} \hline 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ \hline 1 3 24 104 286 670 1033 1343 1112 829 478 181 45 7 6115 \\ \hline \end{tabular} \caption{Number of male children in 6115 Saxony families of size 12} \end{table} The desired form looks like this, with row.names = c(Males ($k$), Families ($n_k$)) % latex table generated in R 3.0.1 by xtable 1.7-1 package % Tue Nov 26 14:56:02 2013 \begin{table}[ht] \caption{Number of male children in 6115 Saxony families of size 12} \label{tab:saxtab} \centering \begin{tabular}{l|rr} \hline Males ($k$) 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ \hline Families ($n_k$) 3 24 104 286 670 1033 1343 1112 829 478 181 45 7 6115 \\ \hline \end{tabular} \end{table} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Coding systems.
Hello, as Jan pointed out the problem is with the encoding in which R saves the fucntion. If I set this encoding to UTF-8 in source everything is fine. If I go either in my .bash_profile or my .Renviron file and set all LOCALE variables to fr_CA.UTF8 it should do the job, and to a certain point it does, I can source, and save in my personnal library functions with multibyte characters and they will run as expected. BUT with these settings at startup R throws the following error: Erreur : caractères multioctets incorrects dans l'analyse de code (parser) à la ligne 28 which translates in something like: Error: incorrect multi-byte characters in the code analysis (parser) at line 28 Further more I can't install any package, install.packages returns the same error and stops execution??? I know the work around is to not specify an UTF-8 locale in my profiles and explicitly pass the argument encoding = 'UTF-8' to source. But to me, this is somewhat of an inconsistency!!! Thanks to Jan for his insights, Gérald (Embedded image moved to file: pic09232.gif) Gerald Jean, M. Sc. en statistiques Conseiller senior en statistiques Lévis (siège social) Actuariat corporatif, 418 835-4900, poste Modélisation et Recherche 7639 Assurance de dommages 1 877 835-4900, poste Mouvement Desjardins 7639 Télécopieur : 418 835-6657 Faites bonne impression et imprimez seulement au besoin! Ce courriel est confidentiel, peut être protégé par le secret professionnel et est adressé exclusivement au destinataire. Il est strictement interdit à toute autre personne de diffuser, distribuer ou reproduire ce message. Si vous l'avez reçu par erreur, veuillez immédiatement le détruire et aviser l'expéditeur. Merci. Jan van der Laan rh...@eoos.dds.n l A r-help@r-project.org 2013/11/27 02:26 cc gerald.j...@dgag.ca Objet Re: [R] Coding systems. Could it be that your r-script is saved in a different encoding than the one used by R (which will probably be UTF8 since you're working on linux)? -- Jan gerald.j...@dgag.ca schreef: Hello, I am using R, 2.15.2, on a 64-bit Linux box. I run R through Emacs' ESS. R runs in a French, Canadian-French, locale and lately I got surprising results from functions making factor variables from character variables. Many of the variables in input data.frames are character variables and contain latin accents, for exemple the é in Montréal. I waisted several days playing with coding systems and trying to understand why some code when run one command at a time from the command line gives the expected result while when cut and pasted in a function it doesn't??? For example the following code: == ttt.rmr - sima.31122012$rmrnom ttt.rmr.2 - ifelse (ttt.rmr %in% c(Edmonton, Edmundston, Charlottetown, Calgary, Winnipeg, Victoria, Vancouver, Toronto, St. John's, Saskatoon, Regina,
Re: [R] cut2 not binning interval endpoints correctly
-Original Message- jim holtman jholt...@gmail.com You need to look at the full accuracy of the number representation: Um... I think I did. But I'm not sure you did print(..., digits=20) has used different numbers of digits for your two print()s, probably because print() decided it needed more digits for the multi-valued vector. The internal representations were the same. Try print(seq(0, 0.310, 0.001)[309], digits = 20) [1] 0.307996 print(seq(0, 0.310, 0.001)[309], digits = 22) [1] 0.3079960032 print(0.308, digits = 22) [1] 0.3079960032 0.308 does match the cut boundary 'exactly' in this case (which is why the usually unwise '==' returned TRUE), though neither is exactly 0.308. Nonetheless, I understand that FAQ 7.31 is a good candidate for other 'unexpected' cut2 results. However, that isn't the whole story. It doesn't explain the corresponding cut(, right=FALSE) result, which should give the same answer as cut2 if finite representation were the sole cause. So there's summat else going on. Steve E *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xtable: custom row.names, move caption to top
UPDATE: Now including the LaTeX math formatting saxtab - t( as.data.frame( addmargins( Saxony ) ) ) rownames( saxtab ) - c( Males ($k$), Families ($n_k$) ) saxtab - xtable( saxtab, digits = 0, caption = Number of male children in 6115 Saxony families of size 12, align = l|rr ) print( saxtab, caption.placement = top, include.colnames = FALSE, hline.after = c( NULL, 0, nrow( saxtab ) ), sanitize.text.function = function(x) { x } ) % latex table generated in R 3.0.2 by xtable 1.7-1 package % Wed Nov 27 18:16:47 2013 \begin{table}[ht] \centering \caption{Number of male children in 6115 Saxony families of size 12} \begin{tabular}{l|rr} \hline Males ($k$) 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ Families ($n_k$) 324 104 286 670 1033 1343 1112 829 478 18145 7 6115 \\ \hline \end{tabular} \end{table} On Wednesday 27 November 2013 17:43:30 Rainer Schuermann wrote: You get the cation to the top of the table with print( saxtab, caption.placement = top ) Formatting the table the way you want can be done like this - I did not manage to carry the LaTeX math formatting for the row names over ($k$ and $n_k$)but the rest should be very much what you want: saxtab - t( as.data.frame( addmargins( Saxony ) ) ) rownames( saxtab ) - c( Males (k), Families (n_k) ) saxtab - xtable( saxtab, digits = 0, caption = Number of male children in 6115 Saxony families of size 12, align = l|rr ) print( saxtab, caption.placement = top, include.colnames = FALSE, hline.after = c( NULL, 0, nrow( saxtab ) ) ) % latex table generated in R 3.0.2 by xtable 1.7-1 package % Wed Nov 27 17:41:17 2013 \begin{table}[ht] \centering \caption{Number of male children in 6115 Saxony families of size 12} \begin{tabular}{l|rr} \hline Males (k) 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ Families (n\_k) 324 104 286 670 1033 1343 1112 829 478 18145 7 6115 \\ \hline \end{tabular} \end{table} On Wednesday 27 November 2013 09:24:22 Michael Friendly wrote: With xtable, I'm producing one-way tables from table objects in horizontal form as shown below. I'd like to change the labels used for the rows and move the caption to the top of the table, as is typically standard for tables. I can hand-edit, but would prefer to do it in code. data(Saxony, package=vcd) library(xtable) saxtab - xtable(t(addmargins(Saxony)), digits=0, caption=Number of male children in 6115 Saxony families of size 12) print(saxtab) print(saxtab) % latex table generated in R 3.0.1 by xtable 1.7-1 package % Wed Nov 27 09:12:16 2013 \begin{table}[ht] \centering \begin{tabular}{rrr} \hline 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ \hline 1 3 24 104 286 670 1033 1343 1112 829 478 181 45 7 6115 \\ \hline \end{tabular} \caption{Number of male children in 6115 Saxony families of size 12} \end{table} The desired form looks like this, with row.names = c(Males ($k$), Families ($n_k$)) % latex table generated in R 3.0.1 by xtable 1.7-1 package % Tue Nov 26 14:56:02 2013 \begin{table}[ht] \caption{Number of male children in 6115 Saxony families of size 12} \label{tab:saxtab} \centering \begin{tabular}{l|rr} \hline Males ($k$) 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ \hline Families ($n_k$) 3 24 104 286 670 1033 1343 1112 829 478 181 45 7 6115 \\ \hline \end{tabular} \end{table} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Y-axis label not plotting
Thanks for the follow-up. Per your suggestion, I was able to plot the data for the last 30 days with no problem. However... I am still confused about the y-axis labels (values, title, etc) not plotting. If the scripting works as it should, what could cause the labels not to show up? A while ago I think that I accidentally changed something (not sure what) on the default settings (I was trying to learn how to make plots), and I wonder if this could cause the problem I am having... On Wed, Nov 27, 2013 at 12:23 AM, Jim Lemon j...@bitwrit.com.au wrote: On 11/27/2013 05:32 PM, Luke M wrote: Dear R community I am trying to make an XY plot that shows temperature (y axis) as a function of time (x axis) but I am having some problems. When I use the code shown below: 1. my plot does not show any of the y-axis labels even though there is plenty of white space there (i.e.: I am getting no y-axis title, and no y-axis labels at each tick mark). Is my command syntax incorrect? 2. Also, I was wondering... is there a way to tell R to plot the last 30 days of data in the x-axis? Thank you so much in advance!! Here's my code so far: bdata=read.table('cleandata.asc',header=FALSE) dates1- strptime(paste(bdata$V2, bdata$V3), format=%m/%d/%Y %H:%M:%S) temp1 = bdata[,4] par(mar=c(5, 6, 4, 2)) plot(dates1, temp1,type=o,col=red,pch=20,xlab=x axis, main=my plot, ylab=y axis, ylim=c(0,40), yaxp = c(0,40,10)) PS: just fyi, my data looks like this: Hi Luke, Thanks for including the data. When I plot it, I get both y axis label and y axis tick labels. If you only want the last 30 days, you could select them like this: last30-dates1 = strptime(2013-10-14,%Y-%m-%d) plot(dates1[last30],temp1[last30],type=o,col=red,pch=20, xlab=x axis, main=my plot, ylab=y axis, ylim=c(0,40), yaxp = c(0,40,10)) Jim [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ifelse, apply, if
Hello: This seems like an obvious question, but I am having trouble answering it. I am new to R, so I apologize if its too simple to be posting. I have searched for solutions to no avail. I have data that I am trying to set up for further analysis (training data). What I need is 12 groups based on patterns of 4 variables. The complication comes in when missing data is present. Let me describe with an example - focusing on just 3 of the 12 groups: vec=c(1,1,1,1,1,1,NA,NA,1,1,0,0,1,NA,1,1,1,NA,0,0,1,NA,1,0,0,0,0,1,0,0,0,0,NA,NA,NA,NA,1,NA,0,NA,1,NA,1,NA) a=matrix(vec, ncol=4,nrow=11, byrow=T) edit(a) col1 col2 col3 col4 [1,]1111 [2,]11 NA NA [3,]1100 [4,]1 NA11 [5,]1 NA00 [6,]1 NA10 [7,]0001 [8,]0000 [9,] NA NA NA NA [10,]1 NA 0 NA [11,]1 NA1 NA Here are 11 individuals. I want the following groups (coded as three separate binary variables): Group1 - scored a 1 on col1 and multiple time Group2 - scored a 1 on col1 but only once Group3 - did not score a 1 in col1 This seems straightforward, except missingness complicates it. Take individual 5 - this person should be placed in Groups 1 AND 2 because we don'tknow the score col2. Same with individual 10, though the response pattern differs. I tried using if statments, but am running into the problem that if is not vecotrized, and I can't seem to make if run with apply. I can use ifelse, but its very clunky and inefficient to list all possible patterns: (Note this is not complete of all patterns, its just an example of what Ivebeen doing) dd$TEST1=ifelse(is.na(d$C8W1raw),1, (ifelse(d$C8W1raw==1 is.na(d$C9W1raw) is.na(d$C11AW1raw) is.na (d$C12AW1rraw),777899, (ifelse((d$C8W1raw==1 d$C9W1raw==1)| (d$C8W1raw==1 d$C11AW1raw==1) |(d$C8W1raw==1 d$C12AW1rraw==1),1, (ifelse(d$C8W1raw==1 ((is.na(d$C9W1raw) | d$C9W1raw==0) (is.na(d$C11AW1raw) | d$C11AW1raw==0) (is.na(d$C12AW1rraw)|d$C12AW1rraw==0)),777899, 0))) Any ideas on how to approach this efficiently? Thanks, Andrea -- Andrea Lamont, MA Clinical-Community Psychology University of South Carolina Barnwell College Columbia, SC 29208 Please consider the environment before printing this email. CONFIDENTIAL: This transmission is intended for the use of the individual(s) or entity to which it is addressed, and may contain information that is privileged, confidential, and exempt from disclosure under applicable law. Should the reader of this message not be the intended recipient(s), you are hereby notified that any dissemination, distribution, or copying of this communication is strictly prohibited. If you are not the intended recipient, please contact the sender by reply email and destroy/delete all copies of the original message. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] cut2 not binning interval endpoints correctly
You can look at the source code of Hmisc::cut2() to see what is going on -- it does a lot more than calling cut() with different default arguments. Another approach to debugging this is to use trace() to see what cut2() passes down to the default cut method: trace(cut.default, quote(cat( x=, deparse(x), \n breaks=, deparse(breaks), \n))) Tracing function cut.default in package base [1] cut.default z - cut2(c(0.30800), seq(0,1,0.001)[306:315], oneval=FALSE) Tracing cut.default(x, k2) on entry x= 0.308 breaks= c(0.3045, 0.3055, 0.3065, 0.3075, 0.3085, 0.3095, 0.3105, 0.3115, 0.3125, 0.314) z [1] [0.308,0.309) 9 Levels: [0.305,0.306) [0.306,0.307) [0.307,0.308) ... [0.313,0.314] I.e., this has little to do with floating point errors in cut(). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of S Ellison Sent: Wednesday, November 27, 2013 9:12 AM To: r-help@r-project.org Subject: Re: [R] cut2 not binning interval endpoints correctly -Original Message- jim holtman jholt...@gmail.com You need to look at the full accuracy of the number representation: Um... I think I did. But I'm not sure you did print(..., digits=20) has used different numbers of digits for your two print()s, probably because print() decided it needed more digits for the multi-valued vector. The internal representations were the same. Try print(seq(0, 0.310, 0.001)[309], digits = 20) [1] 0.307996 print(seq(0, 0.310, 0.001)[309], digits = 22) [1] 0.3079960032 print(0.308, digits = 22) [1] 0.3079960032 0.308 does match the cut boundary 'exactly' in this case (which is why the usually unwise '==' returned TRUE), though neither is exactly 0.308. Nonetheless, I understand that FAQ 7.31 is a good candidate for other 'unexpected' cut2 results. However, that isn't the whole story. It doesn't explain the corresponding cut(, right=FALSE) result, which should give the same answer as cut2 if finite representation were the sole cause. So there's summat else going on. Steve E *** This email and any attachments are confidential. Any use...{{dropped:8}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Space in label name
try check.names = FALSE in the read.table to see if this helps. Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Wed, Nov 27, 2013 at 7:21 AM, Gitte Brinch Andersen gitt...@hum-gen.au.dk wrote: Hi I am doing a cluster analysis and I have some troubles with the label names. In the text file I have my data in, the first row contains the names of the samples. They are called FFPE Tumor 2, Fresh Frozen Tumor 2 etc. But when the cluster is made the label names contains periods instead of space in the name. I can't figure out how to change this, so I get spaces in the label names. I hope someone can help? The code I have used is: #Set where you want to save your images/clusters setwd(/Users/gban/Desktop/Lung Cancer/PAXgene article figures/PAXgene cluster + Venn analysis) #Read in data data-read.table(/Users/gban/Desktop/Lung Cancer/PAXgene article figures/PAXgene cluster + Venn analysis/BetaValue_ALL_tumo1_dup2_Codename.txt,sep=\t,dec=,,header=TRUE) # Throw out rows with missing values. data = na.omit(data) #Turn the data into a matrix Data_matrix-as.matrix(data) #Calculate the distance Data_dist-dist(t(data)) #Make the cluster hc = hclust(Data_dist,method=ward) # reduced label size par(cex=0.7, mar=c(5, 8, 4, 1)) plot(hc, xlab=, ylab=, main=, sub=, axes=FALSE) par(cex=1) title(xlab=, ylab=, main=Cluster analysis) axis(2) The cluster output: [cid:D57BB82B-3ACF-4681-BCA8-D8202EA34294@eduroam.net.au.dk] Kind regards Gitte Brinch Andersen Ph.d student Department of Biomedicine Wilhelm Meyers Allé 4 Aarhus Universitet DK-8000 Aarhus C E-mail: gitt...@hum-gen.au.dkmailto:gitt...@hum-gen.au.dk __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R- package for Parametric Survival Analysis with Left-censored data
On 11/20/2013 08:17 AM, peter dalgaard wrote: On 20 Nov 2013, at 04:15 , David Winsemius dwinsem...@comcast.net wrote: On Nov 19, 2013, at 5:30 PM, Vinod Mishra wrote: Dear All, I am new to R. Can someone please direct me to an R package using which I can estimate a Parametric Survival Analysis model with Left-censored (delayed entry) data in it. I recently received reviewers comment on my submitted article, where the reviewer suggested that only R has capabilities of estimating above mentioned survival model. However, I am not able to figure which specific package in R, the reviewer was referring to. Look at: ?Surv ... after loading the survival package. (I do think you would be advised to seek statistical consultation.) In particular, notice the difference between left censoring (some patients are known to have died at an unknown time before t0) and left truncation (we only know survival times for patients alive at t0). Delayed entry is the latter. And in that case you could try the functions 'phreg' (parametric proportional hazards models) and 'aftreg' (accelerated failure time models) in the package 'eha'. Both functions allow for left truncation, right censoring and and a choice of distributions. Göran Broström -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Etimating time to run an analysis?
Erika Barthelmess barthelmess at stlawu.edu writes: Hi everyone, I'm new to this list and have searched R help prior for an answer to this question, without luck. If I'm posting in error, please forgive. I'm thinking about using package MuMIn to do multimodel inference with logistic regression. I have many (25) possible predictors and am curious if there is a way to estimate how long the dredge command might take to run? Any suggestions most welcome. Thanks, erika This is likely to be a bad idea. With 25 predictors you have 2^25 = 33 million candidate models (you can think of an array of models, each predictor is either present or absent in each model -- that makes this a set of 25-digit binary strings ...). (If this doesn't make sense, convince yourself by writing out the number of possible models for a 1-parameter (2), 2-parameter (4), and 3-parameter (8) model, and do the extrapolation.) So pick a model of intermediate complexity, run it, see how long it takes, and multiply that by 33 million ... (if each model takes about one second to fit, the analysis will take about a year to run). You might want to look into penalized regression approaches (e.g. see the glmnet package), which are a much more efficient approach to this type of problem. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] xtable: custom row.names, move caption to top
Thanks so much, Rainer. Your detailed example has taught me a lot of what I need to use xtable more productively, in particular the options for the print() method. -Michael On 11/27/2013 12:20 PM, Rainer Schuermann wrote: UPDATE: Now including the LaTeX math formatting saxtab - t( as.data.frame( addmargins( Saxony ) ) ) rownames( saxtab ) - c( Males ($k$), Families ($n_k$) ) saxtab - xtable( saxtab, digits = 0, caption = Number of male children in 6115 Saxony families of size 12, align = l|rr ) print( saxtab, caption.placement = top, include.colnames = FALSE, hline.after = c( NULL, 0, nrow( saxtab ) ), sanitize.text.function = function(x) { x } ) % latex table generated in R 3.0.2 by xtable 1.7-1 package % Wed Nov 27 18:16:47 2013 \begin{table}[ht] \centering \caption{Number of male children in 6115 Saxony families of size 12} \begin{tabular}{l|rr} \hline Males ($k$) 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ Families ($n_k$) 324 104 286 670 1033 1343 1112 829 478 18145 7 6115 \\ \hline \end{tabular} \end{table} On Wednesday 27 November 2013 17:43:30 Rainer Schuermann wrote: You get the cation to the top of the table with print( saxtab, caption.placement = top ) Formatting the table the way you want can be done like this - I did not manage to carry the LaTeX math formatting for the row names over ($k$ and $n_k$)but the rest should be very much what you want: saxtab - t( as.data.frame( addmargins( Saxony ) ) ) rownames( saxtab ) - c( Males (k), Families (n_k) ) saxtab - xtable( saxtab, digits = 0, caption = Number of male children in 6115 Saxony families of size 12, align = l|rr ) print( saxtab, caption.placement = top, include.colnames = FALSE, hline.after = c( NULL, 0, nrow( saxtab ) ) ) % latex table generated in R 3.0.2 by xtable 1.7-1 package % Wed Nov 27 17:41:17 2013 \begin{table}[ht] \centering \caption{Number of male children in 6115 Saxony families of size 12} \begin{tabular}{l|rr} \hline Males (k) 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ Families (n\_k) 324 104 286 670 1033 1343 1112 829 478 18145 7 6115 \\ \hline \end{tabular} \end{table} On Wednesday 27 November 2013 09:24:22 Michael Friendly wrote: With xtable, I'm producing one-way tables from table objects in horizontal form as shown below. I'd like to change the labels used for the rows and move the caption to the top of the table, as is typically standard for tables. I can hand-edit, but would prefer to do it in code. data(Saxony, package=vcd) library(xtable) saxtab - xtable(t(addmargins(Saxony)), digits=0, caption=Number of male children in 6115 Saxony families of size 12) print(saxtab) print(saxtab) % latex table generated in R 3.0.1 by xtable 1.7-1 package % Wed Nov 27 09:12:16 2013 \begin{table}[ht] \centering \begin{tabular}{rrr} \hline 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ \hline 1 3 24 104 286 670 1033 1343 1112 829 478 181 45 7 6115 \\ \hline \end{tabular} \caption{Number of male children in 6115 Saxony families of size 12} \end{table} The desired form looks like this, with row.names = c(Males ($k$), Families ($n_k$)) % latex table generated in R 3.0.1 by xtable 1.7-1 package % Tue Nov 26 14:56:02 2013 \begin{table}[ht] \caption{Number of male children in 6115 Saxony families of size 12} \label{tab:saxtab} \centering \begin{tabular}{l|rr} \hline Males ($k$) 0 1 2 3 4 5 6 7 8 9 10 11 12 Sum \\ \hline Families ($n_k$) 3 24 104 286 670 1033 1343 1112 829 478 181 45 7 6115 \\ \hline \end{tabular} \end{table} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. Chair, Quantitative Methods York University Voice: 416 736-2100 x66249 Fax: 416 736-5814 4700 Keele StreetWeb: http://www.datavis.ca Toronto, ONT M3J 1P3 CANADA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Etimating time to run an analysis?
I would say that if the OP even contemplated this, it strongly suggests that she needs to consult a local statistician for help. Cheers, Bert On Wed, Nov 27, 2013 at 1:14 PM, Ben Bolker bbol...@gmail.com wrote: Erika Barthelmess barthelmess at stlawu.edu writes: Hi everyone, I'm new to this list and have searched R help prior for an answer to this question, without luck. If I'm posting in error, please forgive. I'm thinking about using package MuMIn to do multimodel inference with logistic regression. I have many (25) possible predictors and am curious if there is a way to estimate how long the dredge command might take to run? Any suggestions most welcome. Thanks, erika This is likely to be a bad idea. With 25 predictors you have 2^25 = 33 million candidate models (you can think of an array of models, each predictor is either present or absent in each model -- that makes this a set of 25-digit binary strings ...). (If this doesn't make sense, convince yourself by writing out the number of possible models for a 1-parameter (2), 2-parameter (4), and 3-parameter (8) model, and do the extrapolation.) So pick a model of intermediate complexity, run it, see how long it takes, and multiply that by 33 million ... (if each model takes about one second to fit, the analysis will take about a year to run). You might want to look into penalized regression approaches (e.g. see the glmnet package), which are a much more efficient approach to this type of problem. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Tinn-R: source code on GitHub
Dear list, The source code of Tinn-R editor is available on GitHub: https://github.com/jcfaria/Tinn-R Tinn-R is free, simple but efficient replacement for the basic code editor provided by Rgui. The project is coordinate by José Cláudio Faria/UESC/DCET. All users are welcome to make it better. LANGUAGE: Object Pascal IDE: Delphi 2007 Regards, -- ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ Jose Claudio Faria Estatistica UESC/DCET/Brasil joseclaudio.faria at gmail.com Telefones: 55(73)3680.5545 - UESC 55(73)9100.7351 - TIM 55(73)8817.6159 - OI ///\\\///\\\///\\\///\\\///\\\///\\\///\\\///\\\ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Y-axis label not plotting
On 11/28/2013 02:10 AM, Luke M wrote: Thanks for the follow-up. Per your suggestion, I was able to plot the data for the last 30 days with no problem. However... I am still confused about the y-axis labels (values, title, etc) not plotting. If the scripting works as it should, what could cause the labels not to show up? A while ago I think that I accidentally changed something (not sure what) on the default settings (I was trying to learn how to make plots), and I wonder if this could cause the problem I am having... Hi Luke, As I wrote, when I ran your code (albeit directly reading in the two variables and dropping your timezone in dates1) I got the axis label and tick labels. If it was some default setting, you shouldn't get them on _any_ plot. The following gives me a plot that looks okay. temp1-c(6.81,26.81,26.81,26.81,26.87,26.87, 26.87,26.87,27.06,27.06,27.06,27.06, 27.06,27.06,27.06,27.06,27.06,27.06, 27.06,27.06,27.06,27.06,27.06,27.06, 27.06,27.06,27.06,27.06,27.06,27.06, 27.06,27.06,27.06,27.06,27.06,27.06, 27.06,27.06,27.06,27.06,27.06,27.00, 27.00,27.06,27.06,27.06,27.00,27.00, 27.06,27.00,27.00,27.00,27.00,27.00, 27.00,27.00,27.00,26.94,26.94,26.94, 26.94,27.00,26.94,26.94,26.94,26.94, 26.94,26.94,26.94,26.94,26.94,27.00, 26.94,26.94,26.94,26.94,26.94,26.94, 26.94,26.94,26.94) dates1-c(2013-01-12 18:10:28,2013-10-24 18:10:43, 2013-10-29 18:10:49,2013-11-14 18:10:52, 2013-11-14 18:12:10,2013-11-14 18:12:12, 2013-11-14 18:12:21,2013-11-14 18:12:22, 2013-11-14 18:17:10,2013-11-14 18:17:11, 2013-11-14 18:17:13,2013-11-14 18:17:14, 2013-11-14 18:17:15,2013-11-14 18:17:17, 2013-11-14 18:17:18,2013-11-14 18:17:20, 2013-11-14 18:17:21,2013-11-14 18:17:22, 2013-11-14 18:17:24,2013-11-14 18:17:25, 2013-11-14 18:17:26,2013-11-14 18:17:28, 2013-11-14 18:17:29,2013-11-14 18:17:30, 2013-11-14 18:17:32,2013-11-14 18:17:33, 2013-11-14 18:17:34,2013-11-14 18:17:36, 2013-11-14 18:17:37,2013-11-14 18:17:38, 2013-11-14 18:17:40,2013-11-14 18:17:41, 2013-11-14 18:17:42,2013-11-14 18:17:44, 2013-11-14 18:17:45,2013-11-14 18:17:46, 2013-11-14 18:18:47,2013-11-14 18:18:48, 2013-11-14 18:18:50,2013-11-14 18:18:51, 2013-11-14 18:18:52,2013-11-14 18:18:54, 2013-11-14 18:18:55,2013-11-14 18:18:56, 2013-11-14 18:18:58,2013-11-14 18:18:59, 2013-11-14 18:19:10,2013-11-14 18:19:11, 2013-11-14 18:19:12,2013-11-14 18:19:14, 2013-11-14 18:19:15,2013-11-14 18:19:16, 2013-11-14 18:19:18,2013-11-14 18:19:19, 2013-11-14 18:19:20,2013-11-14 18:19:22, 2013-11-14 18:19:23,2013-11-14 18:20:24, 2013-11-14 18:20:26,2013-11-14 18:20:27, 2013-11-14 18:20:29,2013-11-14 18:20:30, 2013-11-14 18:20:31,2013-11-14 18:20:33, 2013-11-14 18:20:34,2013-11-14 18:20:35, 2013-11-14 18:20:37,2013-11-14 18:20:38, 2013-11-14 18:20:39,2013-11-14 18:20:41, 2013-11-14 18:20:42,2013-11-14 18:20:43, 2013-11-14 18:20:45,2013-11-14 18:20:46, 2013-11-14 18:20:47,2013-11-14 18:20:49, 2013-11-14 18:20:50,2013-11-14 18:20:51, 2013-11-14 18:20:53,2013-11-14 18:20:54, 2013-11-14 18:20:55) dates1-strptime(dates1,%Y-%m-%d %H:%M:%S) par(mar=c(5, 6, 4, 2)) plot(dates1, temp1,type=o,col=red,pch=20,xlab=x axis, main=my plot,ylab=y axis, ylim=c(0,40), yaxp = c(0,40,10)) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Requirement for Ruby on rails [REQ:10217055]
[1]Click here to unsubscribe if you no longer wish to receive our emails Dear Recruiter, Here is our Direct client requirement which can be filled immediately. Kindly respond to this requirement with your consultant resume, contact and current location info to speed up the interview process. [2]Click here to submit for this position online and to speed up the process. Job Title: Ruby on rails Location: NYC, NY # of Positions: 1, Duration: 6 Months Description: We are looking for candidates who have experience into Ruby on rails along with java, mvc architecture, front end tool, spring MVC. [3]Click here to submit for this position online and to speed up the process. Please respond with you consultant resume, contact, rate and current location info to speed up the interview process. I will contact you if I need further details. CodeForce Ranked # 57 on Forbes listings for Americas Most Promising Companies [4]http://www.forbes.com/most-promising-companies/list/ [5]http://www.forbes.com/companies/codeforce-360/ Thanks Regards, Revanth. K. Gudimalla Recruiting Manager CODEFORCE 360 ERP IT Services / Consulting Development Staffing Work: (770) 410-7770 Ext: 376 | Fax: (770) - 410 - 7737 URL: [6]www.codeforce.com| E-mail: [7]reva...@codeforce.com Gtalk: [8]revanth.recrui...@gmail.com | Yahoo: [9]revanth...@yahoo.com [10]http://www.linkedin.com/in/revanthkgudimalla [11]https://www.facebook.com/CodeForce360 [12]http://twitter.com/codeforce360 [13]http://www.linkedin.com/company/codeforce-360 Office Location: 11381 Southbridge Pkwy, Alpharetta, GA 30022 [14]Click here to unsubscribe from our mailing list and your name will be removed immediately. _ This email is generated using [15]CONREP software. [16][8011234857.jpg] G5540 References 1. http://adso.conrep.com/conrep/actions/mail/unsubscribe.php?param=QVBSSUQ9MTEwMTAwOTcyMDE5JkFQTUlEPTQyNCZDTVBDRD01NTQwJkZST009cmV2YW50aEBjb2RlZm9yY2UuY29tJlRPPXItaGVscEByLXByb2plY3Qub3JnJkpPQklEPTExMDEwMTA2MzIyNiZTVUJKPVJlcXVpcmVtZW50IGZvciBSdWJ5IG9uIHJhaWxzICBbUkVROjEwMjE3MDU1XSZ1c3JpZD0xMTAyNjU2NjA2NzkmSkJDSUQ9NjEwMDIzMTU2MTg3 2. http://adso.conrep.com/conrep/web/parse/resumeparsing/screen1.php?CUSID=5540110100010334weblinkflg=1REQID=110671124362apmid=412APMID=412RECTR=110265660638CPFID=VENID=JOBID=610023156187Source=JobPortalLEAID=110100972019SOURC=VM 3. http://adso.conrep.com/conrep/web/parse/resumeparsing/screen1.php?CUSID=5540110100010334weblinkflg=1REQID=110671124362apmid=412APMID=412RECTR=110265660638CPFID=VENID=JOBID=610023156187Source=JobPortalLEAID=110100972019SOURC=VM 4. http://www.forbes.com/most-promising-companies/list/ 5. http://www.forbes.com/companies/codeforce-360/ 6. http://www.codeforce.com%7c/ 7. mailto:reva...@codeforce.com 8. mailto:revanth.recrui...@gmail.com 9. mailto:revanth...@yahoo.com 10. http://www.linkedin.com/in/revanthkgudimalla 11. https://www.facebook.com/CodeForce360 12. http://twitter.com/codeforce360 13. http://www.linkedin.com/company/codeforce-360 14. http://adso.conrep.com/conrep/actions/mail/unsubscribe.php?param=QVBSSUQ9MTEwMTAwOTcyMDE5JkFQTUlEPTQyNCZDTVBDRD01NTQwJkZST009cmV2YW50aEBjb2RlZm9yY2UuY29tJlRPPXItaGVscEByLXByb2plY3Qub3JnJkpPQklEPTExMDEwMTA2MzIyNiZTVUJKPVJlcXVpcmVtZW50IGZvciBSdWJ5IG9uIHJhaWxzICBbUkVROjEwMjE3MDU1XSZ1c3JpZD0xMTAyNjU2NjA2NzkmSkJDSUQ9NjEwMDIzMTU2MTg3 15. http://www.conrep.com/?emlsrc=-110265660679emailed=r-help@r-project.orgT=MM 16. http://www.conrep.com/?emlsrc=-110265660679emailed=r-help@r-project.orgT=MM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] if, apply, ifelse
Hello: This seems like an obvious question, but I am having trouble answering it. I am new to R, so I apologize if its too simple to be posting. I have searched for solutions to no avail. I have data that I am trying to set up for further analysis (training data). What I need is 12 groups based on patterns of 4 variables. The complication comes in when missing data is present. Let me describe with an example - focusing on just 3 of the 12 groups: vec=c(1,1,1,1,1,1,NA,NA,1,1,0,0,1,NA,1,1,1,NA,0,0,1,NA,1,0,0,0,0,1,0,0,0,0,NA,NA,NA,NA,1,NA,0,NA,1,NA,1,NA) a=matrix(vec, ncol=4,nrow=11, byrow=T) edit(a) col1 col2 col3 col4 [1,]1111 [2,]11 NA NA [3,]1100 [4,]1 NA11 [5,]1 NA00 [6,]1 NA10 [7,]0001 [8,]0000 [9,] NA NA NA NA [10,]1 NA 0 NA [11,]1 NA1 NA Here are 11 individuals. I want the following groups (coded as three separate binary variables): Group1 - scored a 1 on col1 and multiple time Group2 - scored a 1 on col1 but only once Group3 - did not score a 1 in col1 This seems straightforward, except missingness complicates it. Take individual 5 - this person should be placed in Groups 1 AND 2 because we don'tknow the score col2. Same with individual 10, though the response pattern differs. I tried using if statements, but am running into the problem that if is not vecotrized, and I can't seem to make if run with apply. I can use ifelse, but its very clunky and inefficient to list all possible patterns: (Note this is not complete of all patterns, its just an example of what Ivebeen doing) dd$TEST1=ifelse(is.na(d$C8W1raw),1, (ifelse(d$C8W1raw==1 is.na(d$C9W1raw) is.na(d$C11AW1raw) is.na (d$C12AW1rraw),777899, (ifelse((d$C8W1raw==1 d$C9W1raw==1)| (d$C8W1raw==1 d$C11AW1raw==1) |(d$C8W1raw==1 d$C12AW1rraw==1),1, (ifelse(d$C8W1raw==1 ((is.na(d$C9W1raw) | d$C9W1raw==0) (is.na(d$C11AW1raw) | d$C11AW1raw==0) (is.na(d$C12AW1rraw)|d$C12AW1rraw==0)),777899, 0))) Any ideas on how to approach this efficiently? Thanks, Andrea [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] error message
Dear Sir/Madam I have a problem with r. I was still using it on my laptop and it then later refused to open. When I open a script, being a new script or the previous one that I have saved, it displays a message saying fatal error: unexpected error reading console input. I then uninstalled the whole programme and r-studio,and downloaded a new one. After re-installing it, when I try to open it it displays the message fatal error: unexpected exception: value type is 4 not 0. So could you please help me out. Kind regards Mosiuoa Bereng. (Mr.) [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] heat map bin locations
I am trying to construct a het map type of plot with rectangular bins colored to indicate the number of records for a given value within different categories. I am getting close to what I want with ggplot2 and stat_bin2d. However if you run the code you will se below that the placement of the bins on the graph is incorrect. Categories A and C should have equal overlap with category B but they don't. Any idea what I am doing wrong / better approaches for this? library(ggplot2) mt - as.data.frame(matrix(rep(c(A, B, C), each = 10), 30, 2)) mt[, 2] - c(rep(18, 5), rep(20, 5), rep(20, 10), rep(20, 5), rep(22,5)) colnames(mt) - c(group, count) ggplot(data=mt,aes(x=mt$count, y=mt$group)) + stat_bin2d(binwidth = c(.5, .5)) cheers Heath [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] importing many csv files into separate matrices
Hi Everyone, I am trying to import many CSV files to their own matrices. Example, alaska_93.csv to alaska. When I execute the following, for each csv.file separately it is successful. singleCSVFile2Matrix - function(x,path) { assign(gsub(pattern=.csv,x,replacement=),read.csv(paste(path,x,sep=))) } when I try to include it in a loop in another function (I have so many csv files to import), it doesn't work. I mean the following function doesn't do it. loadCSVFiles_old - function(path) { x - list.files(path) for (i in 1:length(x)) { assign(gsub(pattern=.csv,x[i],replacement=),read.csv(paste(path,x[i],sep=))) } } Instead, if I execute the foor loop in the command line, it works. I am puzzled. Appreciate any help. thanks yetik __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Find the prediction or the fitted values for an lm model
Hi, I would like to fit my data with a 4th order polynomial. Now I have only 5 data point, I should have a polynomial that exactly pass the five point Then I would like to compute the fitted or predict value with a relatively large x dataset. How can I do it? BTW, I thought the model prodfn should pass by (0,0), but I just wonder why the const is unequal to zero x1-c(0,3,4,5,8) y1-c(0,1,4,7,8) prodfn-lm(y1 ~ poly(x1, 4)) x-seq(0,8,0.01) temp-predict(prodfn,data.frame(x=x)) # This line does not work.. prodfn Call: lm(formula = y1 ~ poly(x1, 4)) Coefficients: (Intercept) poly(x1, 4)1 poly(x1, 4)2 poly(x1, 4)3 poly(x1, 4)4 4.000e+00 6.517e+00-4.918e-16-2.744e+00-8.882e-16 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.