Re: [R] csv vs. data frame
I have no doubt that Bret has been a huge contributor and my comment was (not) directed at him, nor in direct reply to his. My comment was a general statement that he (I don't recall his name) should not be offended because there is going to be hostility in any environment, and that I personally just focus on learning and picking things up. I personally don't see a problem with this forum as being used as a (first resort) because you never know, someone (like myself) would learn and pick up some information. After all, this is R Help, right? Not just Help for the advanced users. If it's known knowledge to you, then why not just delete it or not even read it? I don't see the harm in that, meanwhile, less advanced users, beginners like myself, could pick up a few things here and there :) I'm only replying to your response because it was a thoughtful response and I didn't just want to just ignore it. On Aug 19, 2010, at 3:11 PM, Gavin Simpson wrote: On Thu, 2010-08-19 at 14:02 -0700, r.ookie wrote: > I agree with you Duncan because I sense the hostility too, but, in any > environment, there are going to be those who 'don't play well with > others.' I just delete and read the next posting. I'm personally here > to learn :) If you knew Bert's contributions to this list (and No, I don't know him personally), linking him with "those who 'don't play well with others.'" is way off mark. There is an increasing tendency for this list to be the first, only and instant avenue of support for anyone using R. One could argue that Bruce's question was sufficiently basic that had he read the posting guide, which points to the manual Bert mentioned, he could have answered his question with 5 minutes of locating/downloading and ten minutes reading. Yet the question came here. Yes, I agree that this list must remain civil and be a place that is welcoming of new users, but it is frustrating when such questions are asked after people (not me) have gone to the trouble of writing documentation that explains the answers and posters don't bother to read it. Bruce; to link Bert's and Duncan's replies, it is easy to read data stored as CSV data into R. As CSV files can be read by external software such as MS Excel and OpenOffice.org leaving source data in this format is probably preferable to importing to a data frame and then saving out the R representation of this data frame object. The read.csv() function is designed for this purpose. It will result in a data frame (an object of class "data.frame") in the global environment/workspace if assigned to an object name: foo <- read.csv("foo.csv") If your users are from European countries where "," is the decimal and CSV file fields are separated by ";", then the read.csv2() function should be used instead. Or cook your own via read.table(). Read the relevant section of An Introduction to R: http://cran.r-project.org/doc/manuals/R-intro.html#Data-frames so you get a feel for what data frames are in R, and also look at the help for read.csv() (?read.csv executed from an R prompt) to learn how non-numeric data is interpreted by R; for example, character data may be imported as a factor in R, which may not be what you/your users want. Arguments to read.csv() and the underlying read.table() function allow you to control this. HTH G > On Aug 19, 2010, at 1:42 PM, Duncan Murdoch wrote: > > On 19/08/2010 4:15 PM, Bert Gunter wrote: >> Do not post such questions to this list. >> Read an Introduction to R first, please. >> > > I think that's a bit harsh: Bruce is trying to help R users, but doesn't > necessarily want to learn to be one. >> -- Bert >> >> On Thu, Aug 19, 2010 at 12:55 PM, Bruce Como wrote: >>> Hi, >>> >>> I am neither a statistician nor a user of R. I am a programmer trying to >>> provide my users (both statisticians and R users) data in a format that >>> works best for them. >>> >>> What is a data frame? Is source data easier to work with in this format or >>> a csv file? Or yet another format? >> > > A data frame is an internal structure in R. If you produce data in a csv > file, it is easy for an R user to import it into a data frame. Take the > usual care > with quotes, commas, etc. within strings in the file. > > Duncan Murdoch > >>> >>> Thanks for your time. >>> >>> Bruce >>> >>> >>> [[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] csv vs. data frame
On Thu, 2010-08-19 at 14:02 -0700, r.ookie wrote: > I agree with you Duncan because I sense the hostility too, but, in any > environment, there are going to be those who 'don't play well with > others.' I just delete and read the next posting. I'm personally here > to learn :) If you knew Bert's contributions to this list (and No, I don't know him personally), linking him with "those who 'don't play well with others.'" is way off mark. There is an increasing tendency for this list to be the first, only and instant avenue of support for anyone using R. One could argue that Bruce's question was sufficiently basic that had he read the posting guide, which points to the manual Bert mentioned, he could have answered his question with 5 minutes of locating/downloading and ten minutes reading. Yet the question came here. Yes, I agree that this list must remain civil and be a place that is welcoming of new users, but it is frustrating when such questions are asked after people (not me) have gone to the trouble of writing documentation that explains the answers and posters don't bother to read it. Bruce; to link Bert's and Duncan's replies, it is easy to read data stored as CSV data into R. As CSV files can be read by external software such as MS Excel and OpenOffice.org leaving source data in this format is probably preferable to importing to a data frame and then saving out the R representation of this data frame object. The read.csv() function is designed for this purpose. It will result in a data frame (an object of class "data.frame") in the global environment/workspace if assigned to an object name: foo <- read.csv("foo.csv") If your users are from European countries where "," is the decimal and CSV file fields are separated by ";", then the read.csv2() function should be used instead. Or cook your own via read.table(). Read the relevant section of An Introduction to R: http://cran.r-project.org/doc/manuals/R-intro.html#Data-frames so you get a feel for what data frames are in R, and also look at the help for read.csv() (?read.csv executed from an R prompt) to learn how non-numeric data is interpreted by R; for example, character data may be imported as a factor in R, which may not be what you/your users want. Arguments to read.csv() and the underlying read.table() function allow you to control this. HTH G > On Aug 19, 2010, at 1:42 PM, Duncan Murdoch wrote: > > On 19/08/2010 4:15 PM, Bert Gunter wrote: > > Do not post such questions to this list. > > Read an Introduction to R first, please. > > > > I think that's a bit harsh: Bruce is trying to help R users, but doesn't > necessarily want to learn to be one. > > -- Bert > > > > On Thu, Aug 19, 2010 at 12:55 PM, Bruce Como wrote: > > > Hi, > > > > > > I am neither a statistician nor a user of R. I am a programmer trying to > > > provide my users (both statisticians and R users) data in a format that > > > works best for them. > > > > > > What is a data frame? Is source data easier to work with in this format > > > or > > > a csv file? Or yet another format? > > > > A data frame is an internal structure in R. If you produce data in a csv > file, it is easy for an R user to import it into a data frame. Take the > usual care > with quotes, commas, etc. within strings in the file. > > Duncan Murdoch > > > > > > > Thanks for your time. > > > > > > Bruce > > > > > > > > >[[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. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Dr. Gavin Simpson [t] +44 (0)20 7679 0522 ECRC, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/ UK. WC1E 6BT. [w] http://www.freshwaters.org.uk %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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/post
Re: [R] csv vs. data frame
On 19/08/2010 4:15 PM, Bert Gunter wrote: Do not post such questions to this list. Read an Introduction to R first, please. I think that's a bit harsh: Bruce is trying to help R users, but doesn't necessarily want to learn to be one. -- Bert On Thu, Aug 19, 2010 at 12:55 PM, Bruce Como wrote: > Hi, > > I am neither a statistician nor a user of R. I am a programmer trying to > provide my users (both statisticians and R users) data in a format that > works best for them. > > What is a data frame? Is source data easier to work with in this format or > a csv file? Or yet another format? A data frame is an internal structure in R. If you produce data in a csv file, it is easy for an R user to import it into a data frame. Take the usual care with quotes, commas, etc. within strings in the file. Duncan Murdoch > > Thanks for your time. > > Bruce > > >[[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] csv vs. data frame
I agree with you Duncan because I sense the hostility too, but, in any environment, there are going to be those who 'don't play well with others.' I just delete and read the next posting. I'm personally here to learn :) On Aug 19, 2010, at 1:42 PM, Duncan Murdoch wrote: On 19/08/2010 4:15 PM, Bert Gunter wrote: > Do not post such questions to this list. > Read an Introduction to R first, please. > I think that's a bit harsh: Bruce is trying to help R users, but doesn't necessarily want to learn to be one. > -- Bert > > On Thu, Aug 19, 2010 at 12:55 PM, Bruce Como wrote: > > Hi, > > > > I am neither a statistician nor a user of R. I am a programmer trying to > > provide my users (both statisticians and R users) data in a format that > > works best for them. > > > > What is a data frame? Is source data easier to work with in this format or > > a csv file? Or yet another format? > A data frame is an internal structure in R. If you produce data in a csv file, it is easy for an R user to import it into a data frame. Take the usual care with quotes, commas, etc. within strings in the file. Duncan Murdoch > > > > Thanks for your time. > > > > Bruce > > > > > >[[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] csv vs. data frame
Bruce Como wrote: Hi, I am neither a statistician nor a user of R. I am a programmer trying to provide my users (both statisticians and R users) data in a format that works best for them. It sounds like they would be the best ones to ask then. What is a data frame? Is source data easier to work with in this format or a csv file? Or yet another format? A data.frame is a class of a certain type of R object. It is basically a way to store rectangular data, rows for observations, columns for variables. Since R objects exist in memory, you can write out things like data.frames to disk with the ?save function, so others can load them with the ?load function. I think your users will have to tell you what is easiest for them. __ 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 vs. data frame
Do not post such questions to this list. Read an Introduction to R first, please. -- Bert On Thu, Aug 19, 2010 at 12:55 PM, Bruce Como wrote: > Hi, > > I am neither a statistician nor a user of R. I am a programmer trying to > provide my users (both statisticians and R users) data in a format that > works best for them. > > What is a data frame? Is source data easier to work with in this format or > a csv file? Or yet another format? > > Thanks for your time. > > Bruce > > > [[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. > -- Bert Gunter Genentech Nonclinical Biostatistics 467-7374 http://devo.gene.com/groups/devo/depts/ncb/home.shtml __ 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] csv vs. data frame
Hi, I am neither a statistician nor a user of R. I am a programmer trying to provide my users (both statisticians and R users) data in a format that works best for them. What is a data frame? Is source data easier to work with in this format or a csv file? Or yet another format? Thanks for your time. Bruce [[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.