1. Load packages

# install.packages(c("readr","dplyr","xts","zoo"))  # run once if needed
library(readr)
library(dplyr)
library(xts)
library(zoo)

2. Import the data (embedded directly — no external file needed)

data_text <- "CO_ID,Date,Weighted_AVE_CO,Net_Income,Cash_Flow_Oper,Per_Share_CF,Shares,Treasury_Stock_subsi
2064 Camellia,201112,61600,153843,94651,1.54,61600,0
2064 Camellia,201206,61600,-54886,191963,3.12,61600,0
2064 Camellia,201212,61600,-94564,337588,5.48,61600,0
2064 Camellia,201303,61600,34188,115123,1.87,61600,0
2064 Camellia,201306,61600,74411,110874,1.80,61600,0
2064 Camellia,201309,61600,102082,256590,4.17,61600,0
2064 Camellia,201312,61600,136516,256256,4.16,61600,0
2064 Camellia,201403,61600,52738,92174,1.49,61600,0
2064 Camellia,201406,61600,84873,125013,2.02,61600,0
2064 Camellia,201409,61600,130004,206218,3.34,61600,0
2064 Camellia,201412,61784,174462,228888,3.70,70000,0
2064 Camellia,201503,70000,27368,-2426,-0.03,70000,0
2064 Camellia,201506,70000,49779,124301,1.78,70000,0
2064 Camellia,201509,70000,102016,255083,3.64,70000,0
2064 Camellia,201512,70000,95191,375033,5.36,70000,0
2064 Camellia,201603,70000,19504,82991,1.19,70000,0
2064 Camellia,201606,70000,62905,194099,2.77,70000,0
2064 Camellia,201609,70000,56279,96120,1.37,70000,0
2064 Camellia,201612,70000,121347,133251,1.90,70000,0
2064 Camellia,201703,70000,-26113,-116768,-1.67,70000,0
2064 Camellia,201706,70000,5204,-119643,-1.71,70000,0
2064 Camellia,201709,70000,19882,-187857,-2.68,70000,0
2064 Camellia,201712,70000,28462,-176636,-2.52,70000,0
2064 Camellia,201803,70000,379,62079,0.89,70000,0
2064 Camellia,201806,70000,49567,25352,0.36,70000,0
2064 Camellia,201809,70000,51976,-134195,-1.92,70000,0
2064 Camellia,201812,70000,71246,-145064,-2.07,70000,0
2064 Camellia,201903,70000,-8601,36950,0.53,70000,0
2064 Camellia,201906,70000,-5481,99876,1.43,70000,0
2064 Camellia,201909,70000,-21634,301444,4.31,70000,0
2064 Camellia,201912,69982,-57678,416107,5.96,70000,135
2064 Camellia,202003,69342,-45060,-14691,-0.21,69630,670
2064 Camellia,202006,69336,-85448,88026,1.27,69630,485
2064 Camellia,202009,69334,-116566,110109,1.59,69630,423
2064 Camellia,202012,69333,-103503,114522,1.65,69630,392
2064 Camellia,202103,69330,17837,-161748,-2.33,69630,300
2064 Camellia,202106,69330,44475,-278140,-4.01,69630,300
2064 Camellia,202109,69330,96512,-219486,-3.17,69630,300
2064 Camellia,202112,69330,125641,-316842,-4.57,69630,300
2064 Camellia,202203,69330,39181,56983,0.82,69630,300
2064 Camellia,202206,69330,77624,26657,0.38,69630,300
2064 Camellia,202209,69330,106825,189094,2.73,69630,300
2064 Camellia,202212,69330,79195,445514,6.43,69630,300
2064 Camellia,202303,69330,-43996,128572,1.85,69630,300
2064 Camellia,202306,69330,-49361,216447,3.12,69630,300
2064 Camellia,202309,69330,-64807,317017,4.57,69630,300
2064 Camellia,202312,69330,-94298,312921,4.51,69630,300
2064 Camellia,202403,69330,-5033,31934,0.46,69630,300
2064 Camellia,202406,69330,4580,-45738,-0.66,69630,300
2064 Camellia,202409,69330,-11028,-31784,-0.46,69630,300
2064 Camellia,202412,69330,-12812,61030,0.88,69330,225
2064 Camellia,202503,69330,-15289,-18349,-0.26,69330,0
2064 Camellia,202506,69330,-94307,-75165,-1.08,69330,0
2064 Camellia,202509,69330,-104890,-121538,-1.75,69330,0
2064 Camellia,202512,69330,-89914,-21212,-0.31,69330,0
2064 Camellia,202603,69330,-175,-24232,-0.35,69330,0
2064 Camellia,202606,69330,-2708,-6855,-0.10,69330,0"

raw <- read_csv(data_text)

head(raw)
## # A tibble: 6 × 8
##   CO_ID       Date Weighted_AVE_CO Net_Income Cash_Flow_Oper Per_Share_CF Shares
##   <chr>      <dbl>           <dbl>      <dbl>          <dbl>        <dbl>  <dbl>
## 1 2064 Cam… 201112           61600     153843          94651         1.54  61600
## 2 2064 Cam… 201206           61600     -54886         191963         3.12  61600
## 3 2064 Cam… 201212           61600     -94564         337588         5.48  61600
## 4 2064 Cam… 201303           61600      34188         115123         1.87  61600
## 5 2064 Cam… 201306           61600      74411         110874         1.8   61600
## 6 2064 Cam… 201309           61600     102082         256590         4.17  61600
## # ℹ 1 more variable: Treasury_Stock_subsi <dbl>
str(raw)
## spc_tbl_ [57 × 8] (S3: spec_tbl_df/tbl_df/tbl/data.frame)
##  $ CO_ID               : chr [1:57] "2064 Camellia" "2064 Camellia" "2064 Camellia" "2064 Camellia" ...
##  $ Date                : num [1:57] 201112 201206 201212 201303 201306 ...
##  $ Weighted_AVE_CO     : num [1:57] 61600 61600 61600 61600 61600 61600 61600 61600 61600 61600 ...
##  $ Net_Income          : num [1:57] 153843 -54886 -94564 34188 74411 ...
##  $ Cash_Flow_Oper      : num [1:57] 94651 191963 337588 115123 110874 ...
##  $ Per_Share_CF        : num [1:57] 1.54 3.12 5.48 1.87 1.8 4.17 4.16 1.49 2.02 3.34 ...
##  $ Shares              : num [1:57] 61600 61600 61600 61600 61600 61600 61600 61600 61600 61600 ...
##  $ Treasury_Stock_subsi: num [1:57] 0 0 0 0 0 0 0 0 0 0 ...
##  - attr(*, "spec")=
##   .. cols(
##   ..   CO_ID = col_character(),
##   ..   Date = col_double(),
##   ..   Weighted_AVE_CO = col_double(),
##   ..   Net_Income = col_double(),
##   ..   Cash_Flow_Oper = col_double(),
##   ..   Per_Share_CF = col_double(),
##   ..   Shares = col_double(),
##   ..   Treasury_Stock_subsi = col_double()
##   .. )
##  - attr(*, "problems")=<externalptr>

3. Convert to time series

The Date column is coded as YYYYMM, with the month always being 03, 06, 09, or 12 — i.e. each row is a fiscal quarter end. We convert this into a proper quarter-end Date object, then build an xts time series.

raw <- raw %>%
  mutate(
    year  = as.integer(substr(as.character(Date), 1, 4)),
    month = as.integer(substr(as.character(Date), 5, 6)),
    # last day of that month = quarter-end date
    qdate = as.Date(as.yearmon(paste(year, month, sep = "-")), frac = 1)
  ) %>%
  arrange(qdate)

# Build the xts time series with the financial variables of interest
ts_data <- xts(
  raw[, c("Weighted_AVE_CO", "Net_Income", "Cash_Flow_Oper",
          "Per_Share_CF", "Shares", "Treasury_Stock_subsi")],
  order.by = raw$qdate
)

head(ts_data)
##            Weighted_AVE_CO Net_Income Cash_Flow_Oper Per_Share_CF Shares
## 2011-12-31           61600     153843          94651         1.54  61600
## 2012-06-30           61600     -54886         191963         3.12  61600
## 2012-12-31           61600     -94564         337588         5.48  61600
## 2013-03-31           61600      34188         115123         1.87  61600
## 2013-06-30           61600      74411         110874         1.80  61600
## 2013-09-30           61600     102082         256590         4.17  61600
##            Treasury_Stock_subsi
## 2011-12-31                    0
## 2012-06-30                    0
## 2012-12-31                    0
## 2013-03-31                    0
## 2013-06-30                    0
## 2013-09-30                    0
str(ts_data)
## An xts object on 2011-12-31 / 2026-06-30 containing: 
##   Data:    double [57, 6]
##   Columns: Weighted_AVE_CO, Net_Income, Cash_Flow_Oper, Per_Share_CF, Shares ... with 1 more column
##   Index:   Date [57] (TZ: "UTC")

4. Plot Net Income and Cash Flow from Operations

plot.zoo(
  ts_data[, c("Net_Income", "Cash_Flow_Oper")],
  main = "2064 Camellia — Net Income vs. Cash Flow from Operations",
  xlab = "Quarter", ylab = "NT$ thousand",
  col = c("steelblue", "firebrick"),
  plot.type = "single", lwd = 1.5
)
legend("topleft", legend = c("Net Income", "Cash Flow from Oper."),
       col = c("steelblue", "firebrick"), lty = 1, lwd = 1.5, bty = "n")
abline(h = 0, col = "grey60", lty = 2)

5. Plot Cash Flow per Share

plot.zoo(
  ts_data[, "Per_Share_CF"],
  main = "2064 Camellia — Cash Flow per Share",
  xlab = "Quarter", ylab = "NT$ per share",
  col = "darkgreen", lwd = 1.5
)
abline(h = 0, col = "grey60", lty = 2)

6. Save the time series object (optional, for reuse later)

saveRDS(ts_data, "camellia_timeseries.rds")

Publishing to RPubs

  1. Open this file in RStudio and click Knit (no external data file needed — everything is embedded above).
  2. In the Viewer pane showing the knitted output, click the Publish button (blue icon, top right).
  3. Choose RPubs, sign in / create a free account if needed, give it a title, and click Publish.
  4. Copy the RPubs URL and submit it to TronClass.