<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Word 14 (filtered medium)">
<!--[if !mso]><style>v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style><![endif]--><style><!--
/* Font Definitions */
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Calibri","sans-serif";
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:3.0cm 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="EN-NZ" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal"><span style="color:#1F497D">Hello all,<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Like many things in R there are a number of ways to get a package loaded at the start of a session.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">If there was more than one package to get loaded, then creation of an .Rprofile file is the way to go. A much quicker way (good for one package) would be to open the R session in the working directory you want
 to use.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Then type the single line:<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">.First=function(){library(BrailleR)}<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Which will establish a function that will get processed when R is opened in this directory next time. It will overwrite an existing .First function if it had already been created. Note that you will not see the
 .First object when you use ls() because it is a hidden function. You will need to save the workspace on exit to ensure this command takes effect next time you start R in that directory.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">The creation of the profile is actually already included in BrailleR in the function MakeRprofile(). I have just added the additional line that ensures all the default packages are loaded to this function, but
 this was happening successfully without the line on my machine already. (Thanks for the suggestion.)<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Note: I recommend that you do not add the loading of BrailleR to a site wide Rprofile as problems can arise with package maintenance started in directories that have add-on packages loaded.<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D">Jonathan<o:p></o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<p class="MsoNormal"><span style="color:#1F497D"><o:p> </o:p></span></p>
<div>
<div style="border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm">
<p class="MsoNormal"><b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif"">From:</span></b><span lang="EN-US" style="font-size:10.0pt;font-family:"Tahoma","sans-serif""> BlindRUG [mailto:blindrug-bounces@nfbnet.org]
<b>On Behalf Of </b>JooYoung Seo via BlindRUG<br>
<b>Sent:</b> Friday, 4 December 2015 8:20 a.m.<br>
<b>To:</b> 'Blind R Users Group'<br>
<b>Cc:</b> JooYoung Seo<br>
<b>Subject:</b> [BlindRUG] Simple tip for automatic loading package<o:p></o:p></span></p>
</div>
</div>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-US">  Hi all,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  I am sharing simple tip you can use for loading any library or function automatically when starting up R.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  Some of you might face errors if you just tried to add code lines into .Rprofile (in your working directory) or /home/ect/Rprofile.site.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  Since all default packages should be loaded before your personalized setting, you need to call .First.sys() function before desired libraries.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  The following example is what you might want to do to get R to automatically load BrailleR package when starting the program:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">#             # I will explain it for Window users, but other OS users also can apply it.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">##1. Launch Notepad and type the below:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">.First.sys() # this is what you need for loading all needed default packages before your script.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">library(BrailleR) # loading BrailleR package<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"># You can add any other library or script as much as you want below.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">##2. Save it to your working directory. Select "save as file type" as "all files *". And filename must be ".Rprofile" without quotes.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  I hope it would be helpful.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  Thanks.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  Sincerely,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">       JooYoung<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">       JooYoung Seo<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">--------------------<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  Graduate Student,<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  Learning, Design, and Technology<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  Learning and Performance Systems<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  The Pennsylvania State University<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  Phone: +1 (814) 777-5836<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US">  E-mail: <a href="mailto:jzs323@psu.edu">
jzs323@psu.edu</a><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-US"><o:p> </o:p></span></p>
<p class="MsoNormal" style="margin-bottom:12.0pt"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif""><o:p> </o:p></span></p>
<div class="MsoNormal" align="center" style="text-align:center"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif"">
<hr size="1" width="99%" noshade="" style="color:#909090" align="center">
</span></div>
<table class="MsoNormalTable" border="0" cellspacing="0" cellpadding="0" style="border-collapse:collapse">
<tbody>
<tr>
<td style="padding:0cm 11.25pt 0cm 6.0pt">
<p class="MsoNormal"><span style="font-size:12.0pt;font-family:"Times New Roman","serif""><a href="https://www.avast.com/antivirus"><span style="text-decoration:none"><img border="0" id="_x0000_i1026" src="http://static.avast.com/emails/avast-mail-stamp.png" alt="Avast logo"></span></a><o:p></o:p></span></p>
</td>
<td style="padding:.75pt .75pt .75pt .75pt">
<p><span style="font-family:"Calibri","sans-serif";color:#3D4D5A">This email has been checked for viruses by Avast antivirus software.
<br>
<a href="https://www.avast.com/antivirus">www.avast.com</a> <o:p></o:p></span></p>
</td>
</tr>
</tbody>
</table>
<p class="MsoNormal"><span lang="EN-US" style="font-size:12.0pt;font-family:"Times New Roman","serif""><o:p> </o:p></span></p>
</div>
</body>
</html>