[R] Slicing cra**y csv files

jorgusch hackl.schorsch at web.de
Thu Aug 13 09:57:54 CEST 2009



Patrick Connolly-4 wrote:
> 
> Did you notice that the method creates a dataframe with no rows?
> 
Sure I did, but once data is in R in a proper format, you can create rows
with R tools quite easily. Though, getting first step done, is not always
obvious to me. 
Maybe this is a extrem case, but the files I get hardly ever work with
read.table and it is done. People outside of R do not prepare it well
enough...


Patrick Connolly-4 wrote:
> 
> |> I mean, R can be as fancy and amazing statistical programm as it
> |> is, but not qgetting the data in properly in first place, makes it
> |> kind of useless.
> 
> It has loads of methods of getting the data into the form for
> analysis, and, in any case, you can always get your money back if
> you're not satisfied.
> 

No doubt that I believe you on this matter! I did not want to complain in
general, but R could make it easier for newbies. R does great analysis but
preparing the data has to occur for good parts by hand. On this matter other
programs do a slightly better job.
I am only saying that a wide tutorial on preparing and filtering data would
be helpful. 

My critique sounded a bit harsh, I apologize for that, but please see that
for newcomers with little programming experience the point of frustration is
getting the stuff into R and the help function is not a great help for that.
My colleques and I in our class on introduction in R, usually do not fail
using the stuff we learned but in preparing the data for the use of the
function.

It is like a magic barriere R keeps or wants to keep alive. These are just
my two cents.

Anyway, I thank you a lot for your advice and it will be well remembered. 


Patrick Connolly-4 wrote:
> 
> On Wed, 12-Aug-2009 at 03:36AM -0700, jorgusch wrote:
> 
> |> 
> |> First of all, sorry for not giving all information.
> |> 
> |> Secondly, thanks a lot. This is a real help!! I did not know, that you
> can
> |> use names...
> |> This is really simple and works great!!!
> |> 
> |> If anyone is close enough to the people writing the help in R, please
> tell
> |> them that they should write a tutorial for such scenarios. 
> 
> Well, do you understand how it works?  It's not much like the standard
> use of dataframes.  It just so happens that a feature of dataframes
> and the way they're usually read into R could be used for your task.
> Did you notice that the method creates a dataframe with no rows?
> Generally not much use, but it was in your case.  It would be an
> astounding tutorial writer who managed to think that such a use would
> be useful for someone in, as the airlines say, such a rare event.
> I've never had use of it myself.
> 
> If I devised a way of using, say pliers, to open a jar, would it be
> fair to expect the manufacturers of the pliers to put that into the
> accompanying instructions?
> 
> 
> |> I mean, R can be as fancy and amazing statistical programm as it
> |> is, but not qgetting the data in properly in first place, makes it
> |> kind of useless.
> 
> It has loads of methods of getting the data into the form for
> analysis, and, in any case, you can always get your money back if
> you're not satisfied.
> 
> 
> 
> 
> |> 
> |> jorgusch
> |> 
> |> 
> |> 
> |> Patrick Connolly-4 wrote:
> |> > 
> |> > On Tue, 11-Aug-2009 at 01:39AM -0700, jorgusch wrote:
> |> > 
> |> > |> 
> |> > |> Hello,
> |> > |> 
> |> > |> For not too regular users of R, preparing the data is somehow a
> burden.
> |> > |> 
> |> > |> Comming from iMacro in FireFox I get a badly designed csv, which I
> need
> |> > to
> |> > |> put into a daily R script. 
> |> > |> The data looks like that (e.g.):
> |> > 
> |> > 
> |> > How did you get from here
> |> > 
> |> > |> 22 Results,"35 Results","39 Results","2 Results","7 Results","23
> |> > |> Results","42 Results","36 Results","22 Results","28 Results"
> |> > |> 
> |> > |> and R does this to it:
> |> > 
> |> > 
> |> > to here?
> |> > 
> |> > |>              V1         V2         V3        V4        V5        
> V6        
> |> > |> V7
> |> > |> 1 22 Results 35 Results 39 Results 2 Results 7 Results 23
> Results 42
> |> > |> Results
> |> > |>           V8         V9        V10
> |> > |> 1 36 Results 22 Results 28 Results
> |> > 
> |> > It's probably easy enough to do but we don't have anything repeatable
> to
> |> > use.
> |> > 
> |> > If I make a csv file from the text string and call it junk.csv, I can
> |> > get a vector of numbers like this:
> |> > 
> |> >> as.numeric(gsub("[A-z.]", "", names(read.csv("junk.csv"))))
> |> >  [1]  22  35  39   2   7  23  42  36 221  28
> |> >> 
> |> > 
> |> > But there's probably more general ways if we knew more about your
> |> > position.  It's likely you could use the clipboard instead of the
> |> > junk.csv text file.
> |> > 
> |> > HTH
> |> > 
> |> > 
> |> > 
> |> > |> 
> |> > |> I just need the numbers as a vector.
> |> > |> 
> |> > |> Excel can do it with a few lines of VBA, but there must be a way
> to do
> |> > it
> |> > |> directly in R, would make things easier.
> |> > |> 
> |> > |> Thanks a lot!
> |> > |>  jorgusch
> |> > |> -- 
> |> > |> View this message in context:
> |> >
> http://www.nabble.com/Slicing-cra**y-csv-files-tp24913849p24913849.html
> |> > |> Sent from the R help mailing list archive at Nabble.com.
> |> > |> 
> |> > |> ______________________________________________
> |> > |> R-help at 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.
> |> > 
> |> > -- 
> |> >
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
> |> >    ___    Patrick Connolly   
> |> >  {~._.~}                   Great minds discuss ideas    
> |> >  _( Y )_  	         Average minds discuss events 
> |> > (:_~*~_:)                  Small minds discuss people  
> |> >  (_)-(_)  	                      ..... Eleanor Roosevelt
> |> > 	  
> |> >
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> |> > 
> |> > ______________________________________________
> |> > R-help at 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.
> |> > 
> |> > 
> |> 
> |> -- 
> |> View this message in context:
> http://www.nabble.com/Slicing-cra**y-csv-files-tp24913849p24933830.html
> |> Sent from the R help mailing list archive at Nabble.com.
> |> 
> |> ______________________________________________
> |> R-help at 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.
> 
> -- 
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.   
>    ___    Patrick Connolly   
>  {~._.~}                   Great minds discuss ideas    
>  _( Y )_  	         Average minds discuss events 
> (:_~*~_:)                  Small minds discuss people  
>  (_)-(_)  	                      ..... Eleanor Roosevelt
> 	  
> ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.
> 
> ______________________________________________
> R-help at 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.
> 
> 

-- 
View this message in context: http://www.nabble.com/Slicing-cra**y-csv-files-tp24913849p24950540.html
Sent from the R help mailing list archive at Nabble.com.




More information about the R-help mailing list