fslaborg / RProvider

Access R packages from F#
http://fslab.org/RProvider/
Other
235 stars 69 forks source link

Cannot use the lsr package #265

Closed munik closed 10 months ago

munik commented 10 months ago

Describe the bug There's an lsr package which allows the computation of Cohen's d. However, due to lsr being a reserved keyword, I can't open RProvider.lsr. If I ignore the warning with #nowarn "62" the warning about it being a reserved keyword goes away, but then I still get FS0010 "Unexpected infix operator in open declaration"

To Reproduce Steps to reproduce the behavior:

  1. Reference the lsr package with open RProvider.lsr. You'll get a warning and an error:
    • Warning FS0062 This construct is for ML compatibility. In previous versions of F# 'lsr' was a reserved keyword but the use of this keyword is now deprecated. You can disable this warning by using '--mlcompatibility' or '--nowarn:62'.
    • Error FS0010 "Unexpected infix operator in open declaration"
  2. Add #nowarn "62" at the top of the file. FS0062 but you still get FS0010 and the project will not compile.

Expected behavior I should somehow be able to reference the lsr package.

Environment (please complete the following information):

nhirschey commented 10 months ago

Try putting two back ticks " ` " around the package name.

#r "nuget: RProvider"

open RProvider

// For interactive printing
fsi.AddPrinter FSIPrinters.rValue

// To fix a problem tracked in R.NET https://github.com/rdotnet/rdotnet/issues/151
R.eval(R.parse(text="""Sys.setenv(PATH = paste("C:/Program Files/R/R-4.3.1/bin/x64", Sys.getenv("PATH"), sep=";"))"""))

open RProvider.``lsr``

R.aad([1.0; 3.0; 6.0])

// val it: RDotNet.SymbolicExpression = [1] 1.777778
munik commented 10 months ago

@nhirschey Oh, duh. Thank you! That worked