Skip to contents

Function to update the created column of the data frame COLSRC with current date and time.

Usage

change_COLSRC(hdr)

Arguments

hdr

A data frame. The COLSRC data frame included in the header component of the named list obtained with readMTZ or readMTZHeader.

Value

The hdr input data frame with the created

column of the COLSRC data frame changed to display the current date and time.

Details

The COLSRC data frame of an MTZ header has a column called created which displays the date and time at which the MTZ file data columns were created. When writing out a modified list obtained from reading an MTZ file, one might want to change the created column with the current date and time. Other specific types of change can be operated by handling the COLSRC data frame in an *ad hoc* manner.

Examples

# Read a sample MTZ file
datadir <- system.file("extdata",package="cry")
filename <- file.path(datadir,"1dei_phases.mtz")
lMTZ <- readMTZ(filename)
#> Warning: truncating string with embedded nuls

# Original COLSRC
print(lMTZ$header$COLSRC)
#>         labels                     created id
#> 1            H CREATED_11/10/2017_01:55:14  0
#> 2            K CREATED_11/10/2017_01:55:14  0
#> 3            L CREATED_11/10/2017_01:55:14  0
#> 4           FP CREATED_11/10/2017_01:55:14  1
#> 5        SIGFP CREATED_11/10/2017_01:55:14  1
#> 6           FC CREATED_11/10/2017_01:55:14  1
#> 7         PHIC CREATED_11/10/2017_01:55:14  1
#> 8       FC_ALL CREATED_11/10/2017_01:55:14  1
#> 9     PHIC_ALL CREATED_11/10/2017_01:55:14  1
#> 10         FWT CREATED_11/10/2017_01:55:14  1
#> 11        PHWT CREATED_11/10/2017_01:55:14  1
#> 12      DELFWT CREATED_11/10/2017_01:55:14  1
#> 13     PHDELWT CREATED_11/10/2017_01:55:14  1
#> 14         FOM CREATED_11/10/2017_01:55:14  1
#> 15   FC_ALL_LS CREATED_11/10/2017_01:55:14  1
#> 16 PHIC_ALL_LS CREATED_11/10/2017_01:55:14  1

# Update date and time stamp
lMTZ$header <- change_COLSRC(lMTZ$header)

# New COLSRC
print(lMTZ$header$COLSRC)
#>         labels                     created id
#> 1            H CREATED_14/06/2022_15:22:04  0
#> 2            K CREATED_14/06/2022_15:22:04  0
#> 3            L CREATED_14/06/2022_15:22:04  0
#> 4           FP CREATED_14/06/2022_15:22:04  1
#> 5        SIGFP CREATED_14/06/2022_15:22:04  1
#> 6           FC CREATED_14/06/2022_15:22:04  1
#> 7         PHIC CREATED_14/06/2022_15:22:04  1
#> 8       FC_ALL CREATED_14/06/2022_15:22:04  1
#> 9     PHIC_ALL CREATED_14/06/2022_15:22:04  1
#> 10         FWT CREATED_14/06/2022_15:22:04  1
#> 11        PHWT CREATED_14/06/2022_15:22:04  1
#> 12      DELFWT CREATED_14/06/2022_15:22:04  1
#> 13     PHDELWT CREATED_14/06/2022_15:22:04  1
#> 14         FOM CREATED_14/06/2022_15:22:04  1
#> 15   FC_ALL_LS CREATED_14/06/2022_15:22:04  1
#> 16 PHIC_ALL_LS CREATED_14/06/2022_15:22:04  1