Defining a function changes the scope, where $r won't be inside that function. Try sending in $r with the function in this manner:
<?php
function r($r) {
echo ( $r );
}
?>
<link type="text/css" rel="stylesheet" href="<?php r($r); ?>rs/css/master.css">
or defining global $r; at the beginning of the function (not preferred).
Also, you shouldn't use <? to open PHP. If all the function does is echo the value of $r, it would make more sense to just do this:
<link type="text/css" rel="stylesheet" href="<?php echo ( $r ); ?>rs/css/master.css">