Skip to content

Commit

Permalink
Make base functionality available without open RProvider.base (fix
Browse files Browse the repository at this point in the history
…fslaborg#2)

I implemented this while doing other changes and forgot about it :-).
This is done simply by providing another "R" type, directly inside
the RProvider namespace with a copy of all "base" functions (if you
open both, you'll get the more recently opened one, which is fine as
they're the same).
  • Loading branch information
tpetricek committed Jan 14, 2015
1 parent a9e650c commit 473e2e0
Show file tree
Hide file tree
Showing 13 changed files with 14 additions and 25 deletions.
1 change: 0 additions & 1 deletion docs/content/Charts-QuickStart.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@ you can reference the required libraries and packages this way:
open System
open RDotNet
open RProvider
open RProvider.``base``
open RProvider.graphics

(**
Expand Down
1 change: 0 additions & 1 deletion docs/content/Statistics-QuickStart.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ you can reference the required libraries and packages this way:
open System
open RDotNet
open RProvider
open RProvider.``base``
open RProvider.graphics
open RProvider.stats

Expand Down
1 change: 0 additions & 1 deletion docs/content/mac-and-linux.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,6 @@ Now, type the following in the script file (with the correct R provider version)
#load "RProvider.fsx"

open RProvider
open RProvider.``base``
open RProvider.graphics
open RProvider.grDevices
open RProvider.datasets
Expand Down
3 changes: 1 addition & 2 deletions docs/content/passing-data.fsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
(*** hide ***)
#I "../../packages/FSharp.Data.2.0.7/lib/net40/"
#I "../../packages/FSharp.Data/lib/net40/"
#I "../../bin/"
#r "RDotNet.dll"
#r "RDotNet.FSharp.dll"
Expand All @@ -8,7 +8,6 @@
open System
open RDotNet
open RProvider
open RProvider.``base``

(**
# Passing Data Between F# and R
Expand Down
2 changes: 0 additions & 2 deletions docs/content/reading-rdata.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,6 @@ can use the standard R functions for saving the `*.rdata` files. The easiest
option is to call the `R.assign` function to define named values in the R environment
and then use `R.save` to save the environment to a file:
*)
open RProvider.``base``

// Calculate sum of square differences
let avg = sample.volcanoList |> Array.average
let sqrs =
Expand Down
4 changes: 1 addition & 3 deletions docs/content/tutorial.fsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
(*** hide ***)
// Include the right directories so that the documentation tool tips work
#nowarn "211" // Ignore warning that a search path does not exist on #I
#I "../../packages/FSharp.Data.2.0.7/lib/net40/"
#I "../../packages/FSharp.Data/lib/net40/"
#I "../../bin/"

(**
Expand All @@ -22,15 +22,13 @@ we use `open` to reference a number of packages including `stats`, `tseries` and

open RDotNet
open RProvider
open RProvider.``base``
open RProvider.graphics
open RProvider.stats
open RProvider.tseries
open RProvider.zoo

open System
open System.Net

(**
If either of the namespaces above are unrecognized, you need to install the package in R
using `install.packages("stats")`.
Expand Down
4 changes: 2 additions & 2 deletions src/Common/AssemblyInfo.fs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ open System.Reflection
[<assembly: AssemblyCompanyAttribute("BlueMountain Capital")>]
[<assembly: AssemblyProductAttribute("RProvider")>]
[<assembly: AssemblyDescriptionAttribute("An F# Type Provider providing strongly typed access to the R statistical package.")>]
[<assembly: AssemblyVersionAttribute("1.1.3")>]
[<assembly: AssemblyFileVersionAttribute("1.1.3")>]
[<assembly: AssemblyVersionAttribute("1.1.5")>]
[<assembly: AssemblyFileVersionAttribute("1.1.5")>]
do ()

2 changes: 1 addition & 1 deletion src/RProvider.DesignTime/RTypeBuilder.fs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module internal RTypeBuilder =
[ // Expose all available packages as namespaces
Logging.logf "generateTypes: getting packages"
let packages =
[ //yield "base", ns
[ yield "base", ns
for package in server.GetPackages() do yield package, ns + "." + package ]
for package, pns in packages do
let pty = ProvidedTypeDefinition(asm, pns, "R", Some(typeof<obj>))
Expand Down
3 changes: 1 addition & 2 deletions src/RProvider/Example.fsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
#r @"../../bin/RDotNet.dll"
#r @"../../bin/RProvider.dll"
#load @"../../bin/RProvider.fsx"

open RDotNet
open RProvider
open RProvider.``base``
open RProvider.graphics
open RProvider.stats
// If either of the namespaces below are unrecognized, you need to install the package in R
Expand Down
8 changes: 4 additions & 4 deletions src/RProvider/RProvider.fsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
#I "../packages/R.NET.Community.FSharp.0.1.9/lib/net40"
#I "../../packages/R.NET.Community.FSharp.0.1.9/lib/net40"
#I "../../../packages/R.NET.Community.FSharp.0.1.9/lib/net40"
#I "packages/RProvider.1.1.3-alpha/lib/net40"
#I "../packages/RProvider.1.1.3-alpha/lib/net40"
#I "../../packages/RProvider.1.1.3-alpha/lib/net40"
#I "../../../packages/RProvider.1.1.3-alpha/lib/net40"
#I "packages/RProvider.1.1.5-alpha/lib/net40"
#I "../packages/RProvider.1.1.5-alpha/lib/net40"
#I "../../packages/RProvider.1.1.5-alpha/lib/net40"
#I "../../../packages/RProvider.1.1.5-alpha/lib/net40"
// Without version number when referenced through Paket
#I "packages/R.NET.Community/lib/net40"
#I "../packages/R.NET.Community/net40"
Expand Down
8 changes: 4 additions & 4 deletions src/RWrapperGenerator/RWrapperGenerator.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,6 @@
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Content Include="..\..\paket-files\fsprojects\FSharp.TypeProviders.StarterPack\src\ProvidedTypes.fsi">
<Paket>True</Paket>
<Link>paket-files/ProvidedTypes.fsi</Link>
</Content>
<Reference Include="FSharp.Core, Version=$(TargetFSharpCoreVersion), Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a">
<Private>True</Private>
</Reference>
Expand All @@ -55,6 +51,10 @@
</ItemGroup>
<ItemGroup>
<None Include="App.config" />
<Content Include="..\..\paket-files\fsprojects\FSharp.TypeProviders.StarterPack\src\ProvidedTypes.fsi">
<Paket>True</Paket>
<Link>paket-files/ProvidedTypes.fsi</Link>
</Content>
<Compile Include="..\..\paket-files\fsprojects\FSharp.TypeProviders.StarterPack\src\ProvidedTypes.fs">
<Paket>True</Paket>
<Link>paket-files/ProvidedTypes.fs</Link>
Expand Down
1 change: 0 additions & 1 deletion tests/Test.RProvider/RData.Tests.fs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ module Test.RData
open Xunit
open System
open RProvider
open RProvider.``base``

type Sample = RData<"data/sample.rdata">

Expand Down
1 change: 0 additions & 1 deletion tests/Test.RProvider/Test.fs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ open RDotNet
open RDotNet.Internals
open RProvider
open RProvider.RInterop
open RProvider.``base``
open System
open Xunit
open FsCheck
Expand Down

0 comments on commit 473e2e0

Please sign in to comment.