Reputation: 149
I found some of my built-in datasets cannot show full columns. For example, when I type the code: View(mdeaths) I can only see the data below. However, I can see the full information of mtcars.
Is it just me or this is a bug thing? Can I restore the datasets?
Upvotes: 0
Views: 767
Reputation: 15072
I commented without checking for myself. mdeaths
is not in fact a matrix or dataframe, it is a ts
time-series object which displays in a single column when called with View(). So this is not a bug, it is just how the dataset is provided. You can see that it prints normally if you call print(mdeaths)
. If you want it as a matrix or a dataframe, you can convert it like so:
matrix(mdeaths, ncol = 12, byrow = TRUE)
#> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12]
#> [1,] 2134 1863 1877 1877 1492 1249 1280 1131 1209 1492 1621 1846
#> [2,] 2103 2137 2153 1833 1403 1288 1186 1133 1053 1347 1545 2066
#> [3,] 2020 2750 2283 1479 1189 1160 1113 970 999 1208 1467 2059
#> [4,] 2240 1634 1722 1801 1246 1162 1087 1013 959 1179 1229 1655
#> [5,] 2019 2284 1942 1423 1340 1187 1098 1004 970 1140 1110 1812
#> [6,] 2263 1820 1846 1531 1215 1075 1056 975 940 1081 1294 1341
Created on 2018-07-03 by the reprex package (v0.2.0).
Upvotes: 2