Skip to contents

Method for printing an extensible time-series object.

Usage

# S3 method for class 'xts'
print(x, fmt, ..., show.rows = 10, max.rows = 100)

Arguments

x

An xts object.

fmt

Passed to coredata() to format the time index.

...

Arguments passed to other methods.

show.rows

The number of first and last rows to print if the number of rows is truncated (default 10, or getOption("xts.print.show.rows")).

max.rows

The output will contain at most max.rows rows before being truncated (default 100, or getOption("xts.print.max.rows")).

Value

Returns x invisibly.

Author

Joshua M. Ulrich

Examples


data(sample_matrix)
sample.xts <- as.xts(sample_matrix)

# output is truncated and shows first and last 10 observations
print(sample.xts)
#>                Open     High      Low    Close
#> 2007-01-02 50.03978 50.11778 49.95041 50.11778
#> 2007-01-03 50.23050 50.42188 50.23050 50.39767
#> 2007-01-04 50.42096 50.42096 50.26414 50.33236
#> 2007-01-05 50.37347 50.37347 50.22103 50.33459
#> 2007-01-06 50.24433 50.24433 50.11121 50.18112
#> 2007-01-07 50.13211 50.21561 49.99185 49.99185
#> 2007-01-08 50.03555 50.10363 49.96971 49.98806
#> 2007-01-09 49.99489 49.99489 49.80454 49.91333
#> 2007-01-10 49.91228 50.13053 49.91228 49.97246
#> 2007-01-11 49.88529 50.23910 49.88529 50.23910
#>        ...                                    
#> 2007-06-21 47.71012 47.71012 47.61106 47.62921
#> 2007-06-22 47.56849 47.59266 47.32549 47.32549
#> 2007-06-23 47.22873 47.24771 47.09144 47.24771
#> 2007-06-24 47.23996 47.30287 47.20932 47.22764
#> 2007-06-25 47.20471 47.42772 47.13405 47.42772
#> 2007-06-26 47.44300 47.61611 47.44300 47.61611
#> 2007-06-27 47.62323 47.71673 47.60015 47.62769
#> 2007-06-28 47.67604 47.70460 47.57241 47.60716
#> 2007-06-29 47.63629 47.77563 47.61733 47.66471
#> 2007-06-30 47.67468 47.94127 47.67468 47.76719

# show the first and last 5 observations
print(sample.xts, show.rows = 5)
#>                Open     High      Low    Close
#> 2007-01-02 50.03978 50.11778 49.95041 50.11778
#> 2007-01-03 50.23050 50.42188 50.23050 50.39767
#> 2007-01-04 50.42096 50.42096 50.26414 50.33236
#> 2007-01-05 50.37347 50.37347 50.22103 50.33459
#> 2007-01-06 50.24433 50.24433 50.11121 50.18112
#>        ...                                    
#> 2007-06-26 47.44300 47.61611 47.44300 47.61611
#> 2007-06-27 47.62323 47.71673 47.60015 47.62769
#> 2007-06-28 47.67604 47.70460 47.57241 47.60716
#> 2007-06-29 47.63629 47.77563 47.61733 47.66471
#> 2007-06-30 47.67468 47.94127 47.67468 47.76719