I hope this format is lso okay, since I am not so proficient with R and I would love to understand how that methodology works, but I'm a bit under pressure timewise.
test1 <- matrix(c("AAPL", "31/03/1998", "C",
"AAPL", "30/04/1998", 0.2,
"AAPL", "31/05/1998", 0.15,
"INTL", "31/03/1998", 0.05,
"INTL", "30/04/1998", "",
"INTL", "31/05/1998", -0.3,
"GOOG", "31/03/1998", 0.1,
"AAPL", "30/04/1998", "B",
"AAPL", "31/05/1998", 0.4
),
ncol=3,byrow=TRUE)
colnames(test1) <- c("Ticker Symbol","Date","Returns")
smoke <- as.table(test1)
test1
#> Ticker Symbol Date Returns
#> [1,] "AAPL" "31/03/1998" "C"
#> [2,] "AAPL" "30/04/1998" "0.2"
#> [3,] "AAPL" "31/05/1998" "0.15"
#> [4,] "INTL" "31/03/1998" "0.05"
#> [5,] "INTL" "30/04/1998" ""
#> [6,] "INTL" "31/05/1998" "-0.3"
#> [7,] "GOOG" "31/03/1998" "0.1"
#> [8,] "AAPL" "30/04/1998" "B"
#> [9,] "AAPL" "31/05/1998" "0.4"
Created on 2018-05-18 by the reprex package (v0.2.0).
Edited for the letters in returns