Re: [R] I am trying to use assign and paste to assign value to existing variable

2014-12-05 Thread David Winsemius
On Dec 4, 2014, at 11:24 PM, Dirkse van Schalkwyk, Theuns the...@sun.ac.za wrote: In the code below, the last line of code does what I am trying to do; however, I do not know the name of the variable before the user creates it, by choosing values in Route1. So, how can I assign values to

Re: [R] Plot gamma distribution with relative frequency histogram

2014-12-05 Thread David Winsemius
On Dec 4, 2014, at 6:55 PM, dila radi wrote: Dear R users, I am looking to fit a gamma curve onto a histogram of the data. Consider dt1 as my data: c(203.9, 91.5, 24.5, 34.5, 164, 144, 160.5, 195, 191.5, 189, 133, 110.5, 155, 80.5, 250.5, 116, 145, 118.5, 406, 183.5, 142.5, 197, 367,

[R] Put 2 ablines in an empty plot

2014-12-05 Thread Adrien Bonvin
Bonjour Hi everybody, Firs of all, sorry for my terrible English, I would like to know if it’s possible to create an “empty plot” in which i could add two ablines I created on two different plots earlyer in my script. As a result I would like to have a plot with only the two ablines (in

Re: [R] Using line (Tukey's robust line) on 3 observations?

2014-12-05 Thread Stéphane Adamowicz
Le 4 d�c. 2014 � 13:40, Tal Galili a �crit : By accident I came across the following example: x - 1:3 y - 1:3 line(x, y) # returns: Call: line(x, x) Coefficients: [1] -2 2 While when using 1:4, it will give the more reasonable 0,1 coefficients. I imagine this is in the

Re: [R] Put 2 ablines in an empty plot

2014-12-05 Thread David Winsemius
On Dec 5, 2014, at 12:30 AM, Adrien Bonvin wrote: Bonjour Hi everybody, Firs of all, sorry for my terrible English, I would like to know if it’s possible to create an “empty plot” in which i could add two ablines I created on two different plots earlyer in my script. Read there

Re: [R] 2 ablines dans 1 même plot vide

2014-12-05 Thread Michael Dewey
If I understand correctly plot(1:10, 1:10, type = n) should get you started. This is an Anglophone list by the way. On 04/12/2014 22:23, Adrien Bonvin wrote: Bonjour J’aimerais savoir comment créer un “plot vide”, dans lequel je pourrais ajouter deux valeurs d’abline, tracées à partir de

Re: [R] Put 2 ablines in an empty plot

2014-12-05 Thread Chel Hee Lee
The following example may give you an idea regarding your question. Please see what happens by typing the codes x - seq(from=-5, to=5, by=1) y1 - 0 + 0.5*x y2 - 0 - 0.5*x plot(x,y1, type=n) points(x,y1) points(x,y2) abline(a=0, b=0.5) abline(a=0, b=-0.5) Is this what you are looking

[R] Run script automatically on several input files in the directory and produce separate outputs?

2014-12-05 Thread Thomas Barningham
Hi, I have written a script that currently reads in a .txt file where I specify the name e.g mydata-read.table(a_date.txt, header=TRUE) The script eventually produces a plot, e.g: pdf(file=myfilename.txt) plot(etc) dev.off What I want to do is run this script on several input files in my

Re: [R] using inspect with a TermDocumentMatrix to convert to a data frame

2014-12-05 Thread Erin Hodgess
Great! Thank you! On Fri, Dec 5, 2014 at 12:48 AM, Wush Wu wush...@gmail.com wrote: Dear Erin, For the issue of printing big data.frame, you could define a customized `print.data.frame` in the user environment to prevent R prints all the data. For example: ```r print.data.frame -

Re: [R] Run script automatically on several input files in the directory and produce separate outputs?

2014-12-05 Thread ONKELINX, Thierry
Dear Thomas, list.files() will be your new best friend. Best regards, ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance Kliniekstraat 25 1070 Anderlecht Belgium + 32 2 525

Re: [R] function to avoid -

2014-12-05 Thread Karim Mezhoud
Hi, An other alternative using assign function func - function(){ X - 5 assign(X, X, envir = .GlobalEnv) } Ô__ c/ /'_;kmezhoud (*) \(*) ⴽⴰⵔⵉⵎ ⵎⴻⵣⵀⵓⴷ http://bioinformatics.tn/ On Tue, Dec 2, 2014 at 8:40 PM, Adams, Jean jvad...@usgs.gov wrote: Glad to see this query and the

Re: [R] Run script automatically on several input files in the directory and produce separate outputs?

2014-12-05 Thread Thomas Barningham
Dear Thierry, Thanks for your suggestion...but I don't how I would apply this for my situation, the R help isn't much help for me either. (Apologies - I am a rookie!) Do I still need a for loop? Many thanks Thomas On Fri, Dec 5, 2014 at 2:20 PM, ONKELINX, Thierry thierry.onkel...@inbo.be

Re: [R] Run script automatically on several input files in the directory and produce separate outputs?

2014-12-05 Thread Jeff Newmiller
Of course, you probably also need to wrap your code into a function first. R script files are not very good units of code to repeat multiple times. Once you have a function that you can give a data file name to and get a plot, then it is easy to use the lapply function to call that function

Re: [R] function to avoid -

2014-12-05 Thread Henrik Bengtsson
Don't have your package mess with (e.g. assign) to the global environment. Also, CRAN won't accept such packages. A good rule of thumb is that if you find yourself using assign(), get(), and -, or assigning explicitly to the global environment, it's a good indicator that you're hiking up the

Re: [R] Rename multiple files in a directory and write renamed files back to directory

2014-12-05 Thread Zilefac Elvis via R-help
Hi Chel, How can I modify the script such that the numbering starts from 200,... instead of 001? flag=0 does not accept anything other than 0. Thanks, Asong. On Thursday, December 4, 2014 11:17 PM, Chel Hee Lee chl...@mail.usask.ca wrote: I see that a function 'format()' is used in your code.

[R] RCurl much faster than base R

2014-12-05 Thread Alex Gutteridge
I'm trying to debug a curious network issue, I wonder if anyone can help me as I (and my local sysadmin) am stumped: This base R command takes ~1 minute to complete: readLines(url(http://bioconductor.org/biocLite.R;)) (biocLite.R is a couple of KB in size) Using RCurl (and so libcurl under

Re: [R] Rename multiple files in a directory and write renamed files back to directory

2014-12-05 Thread Zilefac Elvis via R-help
Hi Chel, I got it right. Many thanks. file.rename(file_names, to=paste0(rcp45_Daily_Sim, 200:210)) list.files(pattern=rcp45_Daily_Sim) [1] rcp45_Daily_Sim200 rcp45_Daily_Sim201 rcp45_Daily_Sim202 On Friday, December 5, 2014 9:35 AM, Zilefac Elvis zilefacel...@yahoo.com wrote: Hi Chel, How

Re: [R] Rename multiple files in a directory and write renamed files back to directory

2014-12-05 Thread Jeff Newmiller
You could read the help file: ?formatC which says that flag modifies how the numbers are formatted... it does not affect what numbers are used.. that is given by the x argument (typically the first item in the argument list to formatC). In your case I think that came from a call to the seq

Re: [R] Rename multiple files in a directory and write renamed files back to directory

2014-12-05 Thread Chel Hee Lee
Your question is not clear to me. Do you wish to start numbers from 200 using 'formatC()'? formatC(seq(from=200, to=1200, by=500), width=5, flag=0) [1] 00200 00700 01200 You can do the same job using function 'sprintf()' as shown in the below: sprintf(%05d, seq(from=200, to=1200, by=500))

[R] Deducer future?

2014-12-05 Thread Ranjan Maitra
Hi, I have been using Deducer for the past year for my very basic 100-level introductory statistics classes for students from other disciplines. I really have liked using it for this specific purpose (takes me out of JMP!). However, over the past few months, issues have started cropping up

Re: [R] Deducer future?

2014-12-05 Thread Duncan Murdoch
On 05/12/2014 12:34 PM, Ranjan Maitra wrote: Hi, I have been using Deducer for the past year for my very basic 100-level introductory statistics classes for students from other disciplines. I really have liked using it for this specific purpose (takes me out of JMP!). However, over the past

[R] Factors and NaN

2014-12-05 Thread Dinesh Chowdhary
R-3.1.2 x - factor(c(yes, yes, no, NA, yes, no, NaN)) x [1] yes yes no NA yes no NaN Levels: NaN no yes is.nan(x) [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE From the above snippet can you notice that the NaN value is not logically identified in a vector? Can anyone elaborate on

Re: [R] Put 2 ablines in an empty plot

2014-12-05 Thread Matteo Murenu
plot.new() abline(0,1) abline(1,1) # or as Michael suggest plot(1:10, 1:10, type = n) # then abline(0,1) abline(1,1) Best Matteo Murenu, Cagliari, IT -Original Message- From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of David Winsemius Sent: 05 December 2014 10:07 To:

[R] Subsetting R 3.1.2

2014-12-05 Thread Dinesh Chowdhary
x - list(seq = 3:7, alpha = c(a, b, c)) x$alpha [1] a b c x[alpha] $alpha [1] a b c x[c(1,2)] $seq [1] 3 4 5 6 7 $alpha [1] a b c * x[c(1, alpha[2])]* *$NA* *NULL* *$NA* *NULL* How to access a character subset withing a list? Thank you for your effort... [[alternative HTML

[R] Difference in cummulative variance depending on print command

2014-12-05 Thread Rena Büsch
Hello, I am trying a factor analysis via R. When running the pricipal axis analysis I do get different tables depending on the print command. This is my factor analysis: fa.pa_cor_3_2- fa(ItemsCor_4, nfactors=3, fm=pa,rotate=oblimin) To get the h2 I did the following print command: print

Re: [R] Factors and NaN

2014-12-05 Thread David Winsemius
On Dec 5, 2014, at 7:16 AM, Dinesh Chowdhary wrote: R-3.1.2 x - factor(c(yes, yes, no, NA, yes, no, NaN)) x [1] yes yes no NA yes no NaN Levels: NaN no yes is.nan(x) [1] FALSE FALSE FALSE FALSE FALSE FALSE FALSE From the above snippet can you notice that the NaN value is not

Re: [R] Factors and NaN

2014-12-05 Thread Lee, Chel Hee
'NaN' is a reserved keyword that implies 'Not a number'. I see that you use a character vector that includes 'NA' and 'NaN'. The former 'NA' is considered as a missing value; however, the latter 'NaN' is considered as a string 'NaN'. That's why three levels of 'NaN', 'no', 'yes' are shown.

Re: [R] Subsetting R 3.1.2

2014-12-05 Thread Lee, Chel Hee
Your question is not clear to me. x$alpha[1:2] [1] a b x$alpha[2] [1] b Is this what you are looking for? I hope this helps. Chel Hee Lee On 12/5/2014 11:12 AM, Dinesh Chowdhary wrote: x - list(seq = 3:7, alpha = c(a, b, c)) x$alpha [1] a b c x[alpha] $alpha [1] a b c x[c(1,2)]

Re: [R] Run script automatically on several input files in the directory and produce separate outputs?

2014-12-05 Thread MacQueen, Don
The simplest approach, and a good one for someone new to R, would be something like this: myfiles - c('fileA', 'fileB','fileC) for (nm in myfiles) { cat('now reading input file',nm,'\n') mydat - read.table( paste0(nm,'.txt'), header=TRUE) pdf( paste0(nm, '.pdf') ) plot(etc , main=nm)

[R] recoding genetic information using gsub

2014-12-05 Thread Kate Ignatius
I have genetic information for several thousand individuals: A/T T/G C/G etc For some individuals there are some genotypes that are like this: A/, C/, T/, G/ or even just / which represents missing and I want to change these to the following: A/ A/. C/ C/. G/ G/. T/ T/. / ./. /A ./A /C ./C /G

Re: [R] recoding genetic information using gsub

2014-12-05 Thread Sarah Goslee
Hi, Briefly, you need to read about regular expressions. It's possible to be incredibly specific, and even to do what you want with a single line of code. It's hard to be certain of exactly what you need, though, without a reproducible example. See inline for one possibility. On Fri, Dec 5,

Re: [R] recoding genetic information using gsub

2014-12-05 Thread Martin Morgan
On 12/5/2014 11:24 AM, Kate Ignatius wrote: I have genetic information for several thousand individuals: A/T T/G C/G etc For some individuals there are some genotypes that are like this: A/, C/, T/, G/ or even just / which represents missing and I want to change these to the following: A/

Re: [R] recoding genetic information using gsub

2014-12-05 Thread William Dunlap
Does the following do what you want? raw - c(A/B, /B, A/, / ) tmp - sub(^ */, ./, raw) cleaned - sub(/ *$, /., tmp) cleaned [1] A/B ./B A/. ./. (The * is to allow optional spaces before or after the slash.) Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Dec 5, 2014 at 11:24 AM,

Re: [R] Deducer future?

2014-12-05 Thread Ranjan Maitra
On Fri, 5 Dec 2014 12:54:17 -0500 Duncan Murdoch murdoch.dun...@gmail.com wrote: On 05/12/2014 12:34 PM, Ranjan Maitra wrote: Hi, I have been using Deducer for the past year for my very basic 100-level introductory statistics classes for students from other disciplines. I really

Re: [R] Deducer future?

2014-12-05 Thread Sarah Goslee
To find the maintainer, see ?maintainer The maintainer is also listed on the CRAN page. http://cran.r-project.org/web/packages/Deducer/index.html Sarah On Fri, Dec 5, 2014 at 3:11 PM, Ranjan Maitra maitra.mbox.igno...@inbox.com wrote: On Fri, 5 Dec 2014 12:54:17 -0500 Duncan Murdoch

Re: [R] Deducer future?

2014-12-05 Thread Duncan Murdoch
On 05/12/2014 3:11 PM, Ranjan Maitra wrote: On Fri, 5 Dec 2014 12:54:17 -0500 Duncan Murdoch murdoch.dun...@gmail.com wrote: On 05/12/2014 12:34 PM, Ranjan Maitra wrote: Hi, I have been using Deducer for the past year for my very basic 100-level introductory statistics classes for

Re: [R] Deducer future?

2014-12-05 Thread Ranjan Maitra
On Fri, 5 Dec 2014 15:27:10 -0500 Duncan Murdoch murdoch.dun...@gmail.com wrote: On 05/12/2014 3:11 PM, Ranjan Maitra wrote: On Fri, 5 Dec 2014 12:54:17 -0500 Duncan Murdoch murdoch.dun...@gmail.com wrote: On 05/12/2014 12:34 PM, Ranjan Maitra wrote: Hi, I have been using

Re: [R] Deducer future?

2014-12-05 Thread David Winsemius
On Dec 5, 2014, at 12:11 PM, Ranjan Maitra wrote: On Fri, 5 Dec 2014 12:54:17 -0500 Duncan Murdoch murdoch.dun...@gmail.com wrote: On 05/12/2014 12:34 PM, Ranjan Maitra wrote: Hi, I have been using Deducer for the past year for my very basic 100-level introductory statistics classes

Re: [R] Profiling a C/C++ library from R

2014-12-05 Thread Charles Novaes de Santana
Thank you very much for the tips, Martin and Duncan! Rprof and operf are helping me a lot!! Also, I am now in R-dev maillist and I see there seems to be more appropriate to this kind of question. Best, Charles On Wed, Dec 3, 2014 at 12:03 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote: On

Re: [R] Deducer future?

2014-12-05 Thread Ranjan Maitra
Btw, I did hear back immediately from Ian Fellows and it is being maintained as his time permits, though he himself is not a windows user, and possibly therefore the issues. I thanked him for his e-mail and was relieved to note that this is not going away yet. Thanks again to Duncan, Sarah and

[R] How to build a vignette?

2014-12-05 Thread PO SU
Dear expeRts,   I know we can build a vignette from .Rmd file, but  i find a lot of r packages have R topic documented words then followed an index, then functions'document which are already described in .RD files. I mean that , i don't want to write a vignette , but rather using function

Re: [R] Deducer future?

2014-12-05 Thread David Winsemius
On Dec 5, 2014, at 4:15 PM, Ranjan Maitra wrote: Btw, I did hear back immediately from Ian Fellows and it is being maintained as his time permits, though he himself is not a windows user, and possibly therefore the issues. I thanked him for his e-mail and was relieved to note that this is

Re: [R] How to build a vignette?

2014-12-05 Thread Jeff Newmiller
You are not talking about a vignette. That is the pdf version of the help files, automatically generated from the same Rd files as the HTML versions. If you are not going to write the Rd file directly, you probably want roxygen. Markdown is weak on links and template structures, and Rd files

Re: [R] How to build a vignette?

2014-12-05 Thread Jeff Newmiller
If you run R CMD check on your package successfully, then that file will be generated as needed automatically. If you install your package for you're own use before sending it to CRAN then you can see the file by following the link on the help index html page for your package.