[R-SIG-Finance] Highfrequency package - Error in if (length(c(year, month, day, hour, min, sec)) == 6 && c(year, :

Jonathan Cornelissen Jonathan.Cornelissen at kuleuven.be
Fri Dec 21 19:17:19 CET 2012


How about:
format <- "%Y%m%d %H:%M:%S"
?
Regards, 
Jonathan

On Dec 21, 2012, at 6:03 PM, Bastian Offermann wrote:

> Hi all,
> 
> I am currently trying to get acquainted with the "highfrequency" 
> package. I get my raw data from WRDS in .csv format. My data looks as 
> follows:
> 
> SYMBOL 	DATE 	TIME 	PRICE 	SIZE 	G127 	CORR 	COND 	EX
> AOL 	20000216 	9:30:31 	53.3125 	622300 	0 	0 	
> 	N
> AOL 	20000216 	9:30:33 	53.3125 	100 	0 	0 	Z 	C
> AOL 	20000216 	9:30:33 	53.3125 	200 	0 	0 	Z 	C
> AOL 	20000216 	9:30:33 	53.3125 	200 	0 	0 	
> 	X
> AOL 	20000216 	9:30:33 	53.3125 	100 	0 	0 	
> 	X
> AOL 	20000216 	9:30:33 	53.3125 	100 	0 	0 	
> 	M
> AOL 	20000216 	9:30:33 	53.3125 	300 	0 	0 	
> 	M
> AOL 	20000216 	9:30:33 	53.3125 	100 	0 	0 	
> 	M
> AOL 	20000216 	9:30:33 	53.3125 	100 	0 	0 	
> 	M
> 
> 
> I followed the steps outlined in the vignette to convert the .csv data 
> into xts and RData formats using the code below, but always get the 
> following error message:
> 
> ### Error in if (length(c(year, month, day, hour, min, sec)) == 6 && 
> c(year,  :
> ### missing value where TRUE/FALSE needed
> ### In addition: Warning messages:
> ### 1: In as_numeric(YYYY) : NAs introduced by coercion
> ### 2: In as_numeric(YYYY) : NAs introduced by coercion
> 
> I am wondering what causes the error? Could it be due to the date format 
> in the .csv file "20000216" versus "2000-02-16" ? Can anybody help out? 
> Thanks in advance!
> 
> 
> 
> 
> 
> ####################### R - CODE 
> ##################################################
> 
> library("highfrequency")
> library("xts")
> library("timeDate")
> library("quantmod")
> rm(list=ls(all=TRUE))
> 
> ### Loading raw data from working directory
> 
> from <- "2000-02-16"
> to <- "2000-02-17"
> datasource <- "C:/Users/User/Desktop/VWL/2013/high/data"
> datadestination <- "C:/Users/User/Desktop/VWL/2013/high/data"
> tradecolnames <- 
> c("SYMBOL","DATE","TIME","PRICE","SIZE","G127","CORR","COND","EX")
> format <- "%Y%M%D %H:%M:%S"
> 
>  convert(from=from, to=to, datasource=datasource, 
> datadestination=datadestination, trades = TRUE,
>                        quotes = FALSE, ticker="AOL", dir = TRUE, 
> extension = "csv", header = TRUE,
>                        tradecolnames = NULL, quotecolnames = NULL, 
> format = format, onefile = TRUE )
> 
> ###########################  SESSION INFO 
> ##########################################
> 
> 
> sessionInfo()
> R version 2.15.2 (2012-10-26)
> Platform: x86_64-w64-mingw32/x64 (64-bit)
> 
> locale:
> [1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United 
> States.1252
> [3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
> 
> attached base packages:
> [1] parallel  stats     graphics  grDevices utils     datasets methods   
> base
> 
> other attached packages:
>  [1] quantmod_0.3-17       TTR_0.21-1 Defaults_1.1-1        
> timeDate_2160.97
>  [5] realized_1.0.1        highfrequency_0.1 xts_0.8-8             
> zoo_1.7-9
>  [9] rugarch_1.0-12        Rsolnp_1.14 truncnorm_1.0-6       chron_2.3-43
> [13] numDeriv_2012.9-1     RcppArmadillo_0.3.4.4 Rcpp_0.10.0           
> R.utils_1.18.0
> [17] R.oo_1.10.1           R.methodsS3_1.4.2
> 
> loaded via a namespace (and not attached):
> [1] grid_2.15.2     lattice_0.20-10 tools_2.15.2
> 
> 
> 
> 
> 
> 
> 	[[alternative HTML version deleted]]
> 
> _______________________________________________
> R-SIG-Finance at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-sig-finance
> -- Subscriber-posting only. If you want to post, subscribe first.
> -- Also note that this is not the r-help list where general R questions should go.



More information about the R-SIG-Finance mailing list