64 Matching Annotations
  1. Nov 2024
    1. as.character

      if you use lubridate's parsing function, you don't have to worry about it. But if you use R's basic as.Date parsing function, you need to make sure the source is a character.

    2. yyyymmdd

      original date like 20210321.

      For others, such as "2021-03-21", you can say it is in "yyyy-mm-dd" format.

    3. select(1:4)

      select the first four variables

  2. Oct 2024
    1. aes(x = Year, y = Counts, color = `細分`))

      mapping 資料 成為 美學的表現

      其中 color為"線"的顏色,若geometry有填色可能的話,填色的美學為fill.

    2. Bar Chart

      geom_bar

    3. Column Chart

      geom_col

    4. Area Chart

      geom_area

    5. labs

      labs = labels<br /> 經濟學人習慣會有

      subtitle = "..." 用來說明Y軸的單位,

      caption = "..." 用來說明資料的出處。

  3. Oct 2023
    1. One advantage of teaching R to understand your data collection as a data frame is that you have one more retrieval operator to use [.row, .col]
  4. Jun 2023
    1. tar_target(file, "data.csv", format = "file"),

      Don't start with tar_target(data, get_data("data.csv"))

      • change of data.csv won't trigger rerun, because "data.csv" is not hashed.
  5. May 2023
  6. Mar 2023
    1. plunged, too. Credit Suisse, which faces other woes, saw its stock fall by 24% on March 15th and on March 16th it sought liquidity support from the Swiss ce

      test

  7. Sep 2022
  8. Mar 2022
  9. May 2020
    1. # 先將類別資料設定成可排序類別資料 list_victimAges_female$年齡層 <- ordered(list_victimAges_female$年齡層)

      [05-02] 新增

  10. Aug 2019
    1. Another problem is that any law can require Mr Johnson only to ask for an extension. He might do so on terms that allow him to refuse any offer from the EU, though Brussels is keen to avoid any blame for a no-deal Brexit.
    2. Even if a similar bill passes the Commons in a single day, as then, it is hard to break a filibuster in the Lords, where the timetable for debate is less easily curtailed.
    3. The plan is to ask Mr Bercow for an emergency debate under standing order 24 and use this to follow the precedent of the Cooper-Letwin bill that was passed in March. Back then, MPs took control of the Commons agenda for a day to bring in this bill, which required the prime minister to request an extension of the original Brexit deadline of March 29th.
    4. Many concede that no-deal Brexiteers are better organised and more ruthless than their opponents.
    5. Any talks would be on a different legal basis from Article 50, which governs the current negotiations, requiring a fresh negotiating mandate, the unanimous approval of EU governments and ratification by national and regional parliaments.
    6. Manufacturers fret about the effect on just-in-time supply chains of tariffs and non-tariff barriers. Farmers and fishers are worried about duties on sheep, beef and fish exports. Service businesses and the NHS talk of recruitment problems.
    7. The government’s leaked “Operation Yellowhammer” analysis talks of possible shortages of fresh food, medicine and petrol, disruption to ports and the risk of civil unrest, especially in Northern Ireland
    1. The correct way to swap column values is by using raw values:

      把右側改成非data frame即不會產生index alignment作用

    2. df.loc[:, ['B', 'A']] = df[['A', 'B']]

      .loc會以axis 2先進行=兩側的index alignment之後才做value assignment

    1. July 31st Mr Powell announced America’s first interest-rate cut in over a decade,
    2. there are limits to how much the Fed can depart from the global trend before it starts causing problems in capital markets.
    3. A strengthening dollar, wobbling equity markets or tightening credit conditions could then bounce the Fed into a further burst of loosening.
    4. The Trump administration’s trade policy, not the cost of capital, is holding businesses back, she thinks.
    5. A further cut would not be universally welcome.
    6. Finally, as Mr Powell emphasised on July 31st, inflation is uncomfortably weak. On a measure that excludes volatile food and energy prices, it sagged to 1.6% in June, well below the Fed’s 2% target.
    7. But businesses do not appear to share consumers’ confidence.
    8. On July 22nd politicians agreed on a deal to raise America’s debt limit, and to avoid steep spending cuts.
    9. After dipping a little, earlier in the year, consumer confidence is almost back to its post-recovery peak.
    10. The move was widely expected, though not universally understood.
  11. Jul 2019
    1. the world needs to create a system of laws to govern the heavens—both in peacetime and, should it come to that, in war.
    1. 據家總設計的「長期照顧安排假」,每位勞工在失能、失智家人核定列入長期照顧人口的期間,最長可申請180天,前30日給予處理最忙亂的照顧安排,並由就業保險來補助六成的投保薪資,比照「育嬰留職停薪津貼」的作法,至少在前30日給付「長期照顧安排留職停薪津貼」;其餘150日為彈性請假,允許半天或一天的彈性請假,以因應臨時性的照顧。
    1. By Product

      if your header is in other non-western language, you need to set id tag. For example:

      第二節

      should be

      第二節{#section2}

      This is because tab's hyperlink can not take Chinese characters, you have to specify its non-Chinese link name yourself.

    1. For the edge operations, a directed graph must specify an edge using the edge operator -> while an undirected graph must use the -- operator.
    2. The graph statement (graph_stmt), the node statement (node_stmt), and the edge statement (edge_stmt) are the three most commonly used statements
    3. strict. This forbids the creation of multi-edges (i.e., there can be at most one edge with a given tail node and head node in the directed case).
    4. a directed graph (digraph) or an undirected graph (graph)
    1. A trade truce ought to cool the war of words over exchange rates, too—but not for long. Interest rates are low. The use of fiscal policy is constrained by either politics or debt burdens. A cheaper currency is one of the few ways left to gin up an economy. A world of sluggish GDP growth is one that is primed for a currency war.
  12. Jun 2019
    1. The Tory selectocrats who will choose Britain’s next prime minister would, polling suggests, prefer a no-deal Brexit over staying in the EU by three to one; the electorate as a whole swings three to two the other way.
    2. The Brexit referendum weakened the parties; the parties, for their part, have weakened Parliament.
    3. on the back of the Fixed-term Parliaments Act of 2011. Before this a prime minister whose flagship legislation was voted down—just once, never mind repeatedly—would have been expected to call an election. If he or she had not, a vote of confidence would have followed which a minority government would have been near certain to lose.
    4. The decision to resort to a referendum that produced a result capable of many interpretations cannot take the whole blame for the current chaos.
    5. Parliament could thus do what it wanted, including overturning what previous parliaments had thought good. This vision offered little scope for referendums.
    6. Mr Blair’s government also used Europe to provide constitutional protections. Should Britain leave the EU, the Charter of Fundamental Rights, which allows judges to poke their noses into any legislation that touches EU competencies, will no longer apply. Thus Britain is shifting back from a protected constitution, in which rights are guaranteed by a judiciary, to an unprotected one where they are at the mercy of Parliament
    7. Attempts to leave the EU show up constitutional shortcomings in part because membership helped to hide them.
    8. Mr Blair and Mr Cameron, by contrast, came to power when history was said to have come to an end. They saw no need to take particular care of the constitution. The constitution was just another archaic part of public life to modernise according to the dehistoricised dictates of the age—or to mess with for short-term advantage.
    9. In the 19th century Britons watched countries such as France and the United States tear themselves apart. In the first part of the 20th century, they saw the rise of totalitarianism. They recognised that the delicate British constitution had to be taken seriously
  13. May 2019
    1. ymd_hms(allCommitDates) -> allCommitDates with_tz(allCommitDates, tzone="Asia/Taipei") -> allCommitDatesTW

      常看見另一種寫法,在這題的allCommitDates字串寫法下兩種寫法都會對,但一換寫法,只有老師這裡的答案會保持正確。

      同學的另一種"視狀況才會對"的作法(不建議的作法)是:

      ymd_hms(allCommitDates,tz="Asia/Taipei) -> allCommitDatesTW
      

      同學試試看, 以下兩個相同UTC時間,只有老師的參考答案會永遠給出正確答案:

      allCommitDates1 <- "2019-04-17T16:38:56Z"
      allCommitDates2 <- "2019-04-17T16:38:56"
      

      結論是: ymd_hms裡的tz指的是你給它的字串是來自什麼時區。 with_tz裡的tzone指的是你要它顯示出什麼時區時間。

      ymd_hms裡的input字串本身若帶有"時間字串來自時區(如Z表示UTC時區)"訊息時以字串時區為主; 若與tz設定有衝突(即同學的第二種寫法),以字串時區為主,tz設定功能變成轉換顯示時區用。