Powershell Variable Scope In Function In R