[R] Extract Element of String with R's Regex

2008-07-31 Thread Edward Wijaya
Hi, I have this string, in which I want to extract some of it's element: > x <- "Best-K Gene 11340 211952_at RANBP5 Noc= 3 - 2 LL= -963.669 -965.35" yielding this array [1] "211952_at" "RANBP5" "2" In Perl we would do it this way: __BEGIN__ my @needed =(); my $str = "Best-K Gene 11340 21

[R] Accessing Max/Min Value of Density Function

2008-06-16 Thread Edward Wijaya
Dear all, Currently I have the following output > mydensity <- density(x) > print(mydensity) x y Min. : -92.14 Min. :0.000e+00 1st Qu.: 356.66 1st Qu.:5.530e-09 Median : 805.45 Median :4.681e-05 Mean : 805.45 Mean :5.564e-04 3rd Qu.:1254.24 3rd Qu.:3

[R] Computing P-Value

2008-05-28 Thread Edward Wijaya
Hi, Is there an R function or package that computes p-value? -GV __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minim

[R] Joining Histograms Into a Figure

2008-05-25 Thread Edward Wijaya
Hi, I have two histograms created separately using the following code. It creates two separate figures. dat <- read.table(file="GDS1096.modelout", head = FALSE ) __BEGIN__ dat <- read.table(file="GDS1096.modelout", head = FALSE ) hist(dat$V2, main="AIC Freq", xlab = "\# Component", breaks = 36,

[R] Est. Component Size with AIC/BIC under Gamma Distribution

2008-05-22 Thread Edward Wijaya
Dear all, I am trying to model number of samples from a given series. The series are modelled according Gamma function. In order to estimate the # samples, I use BIC/AIC with MLE (computed from dgamma function). Here is the code I have. __BEGIN__ mlogl <- function( x_func, theta_func, samp) {

[R] How to import package into R script

2008-05-22 Thread Edward Wijaya
Hi all, What's the construct to import a built-in package (e.g. ARIMA) into the R script. I can't seem to find them in the documentation. Regards, Edward __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read

Re: [R] About Passing Arguments to Function

2008-05-22 Thread Edward Wijaya
f you have > johnson and kotz, it's definitely in there. if i had it here, i would just > tell you what it was. > > > > > > > > On Thu, May 22, 2008 at 9:36 PM, Charilaos Skiadas wrote: > >> On May 22, 2008, at 9:14 PM, Edward Wijaya wrote: >> >&

[R] About Passing Arguments to Function

2008-05-22 Thread Edward Wijaya
Hi, Below I have a function mlogl_k, later it's called with "nlm" . __BEGIN__ vsamples<- c(14.7, 18.8, 14, 15.9, 9.7, 12.8) mlogl_k <- function( k_func, x_func, theta_func, samp) { tot_mll <- 0 for (comp in 1:k_func) { curr_mll <- (- sum(dgamma(samp, shape = x_func, scale=theta_

Re: [R] Computing Maximum Loglikelihood With "nlm" Problem

2008-05-21 Thread Edward Wijaya
gument names in mlogl. > > Haris Skiadas > Department of Mathematics and Computer Science > Hanover College > > On May 21, 2008, at 10:05 PM, Edward Wijaya wrote: > >> Hi, >> >> I tried to compute maximum likelihood under gamma distribution, >> using nlm f

[R] Computing Maximum Loglikelihood With "nlm" Problem

2008-05-21 Thread Edward Wijaya
Hi, I tried to compute maximum likelihood under gamma distribution, using nlm function. The code is this: __BEGIN__ vsamples<- c(103.9, 88.5, 242.9, 206.6, 175.7, 164.4) mlogl <- function(alpha, x) { if (length(alpha) > 1) stop("alpha must be scalar") if (alpha <= 0) stop("alpha must be

Re: [R] automation of R? running an R script at a certain time each night?

2008-05-21 Thread Edward Wijaya
You might try cron job under Windows. http://drupal.org/node/31506 HTH. - Edward On Thu, May 22, 2008 at 8:51 AM, Thomas Pujol <[EMAIL PROTECTED]> wrote: > I am using R in a Windows environment. > > I store my data in a Microsoft SQL database that gets updated automatically > nightly. Once my

Re: [R] Converting Data Types

2008-05-20 Thread Edward Wijaya
og = TRUE) >> llgm >V1 V2 V3 V4 V5 V6 > -99.25657 -84.01700 -237.40735 -201.26922 -170.53122 -159.29770 > > HTH .... > > Peter Alspach > > >> -Original Message- >> From: [EMAIL PROTECTED] >> [

Re: [R] Converting Data Types

2008-05-20 Thread Edward Wijaya
, 2008 at 11:22 AM, <[EMAIL PROTECTED]> wrote: > unclass or should work , I think. so > > nonames<-unclass(samples) > > > > On Tue, May 20, 2008 at 10:16 PM, Edward Wijaya wrote: > >> Hi, >> >> How can I convert the matrices to list. >&g

[R] Converting Data Types

2008-05-20 Thread Edward Wijaya
Hi, How can I convert the matrices to list. For example I have this snippet: samples<-mymatrix[1,] print(samples) which prints: V1 V2V3V4V5V6 1 103.9 88.5 242.9 206.6 175.7 164.4 How can I convert the object "samples" such that it prints: [1] 103.9 88.5 242.9 206.6 175

Re: [R] Log likelihood of Gamma distributions

2008-05-20 Thread Edward Wijaya
alue? Hope to hear from you again. Regards, Edward > > Edward Wijaya 写道: >> >> Dear all, >> >> How can I compute the log likelihood of a gamma >> distributions of a vector. >> >> I tried the following. But it doesn't seem to work: >> >

[R] Log likelihood of Gamma distributions

2008-05-20 Thread Edward Wijaya
Dear all, How can I compute the log likelihood of a gamma distributions of a vector. I tried the following. But it doesn't seem to work: samples<-c(6.1, 2.2, 14.9, 9.9, 24.6, 13.2) llgm <- dgamma(samples, scale=1, shape=2, log = TRUE) It gives [1] -4.291711 -1.411543 -12.198639 -7.607465 -2

[R] Printing output in STDOUT

2008-05-20 Thread Edward Wijaya
Hi, Currently the R script I have is executed with this command: $ R CMD BATCH mycode.R And the output is stored in mycode.Rout. Is there a way I can issue command from shell (like above) so that the output is printed to STDOUT? It's troublesome to open the "Rout" file every time to debug. R

[R] EM Algorithm in R

2008-05-13 Thread Edward Wijaya
Hi all, Is there any EM (Expectation Maximization) package available for R? CRAN Package archive (http://cran.r-project.org/) doesn't seem to have it. Regards, Edward __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help