[R] read txt file - date - no space
Jeff Newmiller
jdnewm|| @end|ng |rom dcn@d@v|@@c@@u@
Mon Jul 30 19:26:27 CEST 2018
1) No.
2) The read.csv function is a s special case use of the more general read.table function that can handle any simple field separator.
3) Read the data in as character (I recommend using the stringsAsFactors=FALSE argument to read.table) and convert to an appropriate type from that form. e.g. [1]
[1] https://www.r-bloggers.com/using-dates-and-times-in-r/
On July 30, 2018 7:29:05 AM PDT, Diego Avesani <diego.avesani using gmail.com> wrote:
>Dear all,
>
>I am dealing with the reading of a *.txt file.
>The txt file the following shape:
>
>103001930 103001580 103001530
>1998-10-01 00:00:00 0.6 0 0
>1998-10-01 01:00:00 0.2 0.2 0.2
>1998-10-01 02:00:00 0.6 0.2 0.4
>1998-10-01 03:00:00 0 0 0.6
>1998-10-01 04:00:00 0 0 0
>1998-10-01 05:00:00 0 0 0
>1998-10-01 06:00:00 0 0 0
>1998-10-01 07:00:00 0.2 0 0
>
>If it is possible I have a coupe of questions, which will sound stupid
>but
>they are important to me in order to understand ho R deal with file or
>date.
>
>1) Do I have to convert it to a *csv file?
>2) Can a deal with space and not ","
>3) How can I read date?
>
>thanks a lot to all of you,
>Thanks
>
>
>Diego
>
> [[alternative HTML version deleted]]
>
>______________________________________________
>R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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.
--
Sent from my phone. Please excuse my brevity.
More information about the R-help
mailing list