<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>Feng Jiang</title>
    <link>https://fengjiang.me/</link>
    <description>Recent content on Feng Jiang</description>
    <generator>Hugo</generator>
    <language>en-us</language>
    <lastBuildDate>Sun, 06 Dec 2020 00:00:00 +0000</lastBuildDate>
    <atom:link href="https://fengjiang.me/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>Async Task with Progress Reporting and Cancellation</title>
      <link>https://fengjiang.me/posts/async-task-with-progress-report-and-cancellation/</link>
      <pubDate>Sun, 06 Dec 2020 00:00:00 +0000</pubDate>
      <guid>https://fengjiang.me/posts/async-task-with-progress-report-and-cancellation/</guid>
      <description>&lt;p&gt;While building a WinForms application, I needed to run a calculation that could take a long time. I wanted the main form to stay responsive while a separate dialog showed progress and gave the user a cancel button.&lt;/p&gt;&#xA;&lt;p&gt;Progress reporting and cancellation are common questions, but many examples show only isolated snippets. This sample puts the pieces together in one small application, using &lt;code&gt;IProgress&amp;lt;T&amp;gt;&lt;/code&gt; for progress updates and &lt;code&gt;CancellationToken&lt;/code&gt; for cancellation.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Better Organization of R Markdown Outputs</title>
      <link>https://fengjiang.me/posts/better-organization-of-rmarkdown-outputs/</link>
      <pubDate>Thu, 19 Nov 2020 00:00:00 +0000</pubDate>
      <guid>https://fengjiang.me/posts/better-organization-of-rmarkdown-outputs/</guid>
      <description>&lt;p&gt;By default, the Knit button renders R Markdown output into the same folder as the source &lt;code&gt;.Rmd&lt;/code&gt; file. The R Markdown Cookbook &lt;a href=&#34;https://bookdown.org/yihui/rmarkdown-cookbook/custom-knit.html&#34;&gt;shows&lt;/a&gt; how to change that behavior by defining a custom knit function in the YAML front matter.&lt;/p&gt;&#xA;&lt;p&gt;Using that technique, you can keep generated notebooks and reports out of the folders that hold your source code.&lt;/p&gt;&#xA;&lt;p&gt;Suppose your project is organized with the following folder structure:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-text&#34; data-lang=&#34;text&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;Project\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; + Documents\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; + R Code\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   + Project.Rproj&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   + Include.R&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   + 1 Load\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     + 11 Load Student Data.Rmd&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     + 11 Load Student Data.nb.html&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     + 12 Load School Data.Rmd&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;     + 12 Load School Data.nb.html&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   + 2 Calculation\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;   + 3 Check\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; + R Data\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; + Raw Data\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt; + Results\&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;Because R Notebook and R Markdown outputs are saved next to the source files by default, the R code folder can become cluttered quickly. Reusing the same output filename also makes it harder to keep versions. A cleaner structure is to save dated outputs in a separate folder, like this:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Export R Data to SAS</title>
      <link>https://fengjiang.me/posts/export-r-data-to-sas/</link>
      <pubDate>Wed, 18 Nov 2020 00:00:00 +0000</pubDate>
      <guid>https://fengjiang.me/posts/export-r-data-to-sas/</guid>
      <description>&lt;h2 id=&#34;the-problem&#34;&gt;The Problem&lt;/h2&gt;&#xA;&lt;p&gt;Importing SAS data into R is straightforward: the &lt;code&gt;haven&lt;/code&gt; package provides &lt;code&gt;read_sas()&lt;/code&gt;, which reads &lt;code&gt;*.sas7bdat&lt;/code&gt; files into an R data frame. Going the other direction is harder. In my experience, &lt;code&gt;*.sas7bdat&lt;/code&gt; files created by &lt;code&gt;haven::write_sas()&lt;/code&gt; were not reliably readable in SAS.&lt;/p&gt;&#xA;&lt;p&gt;At first, it seems that a shared data format should solve the problem. R can export CSV files, and SAS can import them. Wouldn&amp;rsquo;t that be enough?&lt;/p&gt;</description>
    </item>
    <item>
      <title>Use CSVY Format for Data Storage</title>
      <link>https://fengjiang.me/posts/use-csvy-format-for-data-storage/</link>
      <pubDate>Wed, 18 Nov 2020 00:00:00 +0000</pubDate>
      <guid>https://fengjiang.me/posts/use-csvy-format-for-data-storage/</guid>
      <description>&lt;p&gt;I have used &lt;code&gt;fread()&lt;/code&gt; and &lt;code&gt;fwrite()&lt;/code&gt; from the &lt;code&gt;data.table&lt;/code&gt; package for years. Recently, I noticed that a change introduced in &lt;a href=&#34;https://rdatatable.gitlab.io/data.table/news/index.html#new-features-18&#34;&gt;version 1.11.0&lt;/a&gt; broke some old code. The change was:&lt;/p&gt;&#xA;&lt;blockquote&gt;&#xA;&lt;p&gt;Numeric data that has been quoted is now detected and read as numeric.&lt;/p&gt;&lt;/blockquote&gt;&#xA;&lt;p&gt;Quoted numbers used to be read as character values. Now, &lt;code&gt;data.table&lt;/code&gt; can read quoted numbers as numeric values even when they are quoted.&lt;/p&gt;&#xA;&lt;p&gt;The old code still runs, but the data no longer arrives in the expected form. For example, an ID column with values such as &amp;ldquo;0001, 0002, 0003, &amp;hellip;&amp;rdquo; may be read as &amp;ldquo;1, 2, 3, &amp;hellip;&amp;rdquo;. That does not trigger an immediate error. The failure appears later, when downstream code tries to treat the ID column as character data.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Run a SAS Script from R</title>
      <link>https://fengjiang.me/posts/run-sas-script-in-r/</link>
      <pubDate>Mon, 16 Nov 2020 00:00:00 +0000</pubDate>
      <guid>https://fengjiang.me/posts/run-sas-script-in-r/</guid>
      <description>&lt;p&gt;Unlike SAS, which can host an R session after the right setup, R cannot host a SAS session directly.&lt;/p&gt;&#xA;&lt;p&gt;R can, however, call operating-system commands with &lt;code&gt;system()&lt;/code&gt;. SAS can also run a &lt;code&gt;.sas&lt;/code&gt; script from the command line. Connecting these two sides together, an R script can launch SAS and run a &lt;code&gt;.sas&lt;/code&gt; script file.&lt;/p&gt;&#xA;&lt;p&gt;The command-line syntax for running a SAS script is:&lt;/p&gt;&#xA;&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-powershell&#34; data-lang=&#34;powershell&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;C:\Program Files\SASHome\SASFoundation\9.4\sas.exe&amp;#34;&lt;/span&gt; -SYSIN &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;path\to\example.sas&amp;#34;&lt;/span&gt;&#xA;&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;In R, call that command through &lt;code&gt;system()&lt;/code&gt;:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Run R Code in SAS</title>
      <link>https://fengjiang.me/posts/run-r-code-in-sas/</link>
      <pubDate>Sun, 15 Nov 2020 00:00:00 +0000</pubDate>
      <guid>https://fengjiang.me/posts/run-r-code-in-sas/</guid>
      <description>&lt;p&gt;SAS can run R code inside a SAS program, but only after R support is enabled. The setup has two parts: turn on R integration in SAS, and tell SAS where R is installed.&lt;/p&gt;&#xA;&lt;h2 id=&#34;set-up-r-support-in-sas&#34;&gt;Set Up R Support in SAS&lt;/h2&gt;&#xA;&lt;p&gt;First, launch SAS with R support enabled. You can do this in either of two ways:&lt;/p&gt;&#xA;&lt;ul&gt;&#xA;&lt;li&gt;Add &lt;code&gt;-RLANG&lt;/code&gt; to the SAS command line.&lt;/li&gt;&#xA;&lt;li&gt;Add &lt;code&gt;-RLANG&lt;/code&gt; to the end of the SAS configuration file, &lt;code&gt;sasv9.cfg&lt;/code&gt;.&lt;/li&gt;&#xA;&lt;/ul&gt;&#xA;&lt;p&gt;Second, tell SAS where to find R. You can do this in either of two ways:&lt;/p&gt;</description>
    </item>
    <item>
      <title>Education and Experience</title>
      <link>https://fengjiang.me/experience/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://fengjiang.me/experience/</guid>
      <description>&lt;h2&gt;Education&lt;/h2&gt;&#xA;&lt;div class=&#34;timeline-list&#34;&gt;&#xA;  &lt;article class=&#34;timeline-item&#34;&gt;&#xA;    &lt;p class=&#34;timeline-date&#34;&gt;2012&lt;/p&gt;&#xA;    &lt;div&gt;&#xA;      &lt;h3&gt;Ph.D., Curriculum and Instruction (Science Education)&lt;/h3&gt;&#xA;      &lt;p&gt;University of Arkansas, Fayetteville, AR.&lt;/p&gt;&#xA;    &lt;/div&gt;&#xA;  &lt;/article&gt;&#xA;  &lt;article class=&#34;timeline-item&#34;&gt;&#xA;    &lt;p class=&#34;timeline-date&#34;&gt;2006&lt;/p&gt;&#xA;    &lt;div&gt;&#xA;      &lt;h3&gt;M.Ed., Physics Education&lt;/h3&gt;&#xA;      &lt;p&gt;Capital Normal University, Beijing, China.&lt;/p&gt;&#xA;    &lt;/div&gt;&#xA;  &lt;/article&gt;&#xA;  &lt;article class=&#34;timeline-item&#34;&gt;&#xA;    &lt;p class=&#34;timeline-date&#34;&gt;1998&lt;/p&gt;&#xA;    &lt;div&gt;&#xA;      &lt;h3&gt;B.S., Physics Education&lt;/h3&gt;&#xA;      &lt;p&gt;Nanjing Normal University, Nanjing, China.&lt;/p&gt;&#xA;    &lt;/div&gt;&#xA;  &lt;/article&gt;&#xA;&lt;/div&gt;&#xA;&lt;h2&gt;Professional Experience&lt;/h2&gt;&#xA;&lt;div class=&#34;timeline-list&#34;&gt;&#xA;  &lt;article class=&#34;timeline-item&#34;&gt;&#xA;    &lt;p class=&#34;timeline-date&#34;&gt;2025-Present&lt;/p&gt;&#xA;    &lt;div&gt;&#xA;      &lt;h3&gt;Director&lt;/h3&gt;&#xA;      &lt;p&gt;Office of Innovation for Education, University of Arkansas.&lt;/p&gt;&#xA;    &lt;/div&gt;&#xA;  &lt;/article&gt;&#xA;  &lt;article class=&#34;timeline-item&#34;&gt;&#xA;    &lt;p class=&#34;timeline-date&#34;&gt;2022-2024&lt;/p&gt;&#xA;    &lt;div&gt;&#xA;      &lt;h3&gt;Assistant Director of Research and Planning&lt;/h3&gt;&#xA;      &lt;p&gt;Office of Innovation for Education, University of Arkansas.&lt;/p&gt;&#xA;    &lt;/div&gt;&#xA;  &lt;/article&gt;&#xA;  &lt;article class=&#34;timeline-item&#34;&gt;&#xA;    &lt;p class=&#34;timeline-date&#34;&gt;2016-2022&lt;/p&gt;&#xA;    &lt;div&gt;&#xA;      &lt;h3&gt;Research Associate&lt;/h3&gt;&#xA;      &lt;p&gt;Office of Innovation for Education, University of Arkansas.&lt;/p&gt;&#xA;    &lt;/div&gt;&#xA;  &lt;/article&gt;&#xA;  &lt;article class=&#34;timeline-item&#34;&gt;&#xA;    &lt;p class=&#34;timeline-date&#34;&gt;2014-2016&lt;/p&gt;&#xA;    &lt;div&gt;&#xA;      &lt;h3&gt;Research Assistant&lt;/h3&gt;&#xA;      &lt;p&gt;Office of Innovation for Education, University of Arkansas.&lt;/p&gt;</description>
    </item>
    <item>
      <title>Publications</title>
      <link>https://fengjiang.me/publications/</link>
      <pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate>
      <guid>https://fengjiang.me/publications/</guid>
      <description>&lt;ul class=&#34;publication-list&#34;&gt;&#xA;  &lt;li&gt;Lee, O., Llosa, L., Jiang, F., O&#39;Connor, C., &amp; Haas, A. (2016). &lt;a href=&#34;https://doi.org/10.1007/s10972-016-9487-y&#34;&gt;School resources in teaching science to diverse student groups: An intervention&#39;s effect on elementary teachers&#39; perceptions&lt;/a&gt;. &lt;i&gt;Journal of Science Teacher Education&lt;/i&gt;, 27(7), 769-794.&lt;/li&gt;&#xA;  &lt;li&gt;Llosa, L., Lee, O., Jiang, F., Haas, A., O&#39;Connor, C., Van Booven, C. (2016). &lt;a href=&#34;https://doi.org/10.1002/tea.21314&#34;&gt;Elementary teachers&#39; science knowledge and instructional practices: Impact of an intervention focused on English language learners&lt;/a&gt;. &lt;i&gt;Journal of Research in Science Teaching&lt;/i&gt;. 53(4), 579-597.&lt;/li&gt;&#xA;  &lt;li&gt;Llosa, L., Lee, O., Jiang, F., Haas, A., O&#39;Connor, C., Van Booven, C., &amp; Kieffer, M. J. (2016). &lt;a href=&#34;https://doi.org/10.3102%2F0002831216637348&#34;&gt;Impact of a large-scale science intervention focused on English language learners&lt;/a&gt;. &lt;i&gt;American Educational Research Journal&lt;/i&gt;. 53(2), 395-424.&lt;/li&gt;&#xA;  &lt;li&gt;Jiang, F. &amp; McComas, W. F. (2015). &lt;a href=&#34;https://doi.org/10.1080/09500693.2014.1000426&#34;&gt;The effects of inquiry teaching on student science achievement and attitudes using propensity score analysis of PISA data&lt;/a&gt;. &lt;i&gt;International Journal of Science Education&lt;/i&gt;. 37(3), 554-576.&lt;/li&gt;&#xA;  &lt;li&gt;Jiang, F. &amp; McComas, W. F. (2014). &lt;a href=&#34;https://doi.org/10.1007/s11191-014-9703-0&#34;&gt;Analysis of nature of science included in recent popular science writing using text mining techniques&lt;/a&gt;. &lt;i&gt;Science &amp; Education&lt;/i&gt;. 23(9), 1785-1809.&lt;/li&gt;&#xA;&lt;/ul&gt;</description>
    </item>
  </channel>
</rss>
