Hi,
 
I am trying to write some code that tracks changes that may have been made
after a dataframe has been edited using fix(). But if I edit only the first 
cell (row 1, col 1) of the dataset below, it is like many records were edited. 
What is the explanation for this error?
 
require(R.utils)
original <- melanoma
edited <- melanoma
fix(edited)
difference <- setdiff(edited, original)
difference[, "lastModifiedInto"] <- paste(names(difference), collapse = "; ")
difference[, "lastModifiedBy"] <- R.utils::getBuiltinUsername.GString()
difference[, "lastModifiedOn"] <- Sys.time()
edited <- merge(original, difference, "row.names", all = TRUE)
edited <- edited[order(as.numeric(edited[, "Row.names"])),]
modifiedRecords <- edited[which(!is.na(edited[, "lastModifiedOn"])),]
(nrow(modifiedRecords))

TIA!

Cheers!!
Albert-Jan

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public 
order, irrigation, roads, a fresh water system, and public health, what have 
the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


      
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to