<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic CAS does not support R library circlize in SAS/IML Software and Matrix Computations</title>
    <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940749#M6269</link>
    <description>&lt;P&gt;Hello, pals&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CAS does not support the R library circlize. Codes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
run ExportDataSetToR("WORK.chord_1", "RCBD_IN_R");
submit / R;
library(circlize)&lt;BR /&gt;values &amp;lt;- c(2, 0, 0, 3, 7, 1, 29, 1, 22, 15, 0, 3, 0, 0, 1, 1, 18, 0, 15, 5, 1, 15, 0, 10, 9)
matrix &amp;lt;- matrix(values, 5, 5) # a matrix with 5 rows and 5 columns
matrix2 &amp;lt;- t(matrix)
print(matrix)
print(matrix2)
rownames(matrix2) &amp;lt;- c("Day 4 Danger", "Day 4 Optimal", "Day 4 Over", "Day 4 Suboptimal", "Day 4 Under")
colnames(matrix2) &amp;lt;- c("Day 7 Danger", "Day 7 Optimal", "Day 7 Over", "Day 7 Suboptimal", "Day 7 Under")
colors &amp;lt;- c("Day 4 Danger" = "Red", "Day 4 Optimal" = "#008000", "Day 4 Over" = "Orange", "Day 4 Suboptimal" = "#318ce7", "Day 4 Under" = "Yellow", "Day 7 Danger" = "#ff033e", "Day 7 Optimal" = "#a4c639", "Day 7 Over" = "#ffbf00", "Day 7 Suboptimal" = "#5d8aa8", "Day 7 Under" = "#e9d66b")
chordDiagram(matrix2, grid.col = colors, transparency = 0.6);
endsubmit;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Logs:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;ERROR: R: Error in library(circlize) : there is no package called ‘circlize’&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Can we import the library in the SAS Viya CAS? Thanks.&lt;/P&gt;</description>
    <pubDate>Sun, 25 Aug 2024 05:22:19 GMT</pubDate>
    <dc:creator>TomHsiung</dc:creator>
    <dc:date>2024-08-25T05:22:19Z</dc:date>
    <item>
      <title>CAS does not support R library circlize</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940749#M6269</link>
      <description>&lt;P&gt;Hello, pals&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;CAS does not support the R library circlize. Codes:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
run ExportDataSetToR("WORK.chord_1", "RCBD_IN_R");
submit / R;
library(circlize)&lt;BR /&gt;values &amp;lt;- c(2, 0, 0, 3, 7, 1, 29, 1, 22, 15, 0, 3, 0, 0, 1, 1, 18, 0, 15, 5, 1, 15, 0, 10, 9)
matrix &amp;lt;- matrix(values, 5, 5) # a matrix with 5 rows and 5 columns
matrix2 &amp;lt;- t(matrix)
print(matrix)
print(matrix2)
rownames(matrix2) &amp;lt;- c("Day 4 Danger", "Day 4 Optimal", "Day 4 Over", "Day 4 Suboptimal", "Day 4 Under")
colnames(matrix2) &amp;lt;- c("Day 7 Danger", "Day 7 Optimal", "Day 7 Over", "Day 7 Suboptimal", "Day 7 Under")
colors &amp;lt;- c("Day 4 Danger" = "Red", "Day 4 Optimal" = "#008000", "Day 4 Over" = "Orange", "Day 4 Suboptimal" = "#318ce7", "Day 4 Under" = "Yellow", "Day 7 Danger" = "#ff033e", "Day 7 Optimal" = "#a4c639", "Day 7 Over" = "#ffbf00", "Day 7 Suboptimal" = "#5d8aa8", "Day 7 Under" = "#e9d66b")
chordDiagram(matrix2, grid.col = colors, transparency = 0.6);
endsubmit;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;Logs:&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;P&gt;ERROR: R: Error in library(circlize) : there is no package called ‘circlize’&lt;/P&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Can we import the library in the SAS Viya CAS? Thanks.&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2024 05:22:19 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940749#M6269</guid>
      <dc:creator>TomHsiung</dc:creator>
      <dc:date>2024-08-25T05:22:19Z</dc:date>
    </item>
    <item>
      <title>Re: CAS does not support R library circlize</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940768#M6270</link>
      <description>&lt;P&gt;if you use PROC IML in SAS Viya, then you are submitting on the compute server (aka SPRE = SAS Programming Runtime Environment), not on CAS.&lt;/P&gt;
&lt;P&gt;In PROC CAS, you can load and call the IML action set, but I believe the IML action set does not allow for a "submit / R" block.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Anyway , you get this ERROR.&lt;BR /&gt;&lt;FONT color="#FF0000"&gt;&lt;SPAN&gt;ERROR: R: Error in library(circlize) : there is no package called ‘circlize’&lt;/SPAN&gt;&lt;/FONT&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Essentially I believe that the reason why you cannot load a package like ‘circlize’, is that your R_Home environment variable is pointing to an old installation where the ‘circlize’-package is not installed. After you update your R_Home environment variable to your most recent version of R that includes ‘circlize’, please try loading the library again in PROC IML.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;By the way ... I am moving your question to the appropriate board (SAS/IML - board).&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Koen&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2024 13:14:44 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940768#M6270</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-08-25T13:14:44Z</dc:date>
    </item>
    <item>
      <title>Re: CAS does not support R library circlize</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940772#M6271</link>
      <description>Hi, Pal&lt;BR /&gt;&lt;BR /&gt;Many thanks.&lt;BR /&gt;&lt;BR /&gt;I access SAS Viya for learners and I believe I cannot modify the R_Home environment.</description>
      <pubDate>Sun, 25 Aug 2024 14:10:45 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940772#M6271</guid>
      <dc:creator>TomHsiung</dc:creator>
      <dc:date>2024-08-25T14:10:45Z</dc:date>
    </item>
    <item>
      <title>Re: CAS does not support R library circlize</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940774#M6272</link>
      <description>&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&lt;a href="https://communities.sas.com/t5/user/viewprofilepage/user-id/184847"&gt;@TomHsiung&lt;/a&gt;&amp;nbsp;wrote:&lt;BR /&gt;I access SAS Viya for learners and I believe I cannot modify the R_Home environment.&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Home &amp;gt; SAS Communities Library &amp;gt; &lt;BR /&gt;&lt;STRONG&gt;Which Open-Source Packages are included in SAS Viya for Learners?&lt;/STRONG&gt;&lt;BR /&gt;Last update: ‎03-23-2023&lt;BR /&gt;Updated by: SAS Employee Academic_Lori&lt;/P&gt;
&lt;P&gt;&lt;A href="https://communities.sas.com/t5/SAS-Communities-Library/Which-Open-Source-Packages-are-included-in-SAS-Viya-for-Learners/ta-p/862194" target="_blank"&gt;https://communities.sas.com/t5/SAS-Communities-Library/Which-Open-Source-Packages-are-included-in-SAS-Viya-for-Learners/ta-p/862194&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Koen&lt;/P&gt;</description>
      <pubDate>Sun, 25 Aug 2024 14:57:25 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940774#M6272</guid>
      <dc:creator>sbxkoenk</dc:creator>
      <dc:date>2024-08-25T14:57:25Z</dc:date>
    </item>
    <item>
      <title>Re: CAS does not support R library circlize</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940804#M6273</link>
      <description>&lt;P&gt;Thank you very much and it works. Although by default the package of circlize is not installed, I just built it up. Great!&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Regards,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Tom&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-08-26 at 12.55.45 PM.png" style="width: 999px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99617iF607C2F552BA17F3/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-08-26 at 12.55.45 PM.png" alt="Screenshot 2024-08-26 at 12.55.45 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 04:57:57 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940804#M6273</guid>
      <dc:creator>TomHsiung</dc:creator>
      <dc:date>2024-08-26T04:57:57Z</dc:date>
    </item>
    <item>
      <title>Re: CAS does not support R library circlize</title>
      <link>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940805#M6274</link>
      <description>&lt;P&gt;Update:&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;I can install and use the circlize library in JupyterLab R console. But when I tried to do the same in JupyterLab SAS console, I got errors.&lt;/P&gt;
&lt;BLOCKQUOTE&gt;
&lt;PRE&gt;&lt;SPAN class="ansi-green-fg"&gt;WARNING: R: Warning in install.packages("circlize") :&lt;/SPAN&gt;
&lt;SPAN class="ansi-green-fg"&gt;WARNING: R:   'lib = "/opt/sas/viya/home/sas-pyconfig/R-4.2.2.1717422377/lib64/R/library"' is not writable&lt;/SPAN&gt;
&lt;SPAN class="ansi-red-intense-fg ansi-bold"&gt;ERROR: R: Error in askYesNo(gettext("Would you like to use a personal library instead?"),  : &lt;/SPAN&gt;
&lt;SPAN class="ansi-red-intense-fg ansi-bold"&gt;ERROR: R:   Unrecognized response “library(circlize)”&lt;/SPAN&gt;&lt;/PRE&gt;
&lt;/BLOCKQUOTE&gt;
&lt;P&gt;Output from JupyterLab R console:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Screenshot 2024-08-26 at 1.22.12 PM.png" style="width: 580px;"&gt;&lt;img src="https://communities.sas.com/t5/image/serverpage/image-id/99618i59BA87E3F7EFA78F/image-size/large?v=v2&amp;amp;px=999" role="button" title="Screenshot 2024-08-26 at 1.22.12 PM.png" alt="Screenshot 2024-08-26 at 1.22.12 PM.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Codes in JupyterLab SAS console:&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-sas"&gt;proc iml;
submit / R;
Sys.setenv(R_LIBS_USER="/opt/conda/lib/R/library")
install.packages("circlize")
library(circlize)
# Input matrix
values &amp;lt;- c(
1,0,0,2,0,
1,0,1,1,0,
1,0,0,0,0,
1,0,0,0,0,
4,0,3,4,0,
7,2,4,10,0,
2,0,0,0,0,
1,0,1,1,1,
1,0,0,0,0,
7,0,10,15,0,
0,0,0,1,0,
1,0,0,0,0,
1,0,0,1,0,
4,0,1,6,0,
4,0,0,4,0,
1,0,0,1,0,
1,0,0,2,0,
0,0,0,1,0,
1,0,0,2,0,
11,1,36,33,6
)
matrix &amp;lt;- matrix(values, 5, 20)

# Labeling
rownames(matrix) &amp;lt;- c("Age 65 to 80", "Over 80", "Age 30 to 50", "Age 50 to 65", "Less than 30") # Label the row categories
colnames(matrix) &amp;lt;- c("Atrial fibrillation", "AF, DM", "AF, DM, HF", "AF, DM, HF, HTN", "AF, HF", "AF, HF, HTN", "AF, HF, Stroke", "AF, HTN",
                       "AF, HTN, Stroke", "AF, Stroke", "Diabetes", "DM, HF, HTN", "DM, HTN", "DM, HTN, Stroke", "Heart failure", "HF, HTN", "Hypertension",
                       "HTN, Stroke", "No comorbidity", "Stroke") # Label the column categories

# Define colors
colors &amp;lt;- c("Over 80" = "Red", "Age 50 to 65" = "#008000", "Age 30 to 50" = "Orange", "Age 65 to 80" = "#ffef00", "Less 30" = "#2a52be", "No comorbidity" = "black", "Atrial fibrillation" = "#ff0800", "Diabetes" = "#a52a2a", "Hypertension" = "#ffbcd9")

# Generate the chord diagram
# chordDiagram(matrix, transparency = 0.6, annotationTrack = c("axis", "grid")) # Make the chord diagram
circos.par(canvas.xlim = c(-0.80, 0.80), canvas.ylim = c(-0.80, 0.80))
chordDiagram(matrix, grid.col = colors, scale = FALSE, annotationTrack = c("grid", "axis"), 
             preAllocateTracks = list(track.height = max(strwidth(unlist(dimnames(matrix))))))
circos.track(track.index = 1, panel.fun = function(x, y) {
  circos.text(CELL_META$xcenter, CELL_META$ylim[1], CELL_META$sector.index, 
              facing = "clockwise", niceFacing = TRUE, adj = c(-0.30, 0), cex = 0.50)
}, bg.border = NA) # here set bg.border to NA is important
title(main = "Figure 1 Relationship between age categories and comorbidities", font.main = 1)
endsubmit;
quit;&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Aug 2024 05:26:09 GMT</pubDate>
      <guid>https://communities.sas.com/t5/SAS-IML-Software-and-Matrix/CAS-does-not-support-R-library-circlize/m-p/940805#M6274</guid>
      <dc:creator>TomHsiung</dc:creator>
      <dc:date>2024-08-26T05:26:09Z</dc:date>
    </item>
  </channel>
</rss>

