Difference between revisions of "Sven/AMPsuper.R"
m |
|||
Line 26: | Line 26: | ||
units <- (transaction - fees) / unitprice | units <- (transaction - fees) / unitprice | ||
− | dset <- data.frame(period, transaction, fees, unitprice, round(units,4)) | + | dset <- data.frame(Date=period, Amount=transaction, Fees=fees, "Unit price"=unitprice, Units=round(units,4)) |
+ | write.table(dset, "AMP.txt", row.names=FALSE, sep="\t") |
Revision as of 00:06, 23 March 2006
library(chron)
- -------------------------------------------------------------- #
- ------------------- Create the dataset --------------------- #
- -------------------------------------------------------------- #
period <- seq.dates("8/12/1998", "2/19/2003", by = "weeks") period <- period[as.logical(seq(length(period)) %% 2)] # Fortnightly period <- c(dates("7/23/98"), period, dates("3/23/2005")) # All dates period <- c(period[1:35], dates("11/20/99"),period[36:length(period)]) # Adding missing date transaction <- c(4879.26, rep(101, 2), rep(50.50, 23), rep(51.01, 9),8.26, rep(51.01, 18), rep(51.57,52), rep(52.81, 15), -2591)
fees <- c(97.59, rep(3.54, 2), rep(1.76, 23), rep(2.55, 9), 0 , rep(1.78, 18), rep(1.8,52), rep(1.84,15), 0) unitprice <- c(1.1621, 1.1426, 1.1488, 1.1231, 1.1192, 1.1171, 1.1338, 1.1590, 1.1585, 1.1637, 1.1712,
1.1964, 1.1983, 1.2057, 1.1979, 1.2096, 1.2092, 1.2151, 1.2199, 1.2254, 1.2273, 1.2209, 1.2130, 1.2162, 1.2269, 1.2398, 1.2294, 1.2223, 1.2280, 1.2375, 1.2300, 1.2247, 1.2263, 1.2412, 1.2431, 1.2467, 1.2551, 1.2701, 1.2769, 1.2716, 1.2583, 1.2649, 1.2627, 1.2764, 1.2840, 1.2907, 1.2636, 1.2822, 1.2821, 1.2803, 1.2975, 1.2953, 1.3155, 1.3115, 1.3154, 1.3211, 1.3401, 1.3314, 1.3411, 1.3260, 1.3194, 1.3221, 1.3163, 1.3169, 1.2803, 1.2872, 1.3005, 1.3045, 1.2948, 1.2839, 1.2809, 1.2854, 1.2875, 1.3071, 1.2984, 1.2998, 1.2968, 1.2931, 1.2916, 1.2868, 1.2855, 1.2663, 1.2569, 1.2260, 1.2366, 1.2464, 1.2538, 1.2632, 1.2779, 1.2743, 1.2712, 1.2735, 1.2659, 1.2577, 1.2548, 1.2645, 1.2634, 1.2589, 1.2537, 1.2413, 1.2410, 1.2399, 1.2259, 1.2091, 1.2127, 1.1620, 1.1426, 1.1728, 1.1598, 1.1423, 1.1174, 1.1178, 1.1406, 1.1269, 1.1465, 1.1285, 1.1275, 1.1325, 1.1185, 1.1094, 1.0964, 1.3060)
units <- (transaction - fees) / unitprice
dset <- data.frame(Date=period, Amount=transaction, Fees=fees, "Unit price"=unitprice, Units=round(units,4)) write.table(dset, "AMP.txt", row.names=FALSE, sep="\t")