Hi Marna,
This very short function deletes everything before the last , if there
is a comma. Some of your entries have comma-space and some just have
comma, so it deletes the optional space as well.
lastdate <- function(x) {
sub("^.*, *", "", x)
}
data.frame(apply(daT, 2, lastdate))
Sarah
O
Dear R-Users,
I have a dataset containing more than two observation dates in some of the
columns and sites but I wanted to extract only the last date of the
observation.
Is there any easiest way to get that last observation in each column/row?
Here is the example data:
daT<-structure(list(ID = c(
2 matches
Mail list logo