comes as "[[2017-01-01,54]data [2017-01-02,79],<SKIP, [2017-02-01,160]]".>, and ends with 2 brackets.starts day's dataeach a pair of date and # of incident separated by "]is ["., execute command.wget retrieved file.open unnecessary brackets andremove .separtor data into array @data.store each @data entry to pick up date and data.disassemble Rconstruct to input, which is made up from start date, end date and # of incident of each day.sentences
#! /
# $file="
$file="
$outfile="
# data is expected to come in a
# remove 2 brackets at the start and the end of the input.
$buff =
$buff =
# split data at the sequence of "]
@data = split(/\],\[/, $buff);
}
# get the length of the list.
$size = @data;
$count = 0;
# prepare start of the output statement.
$output = "w <- c
@xts = split
$startdate = $xts
# print "
{
@xts = split
$output =$output
}
$output =
# add date sequence with start date and end date.
$output = $output."),seq(as.Date(\"$startdate\"),as.Date(\"$xts[0]\"),1)))";
$len = scalar
# remove input file.