tidyverse / hms

A simple class for storing time-of-day values
https://hms.tidyverse.org/
Other
138 stars 25 forks source link

time column in spss is different from time column of the same file imported in R #64

Closed reyntjesr closed 5 years ago

reyntjesr commented 6 years ago

I have a spss file with a time column called "tijdstartklin". When I view this file in spss, rows 11 and 14 (subject 15 and 19) have the times 0:23:48 and 0:29:35. When I import the spss file with the command:

SpNm=haven::read_spss('example.sav') %>% mutate(parsed=hms::parse_hms(tijdstartklin))

The "tijdstartklin" fields of subjects 15 and 19 are now 00:23:471 and 00:29:341 and in the "parsed" column the times are 00:23:00 and 00:29:00.

Is this an error in the spss file or does haven import the column incorrectly?

example.zip

spss version 23

sessionInfo() R version 3.5.0 (2018-04-23) Platform: x86_64-w64-mingw32/x64 (64-bit) Running under: Windows 7 x64 (build 7601) Service Pack 1

Matrix products: default

locale: [1] LC_COLLATE=Dutch_Netherlands.1252 LC_CTYPE=Dutch_Netherlands.1252 LC_MONETARY=Dutch_Netherlands.1252 [4] LC_NUMERIC=C LC_TIME=Dutch_Netherlands.1252

attached base packages: [1] stats graphics grDevices datasets utils methods base

other attached packages: [1] haven_1.1.2 ggplot2_3.0.0 dplyr_0.7.6

loaded via a namespace (and not attached): [1] Rcpp_0.12.18 rstudioapi_0.7 bindr_0.1.1 magrittr_1.5 hms_0.4.2 tidyselect_0.2.4 munsell_0.5.0
[8] colorspace_1.3-2 R6_2.2.2 rlang_0.2.1 plyr_1.8.4 tools_3.5.0 grid_3.5.0 gtable_0.2.0
[15] withr_2.1.2 yaml_2.2.0 lazyeval_0.2.1 assertthat_0.2.0 tibble_1.4.2 crayon_1.3.4 bindrcpp_0.2.2
[22] purrr_0.2.5 glue_1.3.0 compiler_3.5.0 pillar_1.3.0 forcats_0.3.0 scales_0.5.0 pkgconfig_2.0.1

hadley commented 5 years ago

This appears to be an hms printing issue:

library(hms)
x <- 1775 - 2.273737e-13
as.hms(x)
#> 00:29:341

Created on 2019-01-23 by the reprex package (v0.2.1.9000)

github-actions[bot] commented 3 years ago

This old thread has been automatically locked. If you think you have found something related to this, please open a new issue and link to this old issue if necessary.