<html xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" 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 11 (filtered medium)">
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PlaceName"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="PlaceType"/>
<o:SmartTagType namespaceuri="urn:schemas-microsoft-com:office:smarttags"
 name="place"/>
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>In a post for March 2006 David Bitner had a nifty SQL function
using plr for natural breaks.  I have successfully installed R and plr in
postgress and created the function in my database but when called with select
kmeans(array[1,1,1,1,4,3,5,6,45,3,5,7,8,6,4,3,2,1,32,6,7,5,6,7,8],4);  to
test it , it reports  ERROR:  environment variable R_HOME not defined<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>I have noticed that when I run R from the command line I get
the line ignoring the R_HOME variable.  When installing plr, I had
problems with the make file finding R.h.  R.h lives in
/usr/local/lib/R/include.  But when I looked at the plr makefile I noticed
it was concatenating an extra /include onto the path.  So I set R_HOME
using export R_HOME=/usr/local/lib/R (one directory up from the actual location
of R.h)  since running my sql call to the kmeans function I have changed
R_HOME back to the actual location of R.h.  No path setting for R_HOME
seems to allow me to call the kmeans function.  Each returns the same
R_HOME error. Does any body know where R_HOME is actually supposed to be set,e.g.
to  the R.h, the .so, the /bin?   And if anyone has had this
problem why R_HOME works for the plr install but not the actual execution of
the function kmeans?<o:p></o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'><o:p> </o:p></span></font></p>

<p class=MsoNormal><font size=2 face=Arial><span style='font-size:10.0pt;
font-family:Arial'>Jeff Cavner<o:p></o:p></span></font></p>

<p class=MsoNormal><st1:place w:st="on"><st1:PlaceName w:st="on"><font size=2
  face=Arial><span style='font-size:10.0pt;font-family:Arial'>Earth</span></font></st1:PlaceName><font
 size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'> <st1:PlaceName
 w:st="on">Data</st1:PlaceName> <st1:PlaceName w:st="on">Analysis</st1:PlaceName>
 <st1:PlaceType w:st="on">Center</st1:PlaceType></span></font></st1:place><font
size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal><st1:place w:st="on"><st1:PlaceType w:st="on"><font size=2
  face=Arial><span style='font-size:10.0pt;font-family:Arial'>University</span></font></st1:PlaceType><font
 size=2 face=Arial><span style='font-size:10.0pt;font-family:Arial'> of <st1:PlaceName
 w:st="on">New Mexico</st1:PlaceName></span></font></st1:place><font size=2
face=Arial><span style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>

</div>

</body>

</html>