[R] cluster samples using self organizing map in R

2018-10-09 Thread A DNA RNA
Dear All, Who can I use Self Organizing Map (SOM) results to cluster samples? I have tried following but this gives me only the clustering of grids, while I want to cluster (150) samples: library(kohonen) iris.sc <- scale(iris[, 1:4]) iris.som <- som(iris.sc, grid=somgrid(xdim = 3, ydim=3, topo="

[R] ANOVA in R

2018-10-09 Thread Thanh Tran
Hi eveyone, I'm studying about variance (ANOVA) in R and have some questions to share. I read an article investigating the effect of factors (temperature, Asphalt content, Air voids, and sample thickness) on the hardness of asphalt concrete in the tensile test (abbreviated as Kic). Each condition w

Re: [R] how to pass arguments to panel.cor in pairs()

2018-10-09 Thread Jinsong Zhao
On 2018/10/9 23:22, Duncan Murdoch wrote: On 09/10/2018 10:53 AM, Jinsong Zhao wrote: Hi there, Here is the panel.cor function from ?pairs:   panel.cor <- function(x, y, digits = 2, prefix = "", cex.cor, ...)   {   usr <- par("usr"); on.exit(par(usr))   par(usr = c(0, 1

Re: [R] Defining Variables from a Matrix for 10-Fold Cross Validation

2018-10-09 Thread David Winsemius
> On Oct 9, 2018, at 3:04 PM, matthew campbell wrote: > > Good afternoon, > > I am trying to run a 10-fold CV, using a matrix as my data set. > Essentially, I want "y" to be the first column of the matrix, and my "x" to > be all remaining columns (2-257). I've posted some of the code I used >

[R] Defining Variables from a Matrix for 10-Fold Cross Validation

2018-10-09 Thread matthew campbell
Good afternoon, I am trying to run a 10-fold CV, using a matrix as my data set. Essentially, I want "y" to be the first column of the matrix, and my "x" to be all remaining columns (2-257). I've posted some of the code I used below, and the data set (called "zip.train") is in the "ElemStatLearn" p

Re: [R] Can I safely use an installed R folder in a portable manner?

2018-10-09 Thread Jeff Newmiller
If you don't want to disturb the existing install of R then you might want to take some effort to bring your library with you and avoid letting your copy of R mess with the default user library. Packrat may help with this? On October 9, 2018 2:13:40 PM PDT, Jim Lemon wrote: >Hi Marc, >I do this

Re: [R] Can I safely use an installed R folder in a portable manner?

2018-10-09 Thread Jim Lemon
Hi Marc, I do this quite often with Tcl-Tk. All you have to do is make sure that the PATH contains the correct location for the R executable if you don't specify it within your program. Jim On Wed, Oct 10, 2018 at 1:58 AM Marc Capavanni via R-help wrote: > > Hi there, > > I'm currently using R on

Re: [R] Reorder file names read by list.files function

2018-10-09 Thread Ek Esawi
Thank you Jeff. It is an excellent idea and i might try it out if nothing works out. And i don't have 12 files on each sub directory; EK On Tue, Oct 9, 2018 at 11:30 AM Jeff Newmiller wrote: > > Instead of changing the order in which you read the files, perhaps your > analysis will work if you

Re: [R] Reorder file names read by list.files function

2018-10-09 Thread William Dunlap via R-help
Use basename(filename) to remove the lead parts of the full path to the file. E.g., replace FNs <- sort(match(sub("\\.PDF", "", file.names), month.name)) with (the untested) FNs <- sort(match(sub("\\.PDF", "", basename(file.names)), month.name)) Bill Dunlap TIBCO Software wdunlap tibco.com

Re: [R] Reorder file names read by list.files function

2018-10-09 Thread Rui Barradas
Hello, I would do something along the lines of # work in the directory where the files are located old_dir <- setwd(path) file.names <- list.files(pattern = "\\.PDF") [...] # When you are done reset your wd setwd(old_dir) Hope this helps, Rui Barradas Às 21:38 de 09/10/2018, Ek Esawi escre

Re: [R] Reorder file names read by list.files function

2018-10-09 Thread Ek Esawi
Hi again, I worked with RUi's idea of using the match function with month.name. I got numerical values for months then i sorted and pasted the PDF file extension. It gave me the file order i wanted, but now statements 8,9,&10 don't work and i kept getting an error which is listed below. The dilemm

Re: [R] Creating a data frame

2018-10-09 Thread Nathan Parsons
Please post both the code you are using and the error, Abigail. Nate On Oct 9, 2018, 11:59 AM -0700, Friedman, Abigail , wrote: > I keep getting error messages when running my data frame code and I cannot > figure out what I am doing wrong. > > > [[alternative HTML version deleted]] > >

Re: [R] Creating a data frame

2018-10-09 Thread Rui Barradas
Hello, Well, you must post the said code (and data), how can we help you without seeing it? In order to post data, post the output of dput(df) in your mail. Or, if it is too big with the output of dput(head(df, 20)). (df is the name of your dataset.) Also, don't post in html, please, see t

[R] Creating a data frame

2018-10-09 Thread Friedman, Abigail
I keep getting error messages when running my data frame code and I cannot figure out what I am doing wrong. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman

Re: [R] Rounding behavior

2018-10-09 Thread Ryan Derickson
I thought it might be a floating issue but didn't see the connection. Thanks everyone. On Tue, Oct 9, 2018, 2:00 PM Benoit Vaillant wrote: > Hello, > > On Tue, Oct 09, 2018 at 01:14:54PM -0400, Ryan Derickson wrote: > > Apologies if this is a simple misunderstanding. > > See for example: > > htt

Re: [R] Rounding behavior

2018-10-09 Thread Benoit Vaillant
Hello, On Tue, Oct 09, 2018 at 01:14:54PM -0400, Ryan Derickson wrote: > Apologies if this is a simple misunderstanding. See for example: https://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f > round((.575*100),0) gives 57 > round(57.5,0) gives 58 >

Re: [R] Rounding behavior

2018-10-09 Thread Jeff Newmiller
Floating point numbers are approximations in base 2, so any fractions not representing such numbers may round off in unexpected directions. sprintf( "%22.20f", 0.5 ) sprintf( "%22.20f", 0.575 ) See R FAQ 7.31. On October 9, 2018 10:14:54 AM PDT, Ryan Derickson wrote: >Hello, > >Apologies if t

Re: [R] Rounding behavior

2018-10-09 Thread Richard M. Heiberger
FAQ 7.31 Open this file in your favorite text editor on your computer system.file("../../doc/FAQ") 57.5 comes out even in binary, and .575 does not. > print(.575*100, digits=17) [1] 57.493 ## The fraction is less than .5, hence it gets rounded down to 57 > print(57.5, digits=17) [1] 5

[R] Rounding behavior

2018-10-09 Thread Ryan Derickson
Hello, Apologies if this is a simple misunderstanding. round((.575*100),0) gives 57 round(57.5,0) gives 58 Why? Ryan Derickson University of Cincinnati On Tue, Oct 9, 2018, 10:08 AM PIKAL Petr wrote: > Hi > > You could use brute force approach. Just print out "file.names" and > estimate orde

[R] Graphing output

2018-10-09 Thread Steven Yen
Is it possible to release the file destination after sending it to a pdf file? Below, line 3 send the graph to a pdf file. I like to release the devise so that I can see result produced by line for on the console (screen). Thanks. x<-1:10 pdf("test1.pdf") # pdf {grDevices} boxplot(x) # This goes

Re: [R] Graphing output

2018-10-09 Thread William Dunlap via R-help
Look at dev.off() or possibly dev.set(). Bill Dunlap TIBCO Software wdunlap tibco.com On Tue, Oct 9, 2018 at 9:17 AM, Steven Yen wrote: > Is it possible to release the file destination after sending it to a pdf > file? > Below, line 3 send the graph to a pdf file. > I like to release the devise

Re: [R] Reorder file names read by list.files function

2018-10-09 Thread Jeff Newmiller
Instead of changing the order in which you read the files, perhaps your analysis will work if you sort the data after you read it in. This may require that you add the month names as a column in the data frames, or you may already have dates in the data that you could sort by. One idea: fnames

Re: [R] Reorder file names read by list.files function

2018-10-09 Thread Jeff Newmiller
Instead of changing the order in which you read the files, perhaps your analysis will work if you sort the data after you read it in. This may require that you add the month names as a column in the data frames, or you may already have dates in the data that you could sort by. One idea: fnames

Re: [R] how to pass arguments to panel.cor in pairs()

2018-10-09 Thread Duncan Murdoch
On 09/10/2018 10:53 AM, Jinsong Zhao wrote: Hi there, Here is the panel.cor function from ?pairs: panel.cor <- function(x, y, digits = 2, prefix = "", cex.cor, ...) { usr <- par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r <- abs(cor(x, y))

[R] Can I safely use an installed R folder in a portable manner?

2018-10-09 Thread Marc Capavanni via R-help
Hi there, I'm currently using R on Windows as part of a piece of software and when I'm providing it to users I have an application that runs the R installation file with an INF file containing the following settings as to not disrupt existing installs of R on their system. [Setup] Lang=en Dir=.\R

[R] how to pass arguments to panel.cor in pairs()

2018-10-09 Thread Jinsong Zhao
Hi there, Here is the panel.cor function from ?pairs: panel.cor <- function(x, y, digits = 2, prefix = "", cex.cor, ...) { usr <- par("usr"); on.exit(par(usr)) par(usr = c(0, 1, 0, 1)) r <- abs(cor(x, y)) txt <- format(c(r, 0.123456789), digits = digi

Re: [R] Reorder file names read by list.files function

2018-10-09 Thread Rui Barradas
Hello, You can use the built in variable month.name to get the calendar order and match it with your file names. i <- match(sub("\\.PDF", "", file.names), month.name) file.names[i] #[1] "January.PDF" "February.PDF" "March.PDF" Hope this helps, Rui Barradas Às 14:44 de 09/10/2018, Ek Esa

Re: [R] Reorder file names read by list.files function

2018-10-09 Thread PIKAL Petr
Hi You could use brute force approach. Just print out "file.names" and estimate ordering vector. In czech locale it is oo <- c(6, 11, 1, 4, 5, 2, 3, 10, 12, 9, 7, 8) In english locale it is different :-) After that file.names[oo] should give you correct order of file names Cheers Petr > ---

[R] Reorder file names read by list.files function

2018-10-09 Thread Ek Esawi
Hi All-- I used base R list.file function to read files from a directory. The file names are months (April, August, etc). That's the system reads them in alphabetical order., but i want to reordered them in calendar order (January, February, ...December).. I thought i might be able to do it via Re