PowerShell Remoting Project Home

Monday, January 09, 2006

Bring Statistical Analysis Power to MSH: Hosting R Environment

Quote from /\/\o\/\/ blog entry Hosting Iron python in MSH: "Nice thing about Monad that it's easy to host other Languages inline." Well, since /\/\o\/\/ did VB.net, Monad team blog did C# and those japanese guy did python. I would like to something a biologist should do: Hosting R Environment in MSH.

R is an integrated suite of software facilities for data manipulation, calculation and graphical display. It consists of a language plus a run-time environment with graphics, a debugger, access to certain system functions, and the ability to run programs stored in script files. R language is an interpreted computer language derived from S language. Scientist use R mostly as a statistical analysis tool. You can download a copy of R from R-project home page (under GNU license).

My last project involve R is a gene expression profile analysis from microarray experiment two years ago. If you were a computer geek, it will take you less than 30min to learn to use R environment because it is object-oriented and synax similar to C.

Monad can can interact with other program using COM-based technologies. For example:
1. From /\/\o\/\/ blog: Monad Really Does Rock
2. From Monad team blog: Check spelling script

In order to use R language interpreter in MSH, we need another R addon: R-DCOM, which works with Rproxy.dll (in the R distribution) and R.dll to support transfer of data to and from R and remote execution of R commands, as well as embedding of an R graphics window.

After insatll R and r-DCOM, we can enjoy the power of R under MSH prompt:

# Create a new com object for R
$RCom = new-object -com StatConnectorSrv.StatConnector

# Call Init method to load R environment

# Check out available methods
$Rcom |gm

TypeName: System.__ComObject#{18c8b660-81a2-11d3-9254-00e09812f727}

Name MemberType Definition
---- ---------- ----------
AddGraphicsDevice Method void AddGraphicsDevice (string, ISGFX)
Close Method void Close ()
Evaluate Method Variant Evaluate (string)
EvaluateNoReturn Method void EvaluateNoReturn (string)
GetConnectorInformation Method string GetConnectorInformation (Informa...
GetErrorId Method int GetErrorId ()
GetErrorText Method string GetErrorText ()
GetInterpreterInformation Method string GetInterpreterInformation (Infor...
GetServerInformation Method string GetServerInformation (Informatio...
GetSupportedTypes Method void GetSupportedTypes (int)
GetSymbol Method Variant GetSymbol (string)
Init Method void Init (string)
RemoveGraphicsDevice Method void RemoveGraphicsDevice (string)
SetCharacterOutputDevice Method void SetCharacterOutputDevice (IStatCon...
SetErrorDevice Method void SetErrorDevice (IStatConnectorChar...
SetSymbol Method void SetSymbol (string, Variant)
SetTracingDevice Method void SetTracingDevice (IStatConnectorCh...
SetUserInterfaceAgent Method void SetUserInterfaceAgent (IStatConnec...

# Send expression to R interpreter
# where c() is a function to assign a "vector" Variant to x
# remember R language is case senitive
$Rcom.EvaluateNoReturn ("x <- c(79.98, 80.04, 80.02, 80.04, 80.03, 80.03, 80.04, 79.97, 80.05, 80.03, 80.02, 80.00, 80.02)")
$Rcom.EvaluateNoReturn ("y <-c(80.02, 79.94, 79.98, 79.97, 79.97, 80.03, 79.95, 79.97)")

# use R graphic device to make boxplot
$Rcom.EvaluateNoReturn ("boxplot(x, y)")

# Student t test: two variant; two sided; unpaired
$Rcom.Evaluate("t.test(x, y, alternative = c(`"two.sided`"))")

3.24986738055522 #t
12.0271084945182 #delta-f
0.00693932661444795 #P-value (if less than 0.05, means statitical significant)
0.0138552637266242 #lower 95 percent confidence interval
80.0207692307692 #average of x
0 #alternative hypothesis: true difference in means is not equal to 0
Welch Two Sample t-test
x and y
# Dispose R Environment

Have fun!

[Edit: Monad has now been renamed to Windows PowerShell. This script or discussion may require slight adjustments before it applies directly to newer builds.]


Oes Tsetnoc one of the ways in which we can learn seo besides Mengembalikan Jati Diri Bangsa. By participating in the Oes Tsetnoc or Mengembalikan Jati Diri Bangsa we can improve our seo skills. To find more information about Oest Tsetnoc please visit my Oes Tsetnoc pages. And to find more information about Mengembalikan Jati Diri Bangsa please visit my Mengembalikan Jati Diri Bangsa pages. Thank you So much.
Oes Tsetnoc | Semangat Mengembalikan Jati Diri Bangsa
Fine its the good information!!!
I used this site http://www.xnynz.com/ for doing hosting services & got nice solution.
They are very much good in providing services !!
This site provide the hosting services at cheap cost than other hosting company..
Have a good start !!!

Post a Comment

Links to this post:

Create a Link

<< Home