differential 0.1.2.0 → 0.1.2.1
raw patch · 2 files changed
+7/−4 lines, 2 files
Files
- differential.cabal +1/−1
- src/Plot.hs +6/−3
differential.cabal view
@@ -1,5 +1,5 @@ name: differential-version: 0.1.2.0+version: 0.1.2.1 synopsis: Finds out whether an entity comes from different distributions (statuses). description: Uses statistical tests to find whether an entity comes from one or two distributions. homepage: http://github.com/GregorySchwartz/differential#readme
src/Plot.hs view
@@ -18,6 +18,7 @@ -- Cabal import qualified Data.Aeson as A import qualified Data.ByteString.Lazy.Char8 as B+import qualified Data.Text as T import Language.R.QQ (r) import qualified Foreign.R.Internal as R@@ -55,8 +56,10 @@ -- entry is the plot and the second entry is a data frame of the values. plotSingleDiff :: Bool -> [Entity] -> R.R s (R.SomeSEXP s) plotSingleDiff normalizeBool vals = do- let jsonR = B.unpack $ A.encode vals- normalize = if normalizeBool then 1 else 0 :: Double+ let normalize = if normalizeBool then 1 else 0 :: Double+ names = fmap (T.unpack . unName . _name) vals+ statuses = fmap (T.unpack . unStatus . _status) vals+ values = fmap _value vals [r| suppressMessages(library(ggplot2)) suppressMessages(library(plyr))@@ -64,7 +67,7 @@ suppressMessages(library(jsonlite)) suppressMessages(library(RColorBrewer)) - df = fromJSON(jsonR_hs)+ df = data.frame(name = names_hs, value = values_hs, status = statuses_hs) if(normalize_hs) { df = ddply(df, "name", transform, value = value / max(value))