Re: [R] csv file with two header rows
On Apr 26, 2013, at 14:48 , John Kane wrote: I don't think so. read.csv is a striped down version of read.table. You should be able to do this with the skip option there. You can also pass skip= to read.csv, it just passes it on to read.table. But it is not clear to me what is supposed to happen with the the double header, or what the file format in question is exactly. It is, e.g., quite possible to do something like hd - read.csv(..., nrows=2) df - read.csv(..., skip=2, header=FALSE) names(df) - ... some operation on hd ... John Kane Kingston ON Canada -Original Message- From: analys...@hotmail.com Sent: Thu, 25 Apr 2013 18:35:42 -0700 (PDT) To: r-help@r-project.org Subject: [R] csv file with two header rows Is there a way to use read.csv() on such a file without deleting one of the header rows? Thanks. __ 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. GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails __ 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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ 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] using metafor for meta-analysis of before-after studies
At 03:27 27/04/2013, Qiang Yue wrote: Hello, Dr. Viechtbauer. I am trying to perform a meta-analyis on a group of before-after studies using Metafor. I read your webpage including your correspondence with Dr. Dewey (https://stat.ethz.ch/pipermail/r-help/2012-April/308946.html), who also conducted a similar study. These information is very hepful, but I have one additonal question which I wonder if you can give me some instruction. The question is as follow: These studies which we are trying to analyze are performed on the same subject before and after the adminstration of intervention. Most studies reported the the Mean¡ÀSD of percentage change, i.e., the Mean¡ÀSD of (value of ¡®after¡¯-value of ¡®before¡¯)/value of ¡®before¡¯¡Á100%£¬without reporting the Mean¡ÀSD of value of ¡®after¡¯ or value of ¡®before¡¯. So I want to know if it is possible to perform meta-analyis using the value of percentage change, and if it is possible to calculate the ¡®sdi¡¯ (the standard deviation of the change scores) using the SD of percentage change. Unfortunately not all the characters in your email appeared correctly here but if I understand you correctly the primary studies have reported (for each group?) mean percentage change and its standard deviation (and presumably the n). So you just treat them like any other mean and standard deviation. If I understand the very last part correctly you would need more information than we have to back calculate change on the original scale from change on the percentage scale. Thank you very much, I am looking forward to your reply. With best wishes. Qiang Yue M.D. Visiting Scholar of IMHR, University of Ottawa 1145 Carling Avenue, K1Z 7K4, Ottawa, ON, Canada Tel: 613-722-6521 ext. 6554 Associate Professor of Radiology Department of Radiology, West China Hospital, Sichuan University Chengdu, 610041, China [[alternative HTML version deleted]] Michael Dewey i...@aghmed.fsnet.co.uk http://www.aghmed.fsnet.co.uk/home.html __ 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] csv file with two header rows
Thanks Peter, I must have misread the read.csv help. I thought skip had been dropped with a couple of other options. John Kane Kingston ON Canada -Original Message- From: pda...@gmail.com Sent: Sat, 27 Apr 2013 09:48:22 +0200 To: jrkrid...@inbox.com Subject: Re: [R] csv file with two header rows On Apr 26, 2013, at 14:48 , John Kane wrote: I don't think so. read.csv is a striped down version of read.table. You should be able to do this with the skip option there. You can also pass skip= to read.csv, it just passes it on to read.table. But it is not clear to me what is supposed to happen with the the double header, or what the file format in question is exactly. It is, e.g., quite possible to do something like hd - read.csv(..., nrows=2) df - read.csv(..., skip=2, header=FALSE) names(df) - ... some operation on hd ... John Kane Kingston ON Canada -Original Message- From: analys...@hotmail.com Sent: Thu, 25 Apr 2013 18:35:42 -0700 (PDT) To: r-help@r-project.org Subject: [R] csv file with two header rows Is there a way to use read.csv() on such a file without deleting one of the header rows? Thanks. __ 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. GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails __ 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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM®, MSN® Messenger, Yahoo!® Messenger, ICQ®, Google Talk™ and most webmails __ 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] Loading of package RNetCDF fails
Dear Pavel Michna [maintainer of the package] (and copy to R-help Mailing List) When I try to load the package RNetCDF (after install from CRAN) I get this message: library(RNetCDF, lib.loc=/Library/Frameworks/R.framework/Versions/3.0/Resources/library) Error : .onLoad a échoué dans loadNamespace() pour 'RNetCDF', détails : appel : NULL erreur : I/O error (udunits) Erreur : le chargement du package ou de l'espace de noms a échoué pour ‘RNetCDF’ Anybody have some info about what's happened ? In MacOSX 10.8.3, R3.0.0 Sincerely, Marc Girondot -- __ Marc Girondot, Pr Laboratoire Ecologie, Systématique et Evolution Equipe de Conservation des Populations et des Communautés CNRS, AgroParisTech et Université Paris-Sud 11 , UMR 8079 Bâtiment 362 91405 Orsay Cedex, France Tel: 33 1 (0)1.69.15.72.30 Fax: 33 1 (0)1.69.15.73.53 e-mail: marc.giron...@u-psud.fr Web: http://www.ese.u-psud.fr/epc/conservation/Marc.html Skype: girondot __ 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] csv file with two header rows
But it is not clear to me what is supposed to happen with the the double header, or what the file format in question is exactly. I've seen double headers in which the first line gives the names of the variables and the second their units. E.g., http://www.ndbc.noaa.gov/data/5day2/SISW1_5day.cwind contains wind data (from Smith Island, Washington) and it currently starts with #YY MM DD hh mm WDIR WSPD GDR GST GTIME #yr mo dy hr mn degT m/s degT m/s hhmm 2013 04 27 14 00 190 4.1 200 5.7 1337 2013 04 27 13 50 198 4.1 999 99.0 2013 04 27 13 40 196 4.1 999 99.0 2013 04 27 13 30 202 4.1 999 99.0 2013 04 27 13 20 199 3.6 999 99.0 2013 04 27 13 10 188 3.1 999 99.0 2013 04 27 13 00 182 3.1 210 4.1 1218 2013 04 27 12 50 198 3.1 999 99.0 And I've read them with the 2-calls-to-read.table trick you mentioned hd - read.csv(..., nrows=2) df - read.csv(..., skip=2, header=FALSE) names(df) - ... some operation on hd ... (or 3 calls, when I wanted to paste the units onto the variable name.) 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 peter dalgaard Sent: Saturday, April 27, 2013 12:48 AM To: John Kane Cc: r-help@r-project.org; analys...@hotmail.com Subject: Re: [R] csv file with two header rows On Apr 26, 2013, at 14:48 , John Kane wrote: I don't think so. read.csv is a striped down version of read.table. You should be able to do this with the skip option there. You can also pass skip= to read.csv, it just passes it on to read.table. But it is not clear to me what is supposed to happen with the the double header, or what the file format in question is exactly. It is, e.g., quite possible to do something like hd - read.csv(..., nrows=2) df - read.csv(..., skip=2, header=FALSE) names(df) - ... some operation on hd ... John Kane Kingston ON Canada -Original Message- From: analys...@hotmail.com Sent: Thu, 25 Apr 2013 18:35:42 -0700 (PDT) To: r-help@r-project.org Subject: [R] csv file with two header rows Is there a way to use read.csv() on such a file without deleting one of the header rows? Thanks. __ 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. GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM(r), MSN(r) Messenger, Yahoo!(r) Messenger, ICQ(r), Google Talk(tm) and most webmails __ 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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ 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] csv file with two header rows
And I've read them with the 2-calls-to-read.table trick you mentioned hd - read.csv(..., nrows=2) df - read.csv(..., skip=2, header=FALSE) names(df) - ... some operation on hd ... (or 3 calls, when I wanted to paste the units onto the variable name.) Or with read.table(text=readLines(http://...;)[-2]): u - http://www.ndbc.noaa.gov/data/5day2/SISW1_5day.cwind; d - read.table(text=readLines(u)[-2], header=TRUE, comment.char=, check.names=FALSE) d[1:4,] #YY MM DD hh mm WDIR WSPD GDR GST GTIME 1 2013 4 27 14 0 190 4.1 200 5.7 1337 2 2013 4 27 13 50 198 4.1 999 99.0 3 2013 4 27 13 40 196 4.1 999 99.0 4 2013 4 27 13 30 202 4.1 999 99.0 with(d, plot(complex(mod=WSPD, arg=(90-WDIR)/180*pi), asp=1)) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: William Dunlap Sent: Saturday, April 27, 2013 7:36 AM To: 'peter dalgaard'; John Kane Cc: r-help@r-project.org; analys...@hotmail.com Subject: RE: [R] csv file with two header rows But it is not clear to me what is supposed to happen with the the double header, or what the file format in question is exactly. I've seen double headers in which the first line gives the names of the variables and the second their units. E.g., http://www.ndbc.noaa.gov/data/5day2/SISW1_5day.cwind contains wind data (from Smith Island, Washington) and it currently starts with #YY MM DD hh mm WDIR WSPD GDR GST GTIME #yr mo dy hr mn degT m/s degT m/s hhmm 2013 04 27 14 00 190 4.1 200 5.7 1337 2013 04 27 13 50 198 4.1 999 99.0 2013 04 27 13 40 196 4.1 999 99.0 2013 04 27 13 30 202 4.1 999 99.0 2013 04 27 13 20 199 3.6 999 99.0 2013 04 27 13 10 188 3.1 999 99.0 2013 04 27 13 00 182 3.1 210 4.1 1218 2013 04 27 12 50 198 3.1 999 99.0 And I've read them with the 2-calls-to-read.table trick you mentioned hd - read.csv(..., nrows=2) df - read.csv(..., skip=2, header=FALSE) names(df) - ... some operation on hd ... (or 3 calls, when I wanted to paste the units onto the variable name.) 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 peter dalgaard Sent: Saturday, April 27, 2013 12:48 AM To: John Kane Cc: r-help@r-project.org; analys...@hotmail.com Subject: Re: [R] csv file with two header rows On Apr 26, 2013, at 14:48 , John Kane wrote: I don't think so. read.csv is a striped down version of read.table. You should be able to do this with the skip option there. You can also pass skip= to read.csv, it just passes it on to read.table. But it is not clear to me what is supposed to happen with the the double header, or what the file format in question is exactly. It is, e.g., quite possible to do something like hd - read.csv(..., nrows=2) df - read.csv(..., skip=2, header=FALSE) names(df) - ... some operation on hd ... John Kane Kingston ON Canada -Original Message- From: analys...@hotmail.com Sent: Thu, 25 Apr 2013 18:35:42 -0700 (PDT) To: r-help@r-project.org Subject: [R] csv file with two header rows Is there a way to use read.csv() on such a file without deleting one of the header rows? Thanks. __ 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. GET FREE SMILEYS FOR YOUR IM EMAIL - Learn more at http://www.inbox.com/smileys Works with AIM(r), MSN(r) Messenger, Yahoo!(r) Messenger, ICQ(r), Google Talk(tm) and most webmails __ 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. -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen Business School Solbjerg Plads 3, 2000 Frederiksberg, Denmark Phone: (+45)38153501 Email: pd@cbs.dk Priv: pda...@gmail.com __ 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,
[R] [R-pkgs] Version 1.3.1 of apcluster package on CRAN
Dear colleagues, This is to inform you that Version 1.3.1 of the R package apcluster has been released on CRAN. We did a major improvement of heatmap and dendrogram plotting, as well as several minor improvements of the package. For more details, see the following URLs: http://www.bioinf.jku.at/software/apcluster/ http://cran.r-project.org/web/packages/apcluster/index.html Best regards, Ulrich *Dr. Ulrich Bodenhofer* Associate Professor Institute of Bioinformatics *Johannes Kepler University* Altenberger Str. 69 4040 Linz, Austria Tel. +43 732 2468 4526 Fax +43 732 2468 4539 bodenho...@bioinf.jku.at http://www.bioinf.jku.at/ ___ R-packages mailing list r-packa...@r-project.org https://stat.ethz.ch/mailman/listinfo/r-packages __ 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] Stepwise regression for multivariate case in R?
On 26.04.2013 13:58, Jonathan Jansson wrote: Hi! I am trying to make a stepwise regression in the multivariate case, using Wilks' Lambda test. I've tried this: greedy.wilks(cbind(Y1,Y2) ~ . , data=my.data ) But it only returns: Error in model.frame.default(formula = X[, j] ~ grouping, drop.unused.levels = TRUE) : variable lengths differ (found for 'grouping') What can be wrong here? I have checked and all variables in my.data is of the same length. Simply answer: It was never intended to work for the multivariate case. I will add a stop() with a better error message. Best, Uwe Ligges //Jonathan [[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.
[R] Polynomial Regression and NA coefficients in R
Hey all, I'm performing polynomial regression. I'm simulating x values using runif() and y values using a deterministic function of x and rnorm(). When I perform polynomial regression like this: fit_poly - lm(y ~ poly(x,11,raw = TRUE)) I get some NA coefficients. I think this is due to the high correlation between say x and x^2 if x is distributed uniformly on the unit interval (as is the case in my example). However, I'm still able to plot a polynomial fit like this: points(x, predict(fit_poly), type=l, col=green, lwd=2) What I'm interested in finding out is, how R handles the NA values I get for some coefficients (and how that affects the polynomial I see plotted). Thanks! __ 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] Read big data (3G ) methods ?
I believe it was already mentioned, but I can recommend the LaF package (not completely impartial being the maintainer of LaF ;-) However, the speed differences between packages will not be very large. Eventually all packages will have to read in 6 GB of data and convert the text data to numeric data. So the tricks are to 1 only read in columns that you need 2 only read in lines that you need 3 and if you need to read the data more than once convert it to some binary format first (RDS, ff, sqlite, bigmemory, ...). Most packages have routines to convert CSV files to the binary format. With all of the above LaF helps. ffbase contains a routine laf_to_ffdf to convert to to ff format. HTH, Jan On 04/27/2013 04:34 AM, Kevin Hao wrote: Thank you very much. More and more methods are coming. That sounds great! Thanks, kevin On Fri, Apr 26, 2013 at 7:51 PM, Duncan Murdoch murdoch.dun...@gmail.comwrote: On 13-04-26 3:00 PM, Kevin Hao wrote: Hi Ye, Thanks. That is a good method. have any other methods instead of using database? If you know the format of the file, you can probably write something in C (or other language) that is faster than R. Convert your .csv file to a nice binary format, and R will read it in no time at all. If writing it in C is hard, then R is probably a better use of your time. Read the file once, write it out using saveRDS(), and read it in using readRDS() after that. In either case, the secret is to do the conversion from ugly character encoded numbers to beautiful binary numbers just once. Duncan Murdoch kevin On Fri, Apr 26, 2013 at 1:58 PM, Ye Lin ye...@lbl.gov wrote: Have you think of build a database then then let R read it thru that db instead of your desktop? On Fri, Apr 26, 2013 at 8:09 AM, Kevin Hao rfans4ch...@gmail.com wrote: Hi all scientists, Recently, I am dealing with big data ( 3G txt or csv format ) in my desktop (windows 7 - 64 bit version), but I can not read them faster, thought I search from internet. [define colClasses for read.table, cobycol and limma packages I have use them, but it is not so fast]. Could you share your methods to read big data to R faster? Though this is an odd question, but we need it really. Any suggest appreciates. Thank you very much. kevin [[alternative HTML version deleted]] __** R-help@r-project.org mailing list https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/**posting-guide.htmlhttp://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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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. __ 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] Error Installing packages
On 26.04.2013 19:15, Pramod Anugu wrote: I am trying to install the package boss but i am getting error below: Please advice Well, it says configure: error: netcdf header netcdf.h not found so perhaps you do not have the netcdf headers installed? Best, Uwe Ligges install.packages(boss) --- Please select a CRAN mirror for use in this session --- CRAN mirror 1: 0-Cloud 2: Argentina (La Plata) 3: Argentina (Mendoza) 4: Australia (Canberra) 5: Australia (Melbourne) 6: Austria 7: Belgium 8: Brazil (PR) 9: Brazil (RJ) 10: Brazil (SP 1) 11: Brazil (SP 2)12: Canada (BC) 13: Canada (NS) 14: Canada (ON) 15: Canada (QC 1)16: Canada (QC 2) 17: Chile18: China (Beijing 1) 19: China (Beijing 2)20: China (Guangzhou) 21: China (Hefei)22: China (Xiamen) 23: Colombia (Bogota)24: Colombia (Cali) 25: Denmark 26: Ecuador 27: France (Lyon 1) 28: France (Lyon 2) 29: France (Montpellier) 30: France (Paris 1) 31: France (Paris 2) 32: Germany (Berlin) 33: Germany (Bonn) 34: Germany (Falkenstein) 35: Germany (Goettingen) 36: Greece 37: Hungary 38: India 39: Indonesia40: Iran 41: Ireland 42: Italy (Milano) 43: Italy (Padua)44: Italy (Palermo) 45: Japan (Hyogo)46: Japan (Tsukuba) 47: Japan (Tokyo)48: Korea (Seoul 1) 49: Korea (Seoul 2) 50: Latvia 51: Mexico (Mexico City) 52: Mexico (Texcoco) 53: Netherlands (Amsterdam) 54: Netherlands (Utrecht) 55: New Zealand 56: Norway 57: Philippines 58: Poland 59: Portugal 60: Russia 61: Singapore62: Slovakia 63: South Africa (Cape Town) 64: South Africa (Johannesburg) 65: Spain (Madrid) 66: Sweden 67: Switzerland 68: Taiwan (Taichung) 69: Taiwan (Taipei) 70: Thailand 71: Turkey 72: UK (Bristol) 73: UK (London) 74: UK (St Andrews) 75: USA (CA 1) 76: USA (CA 2) 77: USA (IA) 78: USA (IN) 79: USA (KS) 80: USA (MD) 81: USA (MI) 82: USA (MO) 83: USA (OH) 84: USA (OR) 85: USA (PA 1) 86: USA (PA 2) 87: USA (TN) 88: USA (TX 1) 89: USA (WA 1) 90: USA (WA 2) 91: Venezuela92: Vietnam Selection: 86 also installing the dependency 'ncdf' trying URL 'http://cran.mirrors.hoobly.com/src/contrib/ncdf_1.6.6.tar.gz' Content type 'application/x-gzip' length 79403 bytes (77 Kb) opened URL == downloaded 77 Kb trying URL 'http://cran.mirrors.hoobly.com/src/contrib/boss_1.2.tar.gz' Content type 'application/x-gzip' length 9702 bytes opened URL == downloaded 9702 bytes * installing *source* package 'ncdf' ... ** package 'ncdf' successfully unpacked and MD5 sums checked checking for nc-config... no checking for gcc... gcc -std=gnu99 checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... no checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc -std=gnu99 accepts -g... yes checking for gcc -std=gnu99 option to accept ISO C89... none needed checking how to run the C preprocessor... gcc -std=gnu99 -E checking for grep that handles long lines and -e... /bin/grep checking for egrep... /bin/grep -E checking for ANSI C header files... yes checking for sys/types.h... yes checking for sys/stat.h... yes checking for stdlib.h... yes checking for string.h... yes checking for memory.h... yes checking for strings.h... yes checking for inttypes.h... yes checking for stdint.h... yes checking for unistd.h... yes checking netcdf.h usability... no checking netcdf.h presence... no checking for netcdf.h... no configure: error: netcdf header netcdf.h not found ERROR: configuration failed for package 'ncdf' * removing '/share/apps/R-2.15.3/lib64/R/library/ncdf' ERROR: dependency 'ncdf' is not available for package 'boss' * removing '/share/apps/R-2.15.3/lib64/R/library/boss' The downloaded source packages are in '/tmp/RtmppOWF74/downloaded_packages' Updating HTML index of packages in '.Library' Making packages.html ... done Warning messages: 1: In install.packages(boss) : installation of package 'ncdf' had non-zero exit status 2: In install.packages(boss) : installation of package 'boss' had
Re: [R] the joy of spreadsheets (off-topic)
I once had a discussion with an economist who told me in almost these exact words: I don't care what the data say, the theory is so clear. albyn On 2013-04-26 9:30, William Dunlap wrote: The prior for the incompetence/malice question is usually best set pretty heavily in favour of incompetence ... The following comment on economic research is from a 2010 article in the Atlantic reviewing John Ioannidis' work. http://www.theatlantic.com/magazine/print/2010/11/lies-damned-lies-and-medical-science/308269/ Medical research is not especially plagued with wrongness. Other meta-research experts have confirmed that similar issues distort research in all fields of science, from physics to economics (where the highly regarded economists J. Bradford DeLong and Kevin Lang once showed how a remarkably consistent paucity of strong evidence in published economics studies made it unlikely that any of them were right). 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: Friday, April 26, 2013 9:08 AM To: Thomas Adams; peter dalgaard Cc: r-help Subject: Re: [R] the joy of spreadsheets (off-topic) One might wonder if the Excel error was indeed THAT or perhaps a way to get the desired results, give the other issues in their analysis? The prior for the incompetence/malice question is usually best set pretty heavily in favour of incompetence ... S *** 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. __ 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] Loading of package RNetCDF fails
On 27/04/2013 14:40, Marc Girondot wrote: Dear Pavel Michna [maintainer of the package] (and copy to R-help Mailing List) When I try to load the package RNetCDF (after install from CRAN) I get this message: library(RNetCDF, lib.loc=/Library/Frameworks/R.framework/Versions/3.0/Resources/library) Error : .onLoad a échoué dans loadNamespace() pour 'RNetCDF', détails : appel : NULL erreur : I/O error (udunits) Erreur : le chargement du package ou de l'espace de noms a échoué pour ‘RNetCDF’ Anybody have some info about what's happened ? In MacOSX 10.8.3, R3.0.0 Sincerely, Marc Girondot This is to do with the CRAN binary package. Please *DO* as we ask and discuss such issues on R-sig-mac. You have been reminded before -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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] the joy of spreadsheets (off-topic)
Pretty scary... On Sat, Apr 27, 2013 at 12:28 PM, Albyn Jones jo...@reed.edu wrote: I once had a discussion with an economist who told me in almost these exact words: I don't care what the data say, the theory is so clear. albyn On 2013-04-26 9:30, William Dunlap wrote: The prior for the incompetence/malice question is usually best set pretty heavily in favour of incompetence ... The following comment on economic research is from a 2010 article in the Atlantic reviewing John Ioannidis' work. http://www.theatlantic.com/**magazine/print/2010/11/lies-** damned-lies-and-medical-**science/308269/http://www.theatlantic.com/magazine/print/2010/11/lies-damned-lies-and-medical-science/308269/ Medical research is not especially plagued with wrongness. Other meta-research experts have confirmed that similar issues distort research in all fields of science, from physics to economics (where the highly regarded economists J. Bradford DeLong and Kevin Lang once showed how a remarkably consistent paucity of strong evidence in published economics studies made it unlikely that any of them were right). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-** project.org r-help-boun...@r-project.org] On Behalf Of S Ellison Sent: Friday, April 26, 2013 9:08 AM To: Thomas Adams; peter dalgaard Cc: r-help Subject: Re: [R] the joy of spreadsheets (off-topic) One might wonder if the Excel error was indeed THAT or perhaps a way to get the desired results, give the other issues in their analysis? The prior for the incompetence/malice question is usually best set pretty heavily in favour of incompetence ... S *** 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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Thomas E Adams, III 718 McBurney Drive Lebanon, OH 45036 1 (513) 739-9512 (cell) [[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] Predictions with missing inputs
On 25.04.2013 18:12, tonitogomez wrote: Hi Bill, Very clear response. How about when the missing values are on the response variable being predicted (y)? That is, the model is fitted only to complete cases, but then I want to have predictions for all individual y (including those missing). Can I use the mean for that variable 'y'? EXAMPLE: mynewdata - mydata mynewdata$y-mean(mydata$y) mypred - predict(mymodel, mynewdata) Err, if y is your response, you do not need them for prediction... Best, Uwe Ligges Thanks, Manuel -- View this message in context: http://r.789695.n4.nabble.com/Predictions-with-missing-inputs-tp3302303p4665411.html Sent from the R help mailing list archive at Nabble.com. __ 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] Polynomial Regression and NA coefficients in R
Inline. -- Bert On Sat, Apr 27, 2013 at 8:48 AM, Lucas Holland hollandlu...@gmail.com wrote: Hey all, I'm performing polynomial regression. I'm simulating x values using runif() and y values using a deterministic function of x and rnorm(). When I perform polynomial regression like this: fit_poly - lm(y ~ poly(x,11,raw = TRUE)) I get some NA coefficients. I think this is due to the high correlation between say x and x^2 if x is distributed uniformly on the unit interval (as is the case in my example). However, I'm still able to plot a polynomial fit like this: points(x, predict(fit_poly), type=l, col=green, lwd=2) What I'm interested in finding out is, how R handles the NA values I get for some coefficients (and how that affects the polynomial I see plotted). It ignores them, i.e. treats them as 0. You are overfitting. See the singular.ok argument. Incidentally, using high order polynomials as data smoothers is nowadays usually frowned on. Consider using splines or other effectively local smoothers instead. R has many alternatives. -- Bert Thanks! __ 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 Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ 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] Polynomial Regression and NA coefficients in R
Hi Lucas, You may find some of these examples useful (towards the end): http://elkhartgroup.com/rmodels.php For example in your case you could be using b splines instead of an 11th order polynomial, or use thin plate regression splines from the mgcv package. I will also humbly suggest that ggplot2 overlaying observed values with predicted lines is a more elegant way to visualize the data and the results. Cheers, Josh On Sat, Apr 27, 2013 at 8:48 AM, Lucas Holland hollandlu...@gmail.comwrote: Hey all, I'm performing polynomial regression. I'm simulating x values using runif() and y values using a deterministic function of x and rnorm(). When I perform polynomial regression like this: fit_poly - lm(y ~ poly(x,11,raw = TRUE)) I get some NA coefficients. I think this is due to the high correlation between say x and x^2 if x is distributed uniformly on the unit interval (as is the case in my example). However, I'm still able to plot a polynomial fit like this: points(x, predict(fit_poly), type=l, col=green, lwd=2) What I'm interested in finding out is, how R handles the NA values I get for some coefficients (and how that affects the polynomial I see plotted). Thanks! __ 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. -- Joshua Wiley Ph.D. Student, Health Psychology University of California, Los Angeles http://joshuawiley.com/ Senior Analyst - Elkhart Group Ltd. http://elkhartgroup.com [[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] Manhattan Plot
Hi, Tenfei, I have two group of data composed of gene mutation and deletion on specific sites. Will it be possible for me to use the Manhattan Plot for comparison? Thank you for you attention! Li-Wu Guo, Ph.D. Sent from Windows Mail [[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] Bls: RE: example
Dear Sir, Yes, I want to generate the data by two Gaussian but mean from one of them generatated from polar its coordinates. I am confused about the algorithm? I know how to generate two Gaussian data with certain meancovariance matrix using mvnorm but what about mean from its polar coordinates? Thanks for your help. Best wishes, Iut --Pesan Asli-- Dari: John Kane Ke: Iut Tri Utami Ke: r-help@r-project.org Perihal: RE: [R] example Terkirim: 27 Apr 2013 8:19 PM https://github.com/hadley/devtools/wiki/Reproducibility http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example It is not clear what you want. Do you need to generate the data or do something with existing data? John Kane Kingston ON Canada -Original Message- From: triutami@gmail.com Sent: Sat, 27 Apr 2013 01:38:23 +0700 To: r-help@r-project.org Subject: [R] example Dear Sir, My name is Iut Tri Utami. i am beginning user. I have a problem about generate data in R. It consists of one disk generated by a Gaussian N(0, 0.167) and one ring generated by a Gaussian N(R, 0.1). The mean R was generated from its polar coordinates. The angle was drawn from a uniform distribution on the interval (0, 2p), and the radius, from a Gaussian N(1.5, 0.1). The class sizes are 500 and 2000. Thank you very much for your attention and, I wish that you will help me. Best wishes , Iut Tri Utami [[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. Send your photos by email in seconds... TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if3 Works in all emails, instant messengers, blogs, forums and social networks. Sent from my BlackBerry® smartphone from Sinyal Bagus XL, Nyambung Teruuusss...! __ 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] example
https://github.com/hadley/devtools/wiki/Reproducibility http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example It is not clear what you want. Do you need to generate the data or do something with existing data? John Kane Kingston ON Canada -Original Message- From: triutami@gmail.com Sent: Sat, 27 Apr 2013 01:38:23 +0700 To: r-help@r-project.org Subject: [R] example Dear Sir, My name is Iut Tri Utami. i am beginning user. I have a problem about generate data in R. It consists of one disk generated by a Gaussian N(0, 0.167) and one ring generated by a Gaussian N(R, 0.1). The mean R was generated from its polar coordinates. The angle was drawn from a uniform distribution on the interval (0, 2p), and the radius, from a Gaussian N(1.5, 0.1). The class sizes are 500 and 2000. Thank you very much for your attention and, I wish that you will help me. Best wishes , Iut Tri Utami [[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. Send your photos by email in seconds... TRY FREE IM TOOLPACK at http://www.imtoolpack.com/default.aspx?rc=if3 Works in all emails, instant messengers, blogs, forums and social networks. __ 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] csv file with two header rows
On Apr 26, 8:17 pm, David Winsemius dwinsem...@comcast.net wrote: On Apr 25, 2013, at 6:35 PM, analys...@hotmail.com wrote: Is there a way to use read.csv() on such a file without deleting one of the header rows? What do you mean by one of the header rows? -- David Winsemius Alameda, CA, USA The file is imported from an external source and for some reason there are two header rows each with a set of names for the columns. It would get refreshed from time to time amd I don't want to have to remember to remove one of them by hand (its a huge file and its not easy to get it into an editor) each time before R processing. But the skip option suggested by the other posters did the job - thanks to all (and it turns out the second set of names is more English-like anyways). __ r-h...@r-project.org mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://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] using metafor for meta-analysis of before-after studies
Hello, Michael. Thanks for your kind and rapid reply, and sorry for the inconvenience of characters. Yes, the primary studies reported the n, the mean percentage change and its standard deviation, but some did not report the original value of before- or after-intervention, and there is only one group because these are uncontrolled before-and-after studies. So you mean we can not perform meta-analysis based on the mean percentage change and its standard deviation? For studies which have reported the original value of before- and after-intervention, can I just simply treat the before-intervention values as the values of control group and treat the after-intervention values as the values of intervention group? I will be grateful if you can send me some of your publications of meta-analysis on before-after study, thus I can learn how to perform the analysis. With best regards. Qiang Yue From: Michael Dewey Date: 2013-04-27 07:28 To: qiangmoon; wvb CC: r-help Subject: Re: [R] using metafor for meta-analysis of before-after studies At 03:27 27/04/2013, Qiang Yue wrote: Hello, Dr. Viechtbauer. I am trying to perform a meta-analyis on a group of before-after studies using Metafor. I read your webpage including your correspondence with Dr. Dewey (https://stat.ethz.ch/pipermail/r-help/2012-April/308946.html), who also conducted a similar study. These information is very hepful, but I have one additonal question which I wonder if you can give me some instruction. The question is as follow: These studies which we are trying to analyze are performed on the same subject before and after the adminstration of intervention. Most studies reported the the Mean¡ÃSD of percentage change, i.e., the Mean¡ÃSD of (value of ¡®after¡¯-value of ¡®before¡¯)/value of ¡®before¡¯¡Ã100%£¬without reporting the Mean¡ÃSD of value of ¡®after¡¯ or value of ¡®before¡¯. So I want to know if it is possible to perform meta-analyis using the value of percentage change, and if it is possible to calculate the ¡®sdi¡¯ (the standard deviation of the change scores) using the SD of percentage change. Unfortunately not all the characters in your email appeared correctly here but if I understand you correctly the primary studies have reported (for each group?) mean percentage change and its standard deviation (and presumably the n). So you just treat them like any other mean and standard deviation. If I understand the very last part correctly you would need more information than we have to back calculate change on the original scale from change on the percentage scale. Thank you very much, I am looking forward to your reply. With best wishes. Qiang Yue M.D. Visiting Scholar of IMHR, University of Ottawa 1145 Carling Avenue, K1Z 7K4, Ottawa, ON, Canada Tel: 613-722-6521 ext. 6554 Associate Professor of Radiology Department of Radiology, West China Hospital, Sichuan University Chengdu, 610041, China [[alternative HTML version deleted]] Michael Dewey i...@aghmed.fsnet.co.uk http://www.aghmed.fsnet.co.uk/home.html [[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] the joy of spreadsheets (off-topic)
Maurice Allais (1988 Nobel Laureate in Economics) once said something to the effect that economics can never be a science because it involves self-interest. * * It has been said that Euclid's theorem would have been bitterly contested had its implications brought financial or political interests into play. This is no exaggeration. One of the Roman emperors had the first inventor of aluminum put to death because he considered the discovery liable to injure certain vested interests. There is no other explanation for the secular resistance to technical progress. In France the supply of the first printed cotton garments cost the lives of thousands of people in the 18th century, and in the 19th, the most active opponents of railway development were the stagecoach drivers and owners. Recent history confirms centuries of experience. (Maurice Allais: Economics as a Science, Librairie Droz, Geneve 1968, page 19.) Nuri On Sat, 27 Apr 2013, Thomas Adams wrote: Pretty scary... On Sat, Apr 27, 2013 at 12:28 PM, Albyn Jones jo...@reed.edu wrote: I once had a discussion with an economist who told me in almost these exact words: I don't care what the data say, the theory is so clear. albyn On 2013-04-26 9:30, William Dunlap wrote: The prior for the incompetence/malice question is usually best set pretty heavily in favour of incompetence ... The following comment on economic research is from a 2010 article in the Atlantic reviewing John Ioannidis' work. http://www.theatlantic.com/**magazine/print/2010/11/lies-** damned-lies-and-medical-**science/308269/http://www.theatlantic.com/magazine/print/2010/11/lies-damned-lies-and-medical-science/308269/ Medical research is not especially plagued with wrongness. Other meta-research experts have confirmed that similar issues distort research in all fields of science, from physics to economics (where the highly regarded economists J. Bradford DeLong and Kevin Lang once showed how a remarkably consistent paucity of strong evidence in published economics studies made it unlikely that any of them were right). Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-** project.org r-help-boun...@r-project.org] On Behalf Of S Ellison Sent: Friday, April 26, 2013 9:08 AM To: Thomas Adams; peter dalgaard Cc: r-help Subject: Re: [R] the joy of spreadsheets (off-topic) One might wonder if the Excel error was indeed THAT or perhaps a way to get the desired results, give the other issues in their analysis? The prior for the incompetence/malice question is usually best set pretty heavily in favour of incompetence ... S *** 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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Thomas E Adams, III 718 McBurney Drive Lebanon, OH 45036 1 (513) 739-9512 (cell) [[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] Read big data (3G ) methods ?
thank you all very much. Kevin On Sat, Apr 27, 2013 at 11:51 AM, Jan van der Laan rh...@eoos.dds.nlwrote: I believe it was already mentioned, but I can recommend the LaF package (not completely impartial being the maintainer of LaF ;-) However, the speed differences between packages will not be very large. Eventually all packages will have to read in 6 GB of data and convert the text data to numeric data. So the tricks are to 1 only read in columns that you need 2 only read in lines that you need 3 and if you need to read the data more than once convert it to some binary format first (RDS, ff, sqlite, bigmemory, ...). Most packages have routines to convert CSV files to the binary format. With all of the above LaF helps. ffbase contains a routine laf_to_ffdf to convert to to ff format. HTH, Jan On 04/27/2013 04:34 AM, Kevin Hao wrote: Thank you very much. More and more methods are coming. That sounds great! Thanks, kevin On Fri, Apr 26, 2013 at 7:51 PM, Duncan Murdoch murdoch.dun...@gmail.com **wrote: On 13-04-26 3:00 PM, Kevin Hao wrote: Hi Ye, Thanks. That is a good method. have any other methods instead of using database? If you know the format of the file, you can probably write something in C (or other language) that is faster than R. Convert your .csv file to a nice binary format, and R will read it in no time at all. If writing it in C is hard, then R is probably a better use of your time. Read the file once, write it out using saveRDS(), and read it in using readRDS() after that. In either case, the secret is to do the conversion from ugly character encoded numbers to beautiful binary numbers just once. Duncan Murdoch kevin On Fri, Apr 26, 2013 at 1:58 PM, Ye Lin ye...@lbl.gov wrote: Have you think of build a database then then let R read it thru that db instead of your desktop? On Fri, Apr 26, 2013 at 8:09 AM, Kevin Hao rfans4ch...@gmail.com wrote: Hi all scientists, Recently, I am dealing with big data ( 3G txt or csv format ) in my desktop (windows 7 - 64 bit version), but I can not read them faster, thought I search from internet. [define colClasses for read.table, cobycol and limma packages I have use them, but it is not so fast]. Could you share your methods to read big data to R faster? Though this is an odd question, but we need it really. Any suggest appreciates. Thank you very much. kevin [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-helphttps://stat.ethz.ch/mailman/**listinfo/r-help https://stat.**ethz.ch/mailman/listinfo/r-**helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.R-project.org/**posting-guide.html http://www.**R-project.org/posting-guide.**htmlhttp://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-helphttps://stat.ethz.ch/mailman/**listinfo/r-help https://stat.**ethz.ch/mailman/listinfo/r-**helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html http://www.R-project.org/**posting-guide.htmlhttp://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-helphttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/** posting-guide.html 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.
[R] path reference problems in R 3.0.0
Hi- I just upgraded R to 3.0.0 from 2.15.1 (which worked fine). When I started trying to install updated versions of the libraries, I saw the following error: install.packages(lme4) Installing package into 'c:/Docume~1/melissa/R/win-library/3.0' (as 'lib' is unspecified) Warning in install.packages : path[1]=c:/Docume~1/melissa/R/win-library/3.0: Access is denied trying URL 'http://cran.case.edu/bin/windows/contrib/3.0/lme4_0.99-2.zip' Content type 'application/zip' length 1408286 bytes (1.3 Mb) opened URL downloaded 1.3 Mb Error in install.packages : path[1]=c:\Docume~1\melissa\R\win-library\3.0: Access is denied At that point, I noticed that a similar error was occurring when R loads: Warning message: In normalizePath(path.expand(path), winslash, mustWork) : path[1]=c:/Docume~1/melissa/R/win-library/3.0: Access is denied The relevant directory does exist, although it keeps getting set to read-only. I can't imagine that being a big issue if I'm running R as an administrator though C:\Users\melissa\R\win-library\3.0 Also, I can successfully install packages into other directories (e.g. when running as an administrator, this works fine): install.packages(lme4, lib=C:/Program Files/R/R-3.0.0/library) trying URL 'http://cran.case.edu/bin/windows/contrib/3.0/lme4_0.99-2.zip' Content type 'application/zip' length 1408286 bytes (1.3 Mb) opened URL downloaded 1.3 Mb package 'lme4' successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\melissa\AppData\Local\Temp\RtmpEXtf89\downloaded_packages This will allow me to work with most R packages, but not Bioconductor, due path to the references in the biocLite source file. I haven't seen any other messages regarding similar issues, so I'm not sure what is going on. I've tried reinstalling R, (although I didn't try a fresh download). Other relevant details: This is a personal computer running windows 7. Any thoughts or ideas of how to get this to work? Thank you! Melissa Key [[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] r syntax
Hi i want to recode Male =1 and female =2 in R what is the syntax for same ? thanks Sameer [[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 in `contrasts-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
i am getting the following error Error in `contrasts-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels can any on e suggest how torectify [[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
Hello, I have a question and need your help urgently. I am new to R but want to learn it. I have several files in a folder which I have imported to R using : temp = list.files(pattern=*.txt) myfiles = lapply(temp, read.delim) The resulting files are on the workspace stored as List[110]. So they are 110 files in the list. Each file has several different columns and rows. My question: I would like to find and replace -999.99M with NA; Find 'T','C','A','F' and 'Y', delete them from all the 110 files. Then, I want to write.table all the corrected files back to a folder on my computer. Thanks for your help. Atem. From: r-help-requ...@r-project.org r-help-requ...@r-project.org Sent: Friday, April 26, 2013 11:08 AM Subject: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Mailing list subscription confirmation notice for mailing list R-help We have received a request from 129.132.148.130 for subscription of r-help@r-project.org mailing list. To confirm that you want to be added to this mailing list, simply reply to this message, keeping the Subject: header intact. Or visit this web page: https://stat.ethz.ch/mailman/confirm/r-help/bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Or include the following line -- and only the following line -- in a message to r-help-requ...@r-project.org: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Note that simply sending a `reply' to this message should work from most mail readers, since that usually leaves the Subject: line in the right form (additional Re: text in the Subject: is okay). If you do not wish to be subscribed to this list, please simply disregard this message. If you think you are being maliciously subscribed to the list, or have any other questions, send them to r-help-ow...@r-project.org. [[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] find and replace missing data in several different files
Hello, I have a question and need your help urgently. I am new to R but want to learn it. I have several files in a folder which I have imported to R using : temp = list.files(pattern=*.txt) myfiles = lapply(temp, read.delim) The resulting files are on the workspace stored as List[110]. So they are 110 files in the list. Each file has several different columns and rows. My question: I would like to find and replace -999.99M with NA; Find 'T','C','A','F' and 'Y', delete them from all the 110 files. Then, I want to write.table all the corrected files back to a folder on my computer. Thanks for your help. Atem. From: r-help-requ...@r-project.org r-help-requ...@r-project.org Sent: Friday, April 26, 2013 11:08 AM Subject: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Mailing list subscription confirmation notice for mailing list R-help We have received a request from 129.132.148.130 for subscription of r-help@r-project.org mailing list. To confirm that you want to be added to this mailing list, simply reply to this message, keeping the Subject: header intact. Or visit this web page: https://stat.ethz.ch/mailman/confirm/r-help/bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Or include the following line -- and only the following line -- in a message to r-help-requ...@r-project.org: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Note that simply sending a `reply' to this message should work from most mail readers, since that usually leaves the Subject: line in the right form (additional Re: text in the Subject: is okay). If you do not wish to be subscribed to this list, please simply disregard this message. If you think you are being maliciously subscribed to the list, or have any other questions, send them to r-help-ow...@r-project.org. [[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] path reference problems in R 3.0.0
On Sat, Apr 27, 2013 at 3:08 PM, Melissa Key mkche...@mac.com wrote: Hi- I just upgraded R to 3.0.0 from 2.15.1 (which worked fine). When I started trying to install updated versions of the libraries, I saw the following error: install.packages(lme4) Installing package into 'c:/Docume~1/melissa/R/win-library/3.0' (as 'lib' is unspecified) Warning in install.packages : path[1]=c:/Docume~1/melissa/R/win-library/3.0: Access is denied trying URL 'http://cran.case.edu/bin/windows/contrib/3.0/lme4_0.99-2.zip' Content type 'application/zip' length 1408286 bytes (1.3 Mb) opened URL downloaded 1.3 Mb Error in install.packages : path[1]=c:\Docume~1\melissa\R\win-library\3.0: Access is denied At that point, I noticed that a similar error was occurring when R loads: Warning message: In normalizePath(path.expand(path), winslash, mustWork) : path[1]=c:/Docume~1/melissa/R/win-library/3.0: Access is denied The relevant directory does exist, although it keeps getting set to read-only. I can't imagine that being a big issue if I'm running R as an administrator though C:\Users\melissa\R\win-library\3.0 Also, I can successfully install packages into other directories (e.g. when running as an administrator, this works fine): install.packages(lme4, lib=C:/Program Files/R/R-3.0.0/library) trying URL 'http://cran.case.edu/bin/windows/contrib/3.0/lme4_0.99-2.zip' Content type 'application/zip' length 1408286 bytes (1.3 Mb) opened URL downloaded 1.3 Mb package 'lme4' successfully unpacked and MD5 sums checked The downloaded binary packages are in C:\Users\melissa\AppData\Local\Temp\RtmpEXtf89\downloaded_packages This will allow me to work with most R packages, but not Bioconductor, due path to the references in the biocLite source file. I haven't seen any other messages regarding similar issues, so I'm not sure what is going on. I've tried reinstalling R, (although I didn't try a fresh download). Other relevant details: This is a personal computer running windows 7. Any thoughts or ideas of how to get this to work? 1. Grab the batchfiles distribution: http://batchfiles.googlecode.com and place R.bat on your Windows PATH; then at the Windows cmd line enter R.bat gui and see if that works. (See batchfiles.pdf for more info.) 2. If that works you are done but if that does not work then suitably set the paths by hand in Rpathset.bat (the example settings should give you the idea) and from the Windows cmd line enter: Rpathset.bat Rgui.exe __ 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] Help
HI, Find 'T','C','A','F' and 'Y', delete them from all the 110 files I assume that you meant to replace it with NA. set.seed(28) myfiles- lapply(1:5,function(i) as.data.frame(matrix(sample(c(LETTERS,-999.99M),40*i,replace=TRUE),ncol=(40*i)/8),stringsAsFactors=FALSE)) myfiles[[1]] # V1 V2 V3 V4 V5 #1 A P K O Y #2 C Z S M Y #3 M S -999.99M G I #4 X R M G X #5 C Q G A P #6 U W G B K #7 A N Z X R #8 X I F M K res-lapply(myfiles,function(x) {x1-unlist(x); x1[x1%in% c(-999.99M,T,C,A,F,Y)]-NA;as.data.frame(matrix(x1,ncol=ncol(x)),stringsAsFactors=FALSE)}) res[[1]] # V1 V2 V3 V4 V5 #1 NA P K O NA #2 NA Z S M NA #3 M S NA G I #4 X R M G X #5 NA Q G NA P #6 U W G B K #7 NA N Z X R #8 X I NA M K lapply(seq_along(res),function(i) write.table(res[[i]],paste0(file,i,.txt),row.names=FALSE,quote=FALSE)) A.K. - Original Message - From: Zilefac Elvis zilefacel...@yahoo.com To: r-help@r-project.org r-help@r-project.org Cc: Sent: Saturday, April 27, 2013 11:20 AM Subject: [R] Help Hello, I have a question and need your help urgently. I am new to R but want to learn it. I have several files in a folder which I have imported to R using : temp = list.files(pattern=*.txt) myfiles = lapply(temp, read.delim) The resulting files are on the workspace stored as List[110]. So they are 110 files in the list. Each file has several different columns and rows. My question: I would like to find and replace -999.99M with NA; Find 'T','C','A','F' and 'Y', delete them from all the 110 files. Then, I want to write.table all the corrected files back to a folder on my computer. Thanks for your help. Atem. From: r-help-requ...@r-project.org r-help-requ...@r-project.org Sent: Friday, April 26, 2013 11:08 AM Subject: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Mailing list subscription confirmation notice for mailing list R-help We have received a request from 129.132.148.130 for subscription of r-help@r-project.org mailing list. To confirm that you want to be added to this mailing list, simply reply to this message, keeping the Subject: header intact. Or visit this web page: https://stat.ethz.ch/mailman/confirm/r-help/bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Or include the following line -- and only the following line -- in a message to r-help-requ...@r-project.org: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Note that simply sending a `reply' to this message should work from most mail readers, since that usually leaves the Subject: line in the right form (additional Re: text in the Subject: is okay). If you do not wish to be subscribed to this list, please simply disregard this message. If you think you are being maliciously subscribed to the list, or have any other questions, send them to r-help-ow...@r-project.org. [[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] r syntax
Hello, You should provide us with a data example. In the following, the two solutions are completely different but both of them do what you want. Note that the second creates a factor variable, whose levels are coded as integers. See R-intro.pdf in your doc directory, chapter 4 Ordered and unordered factors. x - sample(c(Male, Female), 10, replace = TRUE) y1 - ifelse(x == Male, 1L, 2L) y2 - factor(x, levels = c(Male, Female)) Hope this helps, Rui Barradas Em 27-04-2013 15:32, sgs sys escreveu: Hi i want to recode Male =1 and female =2 in R what is the syntax for same ? thanks Sameer [[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] Manhattan Plot
Just because it is possible to make a plot, doesn't mean it's a good idea. It would depend on what you're trying to show. -- H On 27 April 2013 17:21, lw...@yahoo.com lw...@yahoo.com wrote: Hi, Tenfei, I have two group of data composed of gene mutation and deletion on specific sites. Will it be possible for me to use the Manhattan Plot for comparison? Thank you for you attention! Li-Wu Guo, Ph.D. Sent from Windows Mail [[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. -- Sent from my mobile device Envoyait de mon portable [[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] Error in `contrasts-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) :
You didn't show an example of how to recreate your problem, but this shows up when a term in a model is a factor (or character) variable with no variation in it. E.g., d - data.frame(y=1:10, x1=rep(3,10), x2=rep(c(Female,Male),c(7,3))) lm(y ~ x1 + x2, data=d, subset = x2==Female) Error in `contrasts-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels You have to look through the dataset to see which column is the offender. Numeric columns with no variation are accepted; this is just a problem with character/factor columns: lm(y ~ x1 + x2, data=d) Call: lm(formula = y ~ x1 + x2, data = d) Coefficients: (Intercept) x1 x2Male 4 NA5 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 sgs sys Sent: Saturday, April 27, 2013 7:59 AM To: r-help@r-project.org Subject: [R] Error in `contrasts-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : i am getting the following error Error in `contrasts-`(`*tmp*`, value = contr.funs[1 + isOF[nn]]) : contrasts can be applied only to factors with 2 or more levels can any on e suggest how torectify [[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.
[R] Selecting ridge regression coefficients for minimum GCV
Hi all, I have run a ridge regression as follows: reg=lm.ridge(final$l~final$lag1+final$lag2+final$g+final$u, lambda=seq(0,10,0.01)) Then I enter : select(reg) and it returns: modified HKB estimator is 19.3409 modified L-W estimator is 36.18617 smallest value of GCV at 10 I think it means that it is advisable to use the results of regression corresponding to lambda= 10; so the next thing I do is: reg=lm.ridge(final$l~final$lag1+final$lag2+final$g+final$u, lambda=10) which yields: final$lag1final$lag2 final$g final$u 3.147255e-04 1.802505e-01 -4.461005e-02 -1.728046e-09 -5.154932e-04 The main issue is that I want to access these coefficient values automatically, i.e. R should run the regression and automatically provide me these values after taking into consideration that lambda which minimizes the GCV. Kindly advise me how I can proceed. Thanks and regards, Preetam -- Preetam Pal (+91)-9432212774 M-Stat 2nd Year, Room No. N-114 Statistics Division, C.V.Raman Hall Indian Statistical Institute, B.H.O.S. Kolkata. [[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] Selecting ridge regression coefficients for minimum GCV
Using a reproducible example: library(MASS) fits - lm.ridge(y ~ ., longley, lambda=seq(0,.2,len=9)) whichIsBest - which.min(fits$GCV) coef(fits)[whichIsBest,] # no need to refit GNPUnemployed Armed.ForcesPopulation Year -1.454883e+03 1.063399e-01 1.285758e-02 8.194928e-03 -7.715296e-01 8.126372e-01 Employed 1.743916e-01 I imagine that help(lm.ridge) contains this information. You can also look at str(fits) to see what is in the output of lm.ridge() and how it relates to what is in the standard printout. 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 Preetam Pal Sent: Saturday, April 27, 2013 4:32 PM To: r-help@r-project.org Subject: [R] Selecting ridge regression coefficients for minimum GCV Hi all, I have run a ridge regression as follows: reg=lm.ridge(final$l~final$lag1+final$lag2+final$g+final$u, lambda=seq(0,10,0.01)) Then I enter : select(reg) and it returns: modified HKB estimator is 19.3409 modified L-W estimator is 36.18617 smallest value of GCV at 10 I think it means that it is advisable to use the results of regression corresponding to lambda= 10; so the next thing I do is: reg=lm.ridge(final$l~final$lag1+final$lag2+final$g+final$u, lambda=10) which yields: final$lag1final$lag2 final$g final$u 3.147255e-04 1.802505e-01 -4.461005e-02 -1.728046e-09 -5.154932e-04 The main issue is that I want to access these coefficient values automatically, i.e. R should run the regression and automatically provide me these values after taking into consideration that lambda which minimizes the GCV. Kindly advise me how I can proceed. Thanks and regards, Preetam -- Preetam Pal (+91)-9432212774 M-Stat 2nd Year, Room No. N-114 Statistics Division, C.V.Raman Hall Indian Statistical Institute, B.H.O.S. Kolkata. [[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] Help
Hi A.K, Thanks for this great help. I wish to find -999.99M and replace with NA. All others like T, A, F etc should be deleted from the files. Thanks for much. -- Original Message -- From : arun To : Zilefac Elvis; Cc : R help; Sent : 27-04-2013 16:29 Subject : Re: [R] Help HI, Find 'T','C','A','F' and 'Y', delete them from all the 110 files I assume that you meant to replace it with NA. set.seed(28) myfiles- lapply(1:5,function(i) as.data.frame(matrix(sample(c(LETTERS,-999.99 M),40*i,replace=TRUE),ncol=(40*i)/8),stringsAsFactors=FALSE)) myfiles[[1]] # V1 V2 V3 V4 V5 #1 A PK O Y #2 C ZS M Y #3 M S -999.99M G I #4 X RM G X #5 C QG A P #6 U WG B K #7 A NZ X R #8 X IF M K res-lapply(myfiles,function(x) {x1-unlist(x); x1[x1%in% c(-999.99M,T,C, A,F,Y)]-NA;as.data.frame(matrix(x1,ncol=ncol(x)),stringsAsFactors=FALSE) }) res[[1]] # V1 V2 V3 V4 V5 #1 PKO #2 ZSM #3M S GI #4X RMGX #5 QG P #6U WGBK #7 NZXR #8X I MK lapply(seq_along(res),function(i) write.table(res[[i]],paste0(file,i,.txt), row.names=FALSE,quote=FALSE)) A.K. - Original Message - From: Zilefac Elvis To: r-help@r-project.org Cc: Sent: Saturday, April 27, 2013 11:20 AM Subject: [R] Help Hello, I have a question and need your help urgently. I am new to R but want to learn it. I have several files in a folder which I have imported to R using : temp = list.files(pattern=*.txt) myfiles = lapply(temp, read.delim) The resulting files are on the workspace stored as List[110]. So they are 110 f iles in the list. Each file has several different columns and rows. My question: I would like to find and replace -999.99M with NA; Find 'T','C','A ','F' and 'Y', delete them from all the 110 files. Then, I want to write.table all the corrected files back to a folder on my comp uter. Thanks for your help. Atem. From: r-help-requ...@r-project.org Sent: Friday, April 26, 2013 11:08 AM Subject: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Mailing list subscription confirmation notice for mailing list R-help We have received a request from 129.132.148.130 for subscription of r-help@r-project.org mailing list. To confirm that you want to be added to this mailing list, simply reply to this message, keeping the Subject: header intact. Or visit this web page: https://stat.ethz.ch/mailman/confirm/r-help/bfdc3137cee0135cf3c616295c9d0e2 b3adfd392 Or include the following line -- and only the following line -- in a message to r-help-requ...@r-project.org: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Note that simply sending a `reply' to this message should work from most mail readers, since that usually leaves the Subject: line in the right form (additional Re: text in the Subject: is okay). If you do not wish to be subscribed to this list, please simply disregard this message. If you think you are being maliciously subscribed to the list, or have any other questions, send them to r-help-ow...@r-project.org. [[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] Help
Hi, If you wanted to delete T, C,A, F and Y and replace -999.99M with NA, it is possible, but the result would be stored in a list if the number of elements deleted from each of the columns are different. As you didn't provide any reproducible example, I don't know whether equal number of elements are replaced from each columns or not.. set.seed(28) myfiles- lapply(1:5,function(i) as.data.frame(matrix(sample(c(LETTERS,-999.99M),40*i,replace=TRUE),ncol=(40*i)/8),stringsAsFactors=FALSE)) res-lapply(myfiles,function(x){x[x==-999.99M]-NA;lapply(x,function(y) y[!y%in%c(T,C,A,F,Y)])}) res[[1]] #$V1 #[1] M X U X # #$V2 #[1] P Z S R Q W N I # #$V3 #[1] K S NA M G G Z # #$V4 #[1] O M G G B X M # #$V5 #[1] I X P K R K A.K. From: zilefacel...@yahoo.com zilefacel...@yahoo.com To: arun smartpink...@yahoo.com Cc: R help r-help@r-project.org Sent: Saturday, April 27, 2013 9:41 PM Subject: Re: Re: [R] Help Hi A.K, Thanks for this great help. I wish to find -999.99M and replace with NA. All others like T, A, F etc should be deleted from the files. Thanks for much. -- Original Message -- From : arun To : Zilefac Elvis; Cc : R help; Sent : 27-04-2013 16:29 Subject : Re: [R] Help HI, Find 'T','C','A','F' and 'Y', delete them from all the 110 files I assume that you meant to replace it with NA. set.seed(28) myfiles- lapply(1:5,function(i) as.data.frame(matrix(sample(c(LETTERS,-999.99M),40*i,replace=TRUE),ncol=(40*i)/8),stringsAsFactors=FALSE)) myfiles[[1]] # V1 V2 V3 V4 V5 #1 A P K O Y #2 C Z S M Y #3 M S -999.99M G I #4 X R M G X #5 C Q G A P #6 U W G B K #7 A N Z X R #8 X I F M K res-lapply(myfiles,function(x) {x1-unlist(x); x1[x1%in% c(-999.99M,T,C,A,F,Y)]-NA;as.data.frame(matrix(x1,ncol=ncol(x)),stringsAsFactors=FALSE)}) res[[1]] # V1 V2 V3 V4 V5 #1 P K O #2 Z S M #3 M S G I #4 X R M G X #5 Q G P #6 U W G B K #7 N Z X R #8 X I M K lapply(seq_along(res),function(i) write.table(res[[i]],paste0(file,i,.txt),row.names=FALSE,quote=FALSE)) A.K. - Original Message - From: Zilefac Elvis To: r-help@r-project.org Cc: Sent: Saturday, April 27, 2013 11:20 AM Subject: [R] Help Hello, I have a question and need your help urgently. I am new to R but want to learn it. I have several files in a folder which I have imported to R using : temp = list.files(pattern=*.txt) myfiles = lapply(temp, read.delim) The resulting files are on the workspace stored as List[110]. So they are 110 files in the list. Each file has several different columns and rows. My question: I would like to find and replace -999.99M with NA; Find 'T','C','A','F' and 'Y', delete them from all the 110 files. Then, I want to write.table all the corrected files back to a folder on my computer. Thanks for your help. Atem. From: r-help-requ...@r-project.org Sent: Friday, April 26, 2013 11:08 AM Subject: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Mailing list subscription confirmation notice for mailing list R-help We have received a request from 129.132.148.130 for subscription of r-help@r-project.org mailing list. To confirm that you want to be added to this mailing list, simply reply to this message, keeping the Subject: header intact. Or visit this web page: https://stat.ethz.ch/mailman/confirm/r-help/bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Or include the following line -- and only the following line -- in a message to r-help-requ...@r-project.org: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Note that simply sending a `reply' to this message should work from most mail readers, since that usually leaves the Subject: line in the right form (additional Re: text in the Subject: is okay). If you do not wish to be subscribed to this list, please simply disregard this message. If you think you are being maliciously subscribed to the list, or have any other questions, send them to r-help-ow...@r-project.org. [[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] r syntax
But there is almost certainly no need to do this in the first place! -- Bert On Sat, Apr 27, 2013 at 3:57 PM, Rui Barradas ruipbarra...@sapo.pt wrote: Hello, You should provide us with a data example. In the following, the two solutions are completely different but both of them do what you want. Note that the second creates a factor variable, whose levels are coded as integers. See R-intro.pdf in your doc directory, chapter 4 Ordered and unordered factors. x - sample(c(Male, Female), 10, replace = TRUE) y1 - ifelse(x == Male, 1L, 2L) y2 - factor(x, levels = c(Male, Female)) Hope this helps, Rui Barradas Em 27-04-2013 15:32, sgs sys escreveu: Hi i want to recode Male =1 and female =2 in R what is the syntax for same ? thanks Sameer [[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. -- Bert Gunter Genentech Nonclinical Biostatistics Internal Contact Info: Phone: 467-7374 Website: http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm __ 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] Help
What do you mean when you say deleted from the files? You are discussing using space delimited files. What do you want to occupy the places where those letters are? --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Playing Research Engineer (Solar/BatteriesO.O#. #.O#. with /Software/Embedded Controllers) .OO#. .OO#. rocks...1k --- Sent from my phone. Please excuse my brevity. zilefacel...@yahoo.com zilefacel...@yahoo.com wrote: Hi A.K, Thanks for this great help. I wish to find -999.99M and replace with NA. All others like T, A, F etc should be deleted from the files. Thanks for much. -- Original Message -- From : arun To : Zilefac Elvis; Cc : R help; Sent : 27-04-2013 16:29 Subject : Re: [R] Help HI, Find 'T','C','A','F' and 'Y', delete them from all the 110 files I assume that you meant to replace it with NA. set.seed(28) myfiles- lapply(1:5,function(i) as.data.frame(matrix(sample(c(LETTERS,-999.99 M),40*i,replace=TRUE),ncol=(40*i)/8),stringsAsFactors=FALSE)) myfiles[[1]] # V1 V2 V3 V4 V5 #1 A PK O Y #2 C ZS M Y #3 M S -999.99M G I #4 X RM G X #5 C QG A P #6 U WG B K #7 A NZ X R #8 X IF M K res-lapply(myfiles,function(x) {x1-unlist(x); x1[x1%in% c(-999.99M,T,C, A,F,Y)]-NA;as.data.frame(matrix(x1,ncol=ncol(x)),stringsAsFactors=FALSE) }) res[[1]] # V1 V2 V3 V4 V5 #1 PKO #2 ZSM #3M S GI #4X RMGX #5 QG P #6U WGBK #7 NZXR #8X I MK lapply(seq_along(res),function(i) write.table(res[[i]],paste0(file,i,.txt), row.names=FALSE,quote=FALSE)) A.K. - Original Message - From: Zilefac Elvis To: r-help@r-project.org Cc: Sent: Saturday, April 27, 2013 11:20 AM Subject: [R] Help Hello, I have a question and need your help urgently. I am new to R but want to learn it. I have several files in a folder which I have imported to R using : temp = list.files(pattern=*.txt) myfiles = lapply(temp, read.delim) The resulting files are on the workspace stored as List[110]. So they are 110 f iles in the list. Each file has several different columns and rows. My question: I would like to find and replace -999.99M with NA; Find 'T','C','A ','F' and 'Y', delete them from all the 110 files. Then, I want to write.table all the corrected files back to a folder on my comp uter. Thanks for your help. Atem. From: r-help-requ...@r-project.org Sent: Friday, April 26, 2013 11:08 AM Subject: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Mailing list subscription confirmation notice for mailing list R-help We have received a request from 129.132.148.130 for subscription of r-help@r-project.org mailing list. To confirm that you want to be added to this mailing list, simply reply to this message, keeping the Subject: header intact. Or visit this web page: https://stat.ethz.ch/mailman/confirm/r-help/bfdc3137cee0135cf3c616295c9d0e2 b3adfd392 Or include the following line -- and only the following line -- in a message to r-help-requ...@r-project.org: confirm bfdc3137cee0135cf3c616295c9d0e2b3adfd392 Note that simply sending a `reply' to this message should work from most mail readers, since that usually leaves the Subject: line in the right form (additional Re: text in the Subject: is okay). If you do not wish to be subscribed to this list, please simply disregard this message. If you think you are being maliciously subscribed to the list, or have any other questions, send them to r-help-ow...@r-project.org. [[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. __ 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] Help
Hi Atem, I was able to read the file and removed those suffix letters. The file had a lot of formatting issues. I don't know about the formatting in your other files. Also, there were lines that differ in the number of elements. If it is similar to the one you send, you can try this: con- file(dt306A009.txt) Lines1- readLines(con) close(con) Lines2- Lines1[-1] length(Lines2) #[1] 1140 library(stringr) Lines3-str_split(Lines2,-.99M) Lines4- str_trim(unlist(lapply(Lines3,function(x){x[x==]-NA;paste(x,collapse= )}))) Lines5-gsub((\\d+)[A-Za-z],\\1,Lines4) res-read.table(text=Lines5,sep=,header=FALSE,fill=TRUE) head(res) # V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 #1 1917 1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA #2 1917 2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA #3 1917 3 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA #4 1917 4 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA #5 1917 5 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA #6 1917 6 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 # V21 V22 V23 V24 V25 V26 V27 V28 V29 V30 V31 V32 V33 #1 NA NA NA NA NA NA NA NA NA NA NA NA NA #2 NA NA NA NA NA NA NA NA NA NA NA NA NA #3 NA NA NA NA NA NA NA NA NA NA NA NA NA #4 NA NA NA NA NA NA NA NA NA NA NA NA NA #5 NA NA NA NA NA NA NA NA NA NA NA NA NA #6 14.47 2.3 3.34 1.05 0 0 0 0 0 0 1.57 0 NA temp- list.files(pattern=*.txt) #Reading multiple files. In this case, I am reading the same file saved with different names. temp #[1] dt306A009.txt dt306A010.txt res-lapply(temp,function(x) {con- file(x); Lines1- readLines(con); close(con);Lines2-Lines1[-1]; Lines3- str_split(Lines2,-.99M);Lines4- str_trim(unlist(lapply(Lines3,function(x){x[x==]-NA;paste(x,collapse= )})));Lines5- gsub((\\d+)[A-Za-z],\\1,Lines4);res- read.table(text=Lines5,sep=,header=FALSE,fill=TRUE) }) lapply(res,head,2) #[[1]] # V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 #1 1917 1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA #2 1917 2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA # V22 V23 V24 V25 V26 V27 V28 V29 V30 V31 V32 V33 #1 NA NA NA NA NA NA NA NA NA NA NA NA #2 NA NA NA NA NA NA NA NA NA NA NA NA # #[[2]] # V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20 V21 #1 1917 1 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA #2 1917 2 NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA NA # V22 V23 V24 V25 V26 V27 V28 V29 V30 V31 V32 V33 #1 NA NA NA NA NA NA NA NA NA NA NA NA #2 NA NA NA NA NA NA NA NA NA NA NA NA A.K. From: Zilefac Elvis zilefacel...@yahoo.com To: arun smartpink...@yahoo.com Sent: Saturday, April 27, 2013 11:14 PM Subject: Re: Re: [R] Help Hi A.K, Attached are example files. I have 110 of such and would like to perform the analysis as described before. I would find T, F, Y, A, C, etc and delete them. The letters are affixed to values in the data just to communicate an idea. As before, find all -.99M and replace with NA. Thanks so much. Atem. From: arun smartpink...@yahoo.com To: zilefacel...@yahoo.com zilefacel...@yahoo.com Cc: R help r-help@r-project.org Sent: Saturday, April 27, 2013 7:53 PM Subject: Re: Re: [R] Help Hi, If you wanted to delete T, C,A, F and Y and replace -999.99M with NA, it is possible, but the result would be stored in a list if the number of elements deleted from each of the columns are different. As you didn't provide any reproducible example, I don't know whether equal number of elements are replaced from each columns or not.. set.seed(28) myfiles- lapply(1:5,function(i) as.data.frame(matrix(sample(c(LETTERS,-999.99M),40*i,replace=TRUE),ncol=(40*i)/8),stringsAsFactors=FALSE)) res-lapply(myfiles,function(x){x[x==-999.99M]-NA;lapply(x,function(y) y[!y%in%c(T,C,A,F,Y)])}) res[[1]] #$V1 #[1] M X U X # #$V2 #[1] P Z S R Q W N I # #$V3 #[1] K S NA M G G Z # #$V4 #[1] O M G G B X M # #$V5 #[1] I X P K R K A.K. From: zilefacel...@yahoo.com zilefacel...@yahoo.com To: arun smartpink...@yahoo.com Cc: R help r-help@r-project.org Sent: Saturday, April 27, 2013 9:41 PM Subject: Re: Re: [R] Help Hi A.K, Thanks for this great help. I wish to find -999.99M and replace with NA. All others like T, A, F etc should be deleted from the files. Thanks for much. -- Original Message -- From : arun To : Zilefac Elvis; Cc : R help; Sent : 27-04-2013 16:29 Subject : Re: [R] Help HI, Find 'T','C','A','F' and 'Y', delete them from all the 110 files I assume that you meant to
Re: [R] Bls: RE: example
On 04/27/2013 11:32 PM, triutami@gmail.com wrote: Dear Sir, Yes, I want to generate the data by two Gaussian but mean from one of them generatated from polar its coordinates. I am confused about the algorithm? I know how to generate two Gaussian data with certain meancovariance matrix using mvnorm but what about mean from its polar coordinates? Thanks for your help. Hi Iut, If you mean transforming a normal (Gaussian) variate into polar coordinates, it is not too hard: polar.norm-180+rnorm(100,0,10) You can alter the mean point by changing the constant value and the extent to which the tails wrap around the circles with the third argument to rnorm. Be aware that large negative and positive values will wrap around to the polar values of the opposite sign depending upon the variance of the normal variate. 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.