search for: character2

Displaying 2 results from an estimated 2 matches for "character2".

Did you mean: character
2009 Aug 12
3
Zoo and numeric data
Hi, I have a csv file with different datatypes: 2009-01-01, character1, 10, 20.1 2009-01-02, character2, 11, 21.1 (I have attached the file to this post) I read this file with read.zoo as I want a zoo/xts timeseries: > t = read.zoo("./data.txt", sep=",", dec = ".", header=FALSE) If I look at the zoo data all integer/numeric columns are read as character: > str(t...
2013 Aug 16
1
as.Date.character speed improvement suggestion
...Since the time savings can be several minutes in real-life cases, I think this enhancement should certainly be considered. Also, in a worst case scenario of a long vector with only one duplicated value, the suggested change does not slow down the calculation. Here's a proof of concept: as.Date.character2 <- function(x, ...) { if (anyDuplicated(x)) { ux <- unique(x) idx <- match(x, ux) y <- as.Date.character(ux, ...) return(y[idx]) } as.Date.character(x, ...) } ## Example1: Construct a 1-million length character vector of 1000 unique dates ##...