Converting AIS Message to Number

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

Converting AIS Message to Number

PaulJr
Dear friends,

Hope you are doing great. I would like to process an AIS file (which comes
in either a .txt or .csv format). The AIS file is contained in a specific
path, say C:/AISFiles/File.txt. The file contains messages like the
following:
!AIVDM,2,1,2,A,5EPtgd42CRtIADNU@N0<E98v1@TM8F222222220m1HB586R`0?0kk3k`40CP,0*2D,1532995201
(all of this is a single message).

Is there a way to make R automatically retrieve the latest file saved on
the path, take each message and convert it to a number?

Best regards,

Paul

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Converting AIS Message to Number

Bert Gunter-2
The "digest" package might be what you're looking for: messages --> numerics
Or perhaps you want to create a hash in R. Search on "hashing in R" or
similar for info on this.

See ?file.info  for obtaining file info, including date/time info.



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )


On Mon, Dec 23, 2019 at 10:14 AM Paul Bernal <[hidden email]> wrote:

> Dear friends,
>
> Hope you are doing great. I would like to process an AIS file (which comes
> in either a .txt or .csv format). The AIS file is contained in a specific
> path, say C:/AISFiles/File.txt. The file contains messages like the
> following:
> !AIVDM,2,1,2,A,5EPtgd42CRtIADNU@N0<E98v1@TM8F222222220m1HB586R
> `0?0kk3k`40CP,0*2D,1532995201
> (all of this is a single message).
>
> Is there a way to make R automatically retrieve the latest file saved on
> the path, take each message and convert it to a number?
>
> Best regards,
>
> Paul
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.
>

        [[alternative HTML version deleted]]

______________________________________________
[hidden email] 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.
Reply | Threaded
Open this post in threaded view
|

Re: Converting AIS Message to Number

Jim Lemon-4
In reply to this post by PaulJr
Hi Paul,
For your first question:

max(file.info(".")$mtime)
[1] "2019-12-21 21:04:19 AEDT"

As for the second, I didn't know what an AIS file was, so I googled
it. I still don't know, so I don't have a clue how to turn a string
like that into a number.

Jim

On Tue, Dec 24, 2019 at 5:14 AM Paul Bernal <[hidden email]> wrote:

>
> Dear friends,
>
> Hope you are doing great. I would like to process an AIS file (which comes
> in either a .txt or .csv format). The AIS file is contained in a specific
> path, say C:/AISFiles/File.txt. The file contains messages like the
> following:
> !AIVDM,2,1,2,A,5EPtgd42CRtIADNU@N0<E98v1@TM8F222222220m1HB586R`0?0kk3k`40CP,0*2D,1532995201
> (all of this is a single message).
>
> Is there a way to make R automatically retrieve the latest file saved on
> the path, take each message and convert it to a number?
>
> Best regards,
>
> Paul
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] 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.

______________________________________________
[hidden email] 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.