Skip to content

Add generic method print for the class trainServices #23

@villegar

Description

@villegar

No services are shown when "printing" an object of the class trainServices

> pre <- trainR::GetArrBoardRequest("PRE")
> pre
Preston (PRE) Station Board on 2021-07-06 22:30:28
Time   From                                    Plat  Expected
22:40  York                                    1     00:00
23:25  Hazel Grove                             2     On time
23:39  York                                    1     00:24
23:42  Ormskirk                                3     On time
23:43  Windermere                              6     On time
23:44  Blackpool North                         4     On time
23:50  London Euston                           5     On time
23:51  Manchester Airport                      1     On time
00:02  Blackpool South                         2     On time
00:10  Colne                                   1     On time
00:23  Manchester Airport                      3     On time
00:27  Liverpool Lime Street                   1     00:29
00:53  Manchester Airport                      3     On time

> pre$trainServices
Time   To                                      Plat  Expected
pre <- structure(list(generatedAt = structure(1625610628.66814, class = c("POSIXct", 
"POSIXt"), tzone = "UTC"), locationName = "Preston", crs = "PRE", 
    filterLocationName = NA, filtercrs = NA, filterType = NA, 
    nrccMessages = structure(list(structure(list(message = "Trains through Hebden Bridge may be cancelled or delayed by up to 45 minutes. More information can be found in <a href=\"http://nationalrail.co.uk/service_disruptions/274757.aspx\">Latest Travel News.</a>"), row.names = c(NA, 
    -1L), class = c("tbl_df", "tbl", "data.frame"))), class = c("nrccMessages", 
    "list")), platformAvailable = "true", trainServices = structure(list(
        structure(list(sta = c("22:40", "23:25", "23:39", "23:42", 
        "23:43", "23:44", "23:50", "23:51", "00:02", "00:10", 
        "00:23", "00:27", "00:53"), eta = c("00:00", "On time", 
        "00:24", "On time", "On time", "On time", "On time", 
        "On time", "On time", "On time", "On time", "00:29", 
        "On time"), std = c(NA, NA, NA, NA, NA, NA, NA, NA, NA, 
        NA, NA, NA, NA), etd = c(NA, NA, NA, NA, NA, NA, NA, 
        NA, NA, NA, NA, NA, NA), platform = c("1", "2", "1", 
        "3", "6", "4", "5", "1", "2", "1", "3", "1", "3"), operator = c("Northern", 
        "Northern", "Northern", "Northern", "Northern", "Northern", 
        "Avanti West Coast", "Northern", "Northern", "Northern", 
        "Northern", "Northern", "Northern"), operatorCode = c("NT", 
        "NT", "NT", "NT", "NT", "NT", "VT", "NT", "NT", "NT", 
        "NT", "NT", "NT"), serviceType = c("train", "train", 
        "train", "train", "train", "train", "train", "train", 
        "train", "train", "train", "train", "train"), serviceID = c("4FJNaa5ImNdcCTHZROtMBg==", 
        "crcIW68UnOCsGTGKentEww==", "A8h67U4NSAM4Kxozd6/tKQ==", 
        "gXxr0uT0Pg9DNnAZS9INLQ==", "D5aCtokpLC+IcR84fY8sSg==", 
        "18mTLuKzg2HJV5Jmj7vsEA==", "atVGVEKPObPV2zO8PZrRlw==", 
        "1XIMRvqP0MxuywORqHqCBw==", "zSlL00znm8wV5NEJJomcRQ==", 
        "9FqitnBuhXtcd03CGFmmVQ==", "CKwamnLu5PmTO+9ZgJU0YQ==", 
        "SvkTOz7zUj0vbxeqk37vkA==", "HDhj1eD0nA1p/oAXivfHDQ=="
        ), rsid = c("NT213000", "NT933000", "NT213200", "NT909300", 
        "NT929500", "NT920100", "VT638000", "NT919600", "NT927900", 
        "NT937400", "NT933200", "NT948600", "NT919800"), origin = structure(list(
            structure(list(locationName = "York", crs = "YRK", 
                via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "Hazel Grove", crs = "HAZ", 
                via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "York", crs = "YRK", 
                via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "Ormskirk", crs = "OMS", 
                via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "Windermere", crs = "WDM", 
                via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "Blackpool North", 
                crs = "BPN", via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "London Euston", crs = "EUS", 
                via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "Manchester Airport", 
                crs = "MIA", via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "Blackpool South", 
                crs = "BPS", via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "Colne", crs = "CNE", 
                via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "Manchester Airport", 
                crs = "MIA", via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "Liverpool Lime Street", 
                crs = "LIV", via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame")), 
            structure(list(locationName = "Manchester Airport", 
                crs = "MIA", via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
            -1L), class = c("tbl_df", "tbl", "data.frame"))), class = c("ServiceLocation", 
        "list")), destination = structure(list(structure(list(
            locationName = "Blackpool North", crs = "BPN", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Blackpool North", crs = "BPN", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Blackpool North", crs = "BPN", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Preston", crs = "PRE", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Preston", crs = "PRE", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Manchester Airport", crs = "MIA", 
            via = NA, futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Preston", crs = "PRE", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Blackpool North", crs = "BPN", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Preston", crs = "PRE", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Preston", crs = "PRE", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Blackpool North", crs = "BPN", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Preston", crs = "PRE", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame")), structure(list(
            locationName = "Blackpool North", crs = "BPN", via = NA, 
            futureChangeTo = NA, assocIsCancelled = NA), row.names = c(NA, 
        -1L), class = c("tbl_df", "tbl", "data.frame"))), class = c("ServiceLocation", 
        "list")), previousCallingPoints = structure(list(NA, 
            NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), class = c("previousCallingPoints", 
        "list")), subsequentCallingPoints = structure(list(NA, 
            NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), class = c("subsequentCallingPoints", 
        "list")), isCancelled = c(NA, NA, NA, NA, NA, NA, NA, 
        NA, NA, NA, NA, NA, NA), cancelReason = c(NA, NA, NA, 
        NA, NA, NA, NA, NA, NA, NA, NA, NA, NA), delayReason = c("This train has been delayed by heavy rain flooding the railway", 
        NA, "This train has been delayed by heavy rain flooding the railway", 
        NA, NA, NA, NA, NA, NA, NA, NA, NA, NA)), row.names = c(NA, 
        -13L), class = c("service", "tbl_df", "tbl", "data.frame"
        ))), class = c("trainServices", "list")), busServices = NA, 
    ferryServices = NA), row.names = c(NA, -1L), class = c("ArrivalBoard", 
"StationBoard", "tbl_df", "tbl", "data.frame"))

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions