Re: [R] R package dependencies

2010-01-14 Thread Colin Millar
me. Many thanks again, Colin. -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: 14 January 2010 14:06 To: Colin Millar Cc: Gabor Grothendieck; r-help@r-project.org Subject: Re: [R] R package dependencies For the original question: > what are a packa

Re: [R] R package dependencies

2010-01-14 Thread Colin Millar
lapply(fnames, function(x) {download.file(x, tmpf); unzip(tmpf, list = TRUE)}) ndlls <- sapply(pkg.contents, function(x) sum( grepl( ".dll", x $ Name ))) pkg.summ <- data.frame(pkg = rownames(available), dll = ndlls) Thanks again, Colin. From: Ga

[R] R package dependencies

2010-01-13 Thread Colin Millar
Hi there, My question relates to getting information about R packages. In particular i would like to be able to find from within R: what are a packages dependencies what are a packages reverse dependencies does a package contain a dll The reason i ask is: The organisation that i work

Re: [R] Simple Function doesn't work?

2009-11-27 Thread Colin Millar
@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Colin Millar Sent: 27 November 2009 16:41 To: Anastasia; r-help@r-project.org Subject: Re: [R] Simple Function doesn't work? Hi, You would also make your code more efficient and possible more readable by doing ReturnsGrid

Re: [R] Simple Function doesn't work?

2009-11-27 Thread Colin Millar
Hi, You would also make your code more efficient and possible more readable by doing ReturnsGrid <- function(x, y, m) { x + (seq.int(m) - 1) * (y - x) / m } (xx <- ReturnsGrid(0, 9, 3)) #[1] 0 3 6 And if you want to supply vector x and y you could do something like (there are probably better

Re: [R] Switch Help

2009-11-18 Thread Colin Millar
And if you want to do both do invisible( lapply(c("scrn","dx"), aar) ) but I think you will have to use multiple ifs rather than switch if you intend to add more functionality... . . . I think you just missed some commas out... aar <- function(command = c("scrn", "dx", "df")) { command <-

Re: [R] Switch Help

2009-11-18 Thread Colin Millar
I think you just missed some commas out... aar <- function(command = c("scrn", "dx", "df")) { command <- match.arg(command) switch(command, scrn = cat("scrn :Screening","\n"), dx = cat("dx:Diagnosis","\n"), df = cat("df:Don't Forget","\n") ) } Colin. Ps you don'

Re: [R] Basic question on nominal data

2009-11-17 Thread Colin Millar
Hi, try ?table # for example (s3 <- table(s)) # and if you want a single value s3["a"] # or s3[1] HTH, Colin. From: r-help-boun...@r-project.org on behalf of Marc Giombetti Sent: Tue 17/11/2009 22:55 To: r-help@r-project.org Subject: [R] Basic ques

Re: [R] Calculating the power of a negative number

2009-11-17 Thread Colin Millar
-help-boun...@r-project.org] On Behalf Of Colin Millar Sent: 17 November 2009 16:10 To: Zhiyuan Jason ZHENG; r-h...@stat.math.ethz.ch Subject: Re: [R] Calculating the power of a negative number Hi, Look at ?NumericConstants At the bottom of the details section you will find: "Note t

Re: [R] Calculating the power of a negative number

2009-11-17 Thread Colin Millar
Hi, Look at ?NumericConstants At the bottom of the details section you will find: "Note that a leading plus or minus is not regarded by the parser as part of a numeric constant but as a unary operator applied to the constant." See ?Syntax for precedence information. Hope this helps, Co

Re: [R] Plotting Histogram using histogram() and for loop and Iwant to save the histogram individually ... HELP

2009-11-17 Thread Colin Millar
Or alternatively store as a list and export later if you want ... after some tidying ... library(lattice) columns <- 8:153 plots <- vector("list", length(columns)) j <- 0 for (i in columns) { plots[[ j <- j+1 ]] <- histogram( ~ data[,i] | data[,2], ylab = "Frequency", xlab = "S

Re: [R] negative log likelihood

2009-11-09 Thread Colin Millar
Sounds like a homework question ... if y = a + bx + e, where e ~ N(0, sigma^2) the log likelihood of the slope parameter and intercept parameters, a and b, and variance sigma^2 given n data points y and covariates x is f(a,b, sigma; y, x) = -0.5*n*log(2 * pi) - n*log(sigma) - 0.5 / sigma^2

Re: [R] Normal distribution

2009-10-02 Thread Colin Millar
A quick google on 'normality test' (no quotes) gives http://en.wikipedia.org/wiki/Normality_test. This gives you a few more tests than the KS test. Cheers, Colin. Steve Lianoglou wrote: > Hi, > > I think you can also use a qq-plot to do the same, no? You won't get a > statistic score + p.valu

Re: [R] Select top three values from data frame

2009-08-26 Thread Colin Millar
Hi, This should work - head is quite a usefull summary function head(df.mydata[df.mydata$A=="X" & df.mydata$C < 2, ],3) Colin. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Noah Silverman Sent: 26 August 2009 10:54 To: ottorin

Re: [R] Select top three values from data frame

2009-08-26 Thread Colin Millar
Or perhaps use a temporary vector might be neater? tmp <- with(df.mydata, B[A=="X" & C < 2]) df.mydata[order(tmp) %in% 1:3,] # gives df with highest three values of B or head(df.mydata[order(tmp),],3) # gives first 3 rows of df sorted by B Colin. -Original Message- From: r-help-boun..