Site perso : Emmanuel Branlard

Loading my functions into the program

To load any source file the command is language=R, numbers=none, frame=none, breaklines=true, backgroundcolor= , keywordstyle= , showstringspaces=false, basicstyle=, numberstyle=, framexleftmargin=13mm, xleftmargin=12mm
\begin{lstlisting}
source(''C:/sources/program.r'')
\end{lstlisting}
All the functions in the file program.r, will be loaded in the workspace.

To automatically load all my scripts(files with extension ".r") when R starts, a loop like this will work: language=R, numbers=none, frame=none, breaklines=true, backgroundcolor= , keywordstyle= , showstringspaces=false, basicstyle=, numberstyle=, framexleftmargin=13mm, xleftmargin=12mm
\begin{lstlisting}
for(f in list.files(path=''C:/sources/'', pattern=''[.r]'')){source(f);}
\end{lstlisting}

You can add this line in the file " /.Rprofile" for linux users or "C:/programfiles/R/etc/Rprofile.site" for windows users for it to be executed automatically at each startup.








Emmanuel Branlard