Re: [R] Formatting multi-way ANOVA output for spectra analysis

2018-07-25 Thread Fox, John
Dear Robert, Although you don't say so, it sounds as if you may be using the Anova() function in the car package, which is what the R Commander uses for ANOVA. If so, in most cases, Anova() returns an object of class c("anova", "data.frame"), which can be manipulated as a data frame. To see

Re: [R] Batch mode questions.

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, David Winsemius wrote: # create a list from these files list.filenames<-list.files(pattern=".CSV$") # This gets a list of all CSV files It would get all the files with all caps "CSV" anywhere within the file name, but it would not get any files with an extension ".csv",

Re: [R] Batch mode questions.

2018-07-25 Thread David Winsemius
> On Jul 25, 2018, at 2:54 PM, Rich Shepard wrote: > > On Wed, 25 Jul 2018, Shawn Way wrote: > >> To get you start, here's a script I used to combine any number of files >> into one data.frame. >> >> library(knitr) >> library(tidyverse) >> library(xlsx) >> library(xtable) >>

Re: [R] Batch mode questions.

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Shawn Way wrote: To get you start, here's a script I used to combine any number of files into one data.frame. library(knitr) library(tidyverse) library(xlsx) library(xtable) library(lubridate) # create a list from these files list.filenames<-list.files(pattern=".CSV$") #

Re: [R] Unable to Change Library Paths in R 3.5.1 in Windows 10

2018-07-25 Thread Bert Gunter
Pemissions settings on your target directory (which is a Windows not an R issue)?? -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Jul 25, 2018

[R] Unable to Change Library Paths in R 3.5.1 in Windows 10

2018-07-25 Thread Jack Pincus
I just installed R 3.5.1 on a new Windows 10 computer.  R tries to set a personal library to C:/Users/jackp/OneDrive/Documents/R/win-lib/3.5.  I want to store R packages on my local hard drive, not OneDrive.  I tried placing the line of code:.libPaths(c(.libPaths(),

Re: [R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Bert Gunter wrote: Eric may have more to say, but the straightforward answer is: use functions to do what you want and pass any file specific info to them as parameters of function calls. Bert, I was considering that functions would be the way to go. The functions can

Re: [R] A couple of batch mode questions

2018-07-25 Thread Bert Gunter
Eric may have more to say, but the straightforward answer is: use functions to do what you want and pass any file specific info to them as parameters of function calls. If this seems arcane to you, then you have some homework to do, as using functions is a (maybe the) central programming paradigm

Re: [R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Eric Berger wrote: You should be able to do all this within R. From what you have written I don't see a compelling reason to use scripts at the shell level. Eric, The source() help page's last example calls a set of scripts to run sequentially. I assume this is used to

Re: [R] A couple of batch mode questions

2018-07-25 Thread Eric Berger
You should be able to do all this within R. >From what you have written I don't see a compelling reason to use scripts at the shell level. Best, Eric On Wed, Jul 25, 2018 at 9:41 PM, Rich Shepard wrote: > On Wed, 25 Jul 2018, Eric Berger wrote: > > 1. For R scripts you should also consider

Re: [R] Formatting multi-way ANOVA output for spectra analysis

2018-07-25 Thread Jeff Newmiller
In general, analysis functions in R return objects. When returned alone on an interactive console the default print method for that object gets printed. However, you can put it into a variable with the <- assignment operator, and use the str function to see what values are inside the object,

Re: [R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Eric Berger wrote: 1. For R scripts you should also consider the package littler developed by Dirk Eddelbuettel, Highly recommended. For info http://dirk.eddelbuettel.com/code/littler.html or the github repository. Eric, I'll definintely look at that package. 2.

Re: [R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, MacQueen, Don wrote: From my perspective, which is a unix-alike perspective, Rscript makes R useable in exactly the same way as other unix style scripting languages such as perl, tcsh, bash, etc. This is useful, and a good thing. If I remember (and understood) correctly, it

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread William Dunlap via R-help
If you need to make a list of long but unknown length you can save time by adding the items to an environment, with names giving the order, then converting the environment to a list when you are done filling the environment. E.g., > makeData function (container, n) { for (i in seq_len(n))

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Bogdan Tanasa
Dear Jeff, it is a precious help and a fabulous suggestion. I will slowly go over the R code that you have sent. Thanks a lot ! On Wed, Jul 25, 2018 at 10:43 AM, Jeff Newmiller wrote: > The code below reeks of a misconception that lists are efficient to add > items to, which is a confusion with

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Jeff Newmiller
The code below reeks of a misconception that lists are efficient to add items to, which is a confusion with the computer science term "linked list". In R, a list is NOT a linked list... it is a vector, which means the memory used by the list is allocated at the time it is created, and

Re: [R] A couple of batch mode questions

2018-07-25 Thread Eric Berger
Some additional comments that might be relevant to people interested in these topics. 1. For R scripts you should also consider the package littler developed by Dirk Eddelbuettel, Highly recommended. For info http://dirk.eddelbuettel.com/code/littler.html or the github repository. 2. Scripts can

[R] Formatting multi-way ANOVA output for spectra analysis

2018-07-25 Thread Robert D. Bowers M.A.
I've studied R a little bit, although I haven't used it in some time (except via RCommander).  I'm working on my dissertation project and have spectrometer data that I need to evaluate.  I need to find a way to simplify the output from multi-way ANOVA so I can reduce the areas of the spectrum

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Bogdan Tanasa
Dear Thierry and Juan, thank you for your help. Thank you all. Now, if I would like to add an element to the empty list, how shall I do : for example, shall i = 2, and j = 1, in a bit of more complex R code : x <- data.frame(TYPE=c("DEL", "DEL", "DUP", "TRA", "INV", "TRA"), CHRA=c("chr1",

Re: [R] A couple of batch mode questions

2018-07-25 Thread MacQueen, Don via R-help
From my perspective, which is a unix-alike perspective, Rscript makes R useable in exactly the same way as other unix style scripting languages such as perl, tcsh, bash, etc. This is useful, and a good thing. If I remember (and understood) correctly, it is why Rscript was introduced, later in

Re: [R] DiagrammeR and grViz

2018-07-25 Thread Jeff Newmiller
The Export option from the interactive Plots view is a terrible option for any publication-quality graphics. There are many [1] ways to make publication-quality graphics in R, and there can be some operating-system-specific downstream tools considerations that affect what works best for you. I

Re: [R] A couple of batch mode questions [ANSWERED]

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Rich Shepard wrote: That's a given. Why would I prefer Rscript over R CMD BATCH, or vice-versa? I did not see much difference between the two in their help files. Digging deeper into the Web I read that R CMD BATCH is an older approach to automating R processing from

Re: [R] SQL Database

2018-07-25 Thread Bert Gunter
https://rviews.rstudio.com/2017/10/18/database-queries-with-r/ Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Jul 25, 2018 at 7:57 AM,

Re: [R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
On Wed, 25 Jul 2018, Bert Gunter wrote: "Within R one can use source() to run a batch file of R commands, while R CMD BATCH and Rscript are run from the command line. Is this correct?" Yes. Bert, Thanks for confirming. I think your query answers your query: You use Rscript when you want

[R] SQL Database

2018-07-25 Thread Doran, Harold
I'm doing some work now to learn which SQL database package is the most optimal for the task I am working on. There are many packages, and I'm reviewing the documentation on some of them now. I am seeking advice from those of you who might suggest a package to use for the task I am currently

Re: [R] A couple of batch mode questions

2018-07-25 Thread Bert Gunter
"Within R one can use source() to run a batch file of R commands, while R CMD BATCH and Rscript are run from the command line. Is this correct?" Yes. I think your query answers your query: You use Rscript when you want to use R in the command environment, perhaps as part of an analytical

[R] A couple of batch mode questions

2018-07-25 Thread Rich Shepard
Within R one can use source() to run a batch file of R commands, while R CMD BATCH and Rscript are run from the command line. Is this correct? Given these choices, when would I want to run a script within R using source(), and when would it be better for me to run it from the command line?

[R] DiagrammeR and grViz

2018-07-25 Thread Evan Kransdorf
Is anyone using DiagrammeR and grViz? I made a nice grViz but when I use RStudio to export quality looks bad (need high resolution figure). I can't quite figure out how to use DiagrammeR to export the grViz I made. Any suggestions? Thank you, Evan [[alternative HTML version deleted]]

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Huzefa Khalil
Hi Bogdan, Does the following do what you expect? x$intersectA[[i]] <- c(x$intersectA[[i]], x$labA[j]) Note the difference between `[[` and `[` On Wed, Jul 25, 2018 at 9:26 AM, Bogdan Tanasa wrote: > Dear Thierry and Juan, thank you for your help. Thank you very much. > > Now, if I would

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Bogdan Tanasa
Dear Thierry and Juan, thank you for your help. Thank you very much. Now, if I would like to add an element to the empty list, how shall I do : for example, shall i = 2, and j = 1, in a bit of more complex R code : x <- data.frame(TYPE=c("DEL", "DEL", "DUP", "TRA", "INV", "TRA"), CHRA=c("chr1",

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Bogdan Tanasa
Thank you Juan. On Wed, Jul 25, 2018 at 12:56 AM, Juan Telleria Ruiz de Aguirre < jtelleria.rproj...@gmail.com> wrote: > Check tidyverse's purrr package: > > https://github.com/rstudio/cheatsheets/raw/master/purrr.pdf > > In the second page of the cheatsheet there is info on how to create list >

Re: [R] Query on convergence

2018-07-25 Thread PIKAL Petr
Hi maybe ii<-TRUE while(ii) { do something if(some condition of two variables is met) {ii <- FALSE} } But in R such constructions are seldom necessary. Cheers Petr > -Original Message- > From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of tembe- > atanasio...@ynu.jp >

[R] Query on convergence

2018-07-25 Thread tembe-atanasio...@ynu.jp
Hello, Is there somebody who can demonstrate how to code a while loop that ends when a convergence between the values of two or more variables (say vectors) is reached? Thank you Regards [[alternative HTML version deleted]] __

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Dénes Tóth
On 07/25/2018 10:23 AM, Ivan Calandra wrote: Just for my understanding: Is a data.frame with list columns still a data.frame? Isn't it then a list? A data.frame is a list of equally sized vectors - that is, each vector must be of the same length. It is not required that the vector is an

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Ivan Calandra
At first I was actually thinking about this situation, which cannot work:| data.frame(x = 1:3, y = list(1:2, 1:3, 1:4)) |But I had never thought about this:| df$y <-list(1:2, 1:3, 1:4)| And it actually makes sense. The final requirement here is that all columns must have the same length! I'm

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Juan Telleria Ruiz de Aguirre
By the way, this also works: dfl <- data.frame(x = 1:3, y = I(list(1:2, 1:3, 1:4))) As indicated in "Advanced R" book: http://adv-r.had.co.nz/Data-structures.html#data-frames __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Juan Telleria Ruiz de Aguirre
> Just for my understanding: > Is a data.frame with list columns still a data.frame? Isn't it then a list? * A data.frame (or tibble) is a list of columns. * In which each column must be from the same data type, in this case list(). __

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Ivan Calandra
Just for my understanding: Is a data.frame with list columns still a data.frame? Isn't it then a list? Ivan -- Dr. Ivan Calandra TraCEr, laboratory for Traceology and Controlled Experiments MONREPOS Archaeological Research Centre and Museum for Human Behavioural Evolution Schloss Monrepos 56567

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Thierry Onkelinx
Dear Bogdan, You are looking for x$intersectA <- vector("list", nrow(x)) Best regards, ir. Thierry Onkelinx Statisticus / Statistician Vlaamse Overheid / Government of Flanders INSTITUUT VOOR NATUUR- EN BOSONDERZOEK / RESEARCH INSTITUTE FOR NATURE AND FOREST Team Biometrie & Kwaliteitszorg /

Re: [R] initiate elements in a dataframe with lists

2018-07-25 Thread Juan Telleria Ruiz de Aguirre
Check tidyverse's purrr package: https://github.com/rstudio/cheatsheets/raw/master/purrr.pdf In the second page of the cheatsheet there is info on how to create list columns within a data.frame :) [[alternative HTML version deleted]] __

[R] initiate elements in a dataframe with lists

2018-07-25 Thread Bogdan Tanasa
Dear all, assuming that I do have a dataframe like : x <- data.frame(TYPE=c("DEL", "DEL", "DUP", "TRA", "INV", "TRA"), CHRA=c("chr1", "chr1", "chr1", "chr1", "chr2", "chr2"), POSA=c(10, 15, 120, 340, 100, 220), CHRB=c("chr1", "chr1", "chr1", "chr2", "chr2", "chr1"), POSB=c(30, 100, 300, 20, 200,

Re: [R] Using apply function to merge list of data frames

2018-07-25 Thread Berend Hasselman
> On 25 Jul 2018, at 08:17, Naresh Gurbuxani > wrote: > > I have a list whose components are data frames. My goal is to construct a > data frame by merging all the list components. Is it possible to achieve > this using apply and without a for loop, as used below? > > Thanks, > Naresh >