[R] read.table() vs read.delim() any difference??
Hi, I have a tab seperated file with 206 rows and 30 columns. I read in the file into R using read.table() function. I checked the dim() of the data frame created in R, it had only 103 rows (exactly half), 30 columns. Then I tried reading in the file using read.delim() function and this time the dim() showed to be 206 rows, 30 columns as expected. Reading the read.table() R-help documentation, I came across count.fields() function. On using that on the tab seperated file, I got to learn that the header line alone has 30 fields and rest of the rows have 9 fields. I am now just wondering why read.delim() function was able to read in the file correctly and read.table() wasn't able to read the file completely ? Could anyone please throw some light on this? Thanks for your valuable time, Regards Sashi [[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] read.table() vs read.delim() any difference??
Thanks Peter. In my case specifying the quote=\ worked out fine with read.table(). -Sashi On Fri, May 4, 2012 at 1:53 PM, peter dalgaard pda...@gmail.com wrote: On May 4, 2012, at 08:16 , Rameswara Sashi Kiran Challa wrote: Hi, I have a tab seperated file with 206 rows and 30 columns. I read in the file into R using read.table() function. I checked the dim() of the data frame created in R, it had only 103 rows (exactly half), 30 columns. Then I tried reading in the file using read.delim() function and this time the dim() showed to be 206 rows, 30 columns as expected. Reading the read.table() R-help documentation, I came across count.fields() function. On using that on the tab seperated file, I got to learn that the header line alone has 30 fields and rest of the rows have 9 fields. I am now just wondering why read.delim() function was able to read in the file correctly and read.table() wasn't able to read the file completely ? Could anyone please throw some light on this? This can't be answered in abstractum. However, all that read.delim does is to call read.table with a specific set of arguments, so you should be able to get the right result from read.table(..., header = TRUE, sep = \t, quote = \, dec = ., fill = TRUE, comment.char = ) So check that it works. If you are curious as to what is causing the difference, just knock out the arguments one by one. Thanks for your valuable time, Regards Sashi [[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. -- 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 [[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 from Java (cluster heatmaps)
Hello All, I am trying to get cluster heatmaps using R from Java in my application. I got the Rserve using which I am able to make TCP/IP connection to R. I am trying to send a double[][] array (say 5x8 dimensions) to R and convert it into matrix using as.matrix() function in R. Is it correct to do this? Can I directly pass this array to dist() function to generate the distance matrix ? if not could someone please direct me how to do it ? I want to be able to pass the matrix into R, compute a distance matrix using dist() and then plot hierarchial cluster using hclust() and then further plot cluster heatmaps calling the bioconductor library. Is Rserve enough for this or will I also need rJava ? Please Reply Thanks -- Sashikiran Challa MS Cheminformatics, School of Informatics and Computing, Indiana University, Bloomington,IN scha...@indiana.edu 812-606-3254 [[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] pass an array of array from Java to R- Rserve
hello all, Could someone please tell me how should I pass a double[][] (matrix of any size) that I have in Java, into R using Rserve. Thanks Sashikiran -- Sashikiran Challa MS Cheminformatics, School of Informatics and Computing, Indiana University, Bloomington,IN scha...@indiana.edu 812-606-3254 [[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 from Java (cluster heatmaps)
Hello All, I am trying to get cluster heatmaps using R from Java in my application. I got the Rserve using which I am able to make TCP/IP connection to R. I am trying to send a double[][] array (say 5x8 dimensions) to R and convert it into matrix using as.matrix() function in R. Is it correct to do this? Can I directly pass this array to dist() function to generate the distance matrix ? if not could someone please direct me how to do it ? I want to be able to pass the matrix into R, compute a distance matrix using dist() and then plot hierarchial cluster using hclust() and then further plot cluster heatmaps calling the bioconductor library. Is Rserve enough for this or will I also need rJava ? Please Reply Thanks -- Sashikiran Challa MS Cheminformatics, School of Informatics and Computing, Indiana University, Bloomington,IN scha...@indiana.edu 812-606-3254 [[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.