[R] [R-pkgs] Major update: meta version 2.0-0

2012-03-29 Thread Guido Schwarzer
Version 2.0-0 of meta (an R package for meta-analysis) is now available on CRAN. Changes are described below. Yours, Guido Major revision R package meta linked to R package metafor by Wolfgang Viechtbauer to provide additional statistical methods, e.g. meta-regression and other estimates fo

[R] [R-pkgs] Updates to the Deducer family of packages

2012-03-29 Thread Ian Fellows
Dear R users, Over the past month there have been a number of package updates in the deducer ecosystem. Deducer is a general purpose, extensible, data analysis GUI. It is designed to be a free easy to use alternative to proprietary data analysis software such as SPSS, JMP, and Minitab. It has a

[R] [R-pkgs] package update: mediation

2012-03-29 Thread dustin tingley
Package update: mediation Scholars across a range of disciplines are increasingly interested in identifying causal mechanisms, going beyond the estimation of causal effects. The mediation package (4.0) estimates mediation effects for a variety of experimental designs and statistical models. The up

Re: [R] R warning and error messages taking a long time and generating pop-up windows

2012-03-29 Thread achernia
Balko, Justin wrote > > Hi all, thanks for your help in advance. > I was running some scripts and suddenly R began taking a very long time to > process mundane errors, which I often generate since I am new to R...such > as forgetting to add in my quote > > getOption(warn) > Error in options(x) :

Re: [R] Update Packages error

2012-03-29 Thread Peter Langfelder
On Thu, Mar 29, 2012 at 9:41 PM, Jim Silverton wrote: > Anyone knows how to get around this message? I am trying to update some > packages in R but I get the following message I use R for 64 bit windows. > Warning in install.packages(update[instlib == l, "Package"], l, contriburl > = contriburl,  

Re: [R] How to create arbitrary number of loops in R

2012-03-29 Thread Dai, Hongying,
I figured out how to convert the array to a vector. library(irr) M <- matrix(1:50,nc=10) unlist(combn(10, 2, function(v) icc(M[,v]))[7,]) This code will get all I need. Please ignore my question below. Thanks! Daisy -Original Message- From: Dai, Hongying, Sent: Thursday, March 29, 2012 4

[R] Error in use of "gwindow" and ".First" function

2012-03-29 Thread mrzung
Hi, I saved an image and planed to open it whenever I want to load it. However, when I open it, It doesn't work. The code is following, and saved it as an image. .First<-function(){ require(tcltk) require(TeachingDemos) library(gWidgetstcltk) options(guiToolkit = "

Re: [R] scalar assignment within a vector within function

2012-03-29 Thread Rui Barradas
Hello, btc1 wrote > > Hello, > > I'm trying to create a vector of r^2 values for using a function which I > will run in a "for" loop. Example: > > per<-rnorm(100,.5,.2)^2 > x<-rnorm(100,10,5) > y<-rnorm(100,20,5) > fr<-data.frame(x,y,per) > > test<-rep(0,9) > > plotter<-function(i){ > temp.i

[R] Error in use of "gwindow" and ".First" function

2012-03-29 Thread mrzung
Hi, I saved an image and planed to open it whenever I want to load it. However, when I open it, It doesn't work. The code is following, and saved it as an image. .First<-function(){ require(tcltk) require(TeachingDemos) library(gWidgetstcltk) options(guiToolkit = "

Re: [R] Update Packages error

2012-03-29 Thread Jim Silverton
Anyone knows how to get around this message? I am trying to update some packages in R but I get the following message I use R for 64 bit windows. Warning in install.packages(update[instlib == l, "Package"], l, contriburl = contriburl, : 'lib = "C:/Program Files/R/R-2.14.1/library"' is not writab

Re: [R] Random sample from a data frame where ID column values don't match the values in an ID column in a second data frame

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 4:22 PM, inkhorn wrote: When I use that exact syntax Which you didn't include as context. Please read the Posting Guide. (with the ID variable names You are the one the offered "ID" as the column name. in quotes within the square brackets after a comma) it just doesn

Re: [R] How to improve, at all, a simple GLM code

2012-03-29 Thread Ben Bolker
Abigail Clifton me.com> writes: > I am wanting to find a good predictive model, yes. It's part of a > project so if I have time after finding the model I may want to find > some patterns but it's not a priority. I just want the model for now > (I need the coefficients above all). > It's all cate

Re: [R] Simple For Loop Help

2012-03-29 Thread gpetris
Hi Arun, This seems to do what you are looking for: Y <- matrix(rnorm(12), 4, 3) Y [,1] [,2][,3] [1,] -1.0457177 0.7756343 -0.06063478 [2,] -0.8962113 1.5573704 -0.50137832 [3,] 1.2693872 -0.3654018 0.92606273 [4,] 0.5938409 0.8165564 0.03693769 X <- apply(Y,

Re: [R] Finding the maximum elements in an array/matrix

2012-03-29 Thread Jorge I Velez
Try which(A == max(A), arr.ind = TRUE) HTH, Jorge.- On Thu, Mar 29, 2012 at 10:27 PM, jpm miao <> wrote: > Hello, > > I would like to find the maximum element in a matrix or an array but it > does not return what I want. > > For example, If I have a 2*2 matrix A whose maximum element is th

Re: [R] Finding the maximum elements in an array/matrix

2012-03-29 Thread R. Michael Weylandt
As they say, RTFMin particular, this part: ? which.max --> See Also: Use ‘arrayInd()’, if you need array/matrix indices instead of 1D vector ones. Michael On Thu, Mar 29, 2012 at 10:27 PM, jpm miao wrote: > Hello, > >   I would like to find the maximum element in a matrix or an a

Re: [R] Questions on user defined function

2012-03-29 Thread R. Michael Weylandt
1. It's your choice, but it's entirely possible to define multiple functions in the same file or inline. If you want to read from a file though, you have to do it with source(). 2. Yes. This is the idea behind the package system. In short, R is much nicer about functions than Matlab. Michael On

[R] Finding the maximum elements in an array/matrix

2012-03-29 Thread jpm miao
Hello, I would like to find the maximum element in a matrix or an array but it does not return what I want. For example, If I have a 2*2 matrix A whose maximum element is the A(1,2). I would like the answer (1,2), but it returns 3, which is the ordinal if one counts by columns. Is there any

[R] Questions on user defined function

2012-03-29 Thread jpm miao
Hello, I am new to the construction of user defined functions in R. I do see the syntax of the function in many R reference but don't see the structures / paths issue. Two basic questions: 1. Should the function embedded in the main program? Could a function be a separate R file (like Matlab)?

Re: [R] different offset for each label?

2012-03-29 Thread Jinsong Zhao
On 2012-03-30 5:34, Uwe Ligges wrote: On 29.03.2012 07:38, Jinsong Zhao wrote: Hi there, I hope to give a different offset for each label in a complex plot. However, the following code does not work. > plot(1:4) > text(c(1:4), letters[1:4], pos = c(4,3,2,1), offset=c(1,2,3,4)) it seems that

Re: [R] Weird POSIXct behaviour

2012-03-29 Thread Worik R
On Fri, Mar 30, 2012 at 2:53 PM, Joshua Ulrich wrote: > On Thu, Mar 29, 2012 at 3:56 PM, Worik R wrote: > > > I removed the (not so minimal) reproducible example because you can > get the same behavior via: > > (s <- Sys.time()) > [1] "2012-03-29 20:43:35 CDT" > > as.POSIXct(as.numeric(s),origin

Re: [R] Weird POSIXct behaviour

2012-03-29 Thread Joshua Ulrich
On Thu, Mar 29, 2012 at 3:56 PM, Worik R wrote: > I have a reproducible example of my problem below > > On Mon, Mar 26, 2012 at 9:22 AM, Joshua Ulrich > wrote: >> >> > Given two identical string representations of POSIXct objects, can the >> > two >> > objects represent different times? >> > >> Y

Re: [R] Load datasets

2012-03-29 Thread Hua Liang
Michael is right. I tried and found get() is required for my case. Hua On Mar 29, 2012, at 13:50, "R. Michael Weylandt " wrote: > Yes, but if the OP wants to assign the values to "ineed" (which I think is > the request), he'll need get() > > Michael > > On Mar 29, 2012, at 12:50 PM, David Wi

Re: [R] Nested brew call yields Error in .brew.cat(26, 28) : unused argument(s) (26, 28)

2012-03-29 Thread Matt Shotwell
On Wed, 2012-03-28 at 11:40 +0100, Chris Beeley wrote: > I am writing several webpages using the brew package and R2HTML. I would > like to work off one script so I am using nested brew calls. The > documentation for brew states that: > > "NOTE: brew calls can be nested and rely on placing a fun

[R] How to adjust the stack size of R

2012-03-29 Thread Xiaobo Gu
Hi, I got a stack overflow error when training a glm model with a very long formula. Regards, Xiaobo Gu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] How to create arbitrary number of loops in R

2012-03-29 Thread Jeff Newmiller
It seems to me that if you looked at Christian's code carefully you might wonder what it means to omit a value for the row index, and then you might (re-)read "An Introduction To R" (that comes with R) or you might learn that "[" is a function that you can search for help on ( ?"[" ) where there

Re: [R] Simple For Loop Help

2012-03-29 Thread jim holtman
tyr this: > # generate some data > x <- cbind(y1 = runif(100) + , y2 = runif(100) + , y3 = runif(100) + ) > > x <- cbind(x, y4 = apply(x, 1, which.min)) > x y1y2 y3 y4 [1,] 0.976953289 0.91072645970 0.713624001 3 [2,] 0.630992512

Re: [R] Simple For Loop Help

2012-03-29 Thread J Toll
On Thu, Mar 29, 2012 at 4:32 PM, arun.gurubaramurugeshan wrote: > Hi, > I need help with the following. > > I have a dataset Y with 200 observations and three variables Y1, Y2 & Y3. I > have to find the minimum of Y1, Y2 & Y3 and if the minimum is Y1 then I have > to assign 1 to a variable (Y4), i

Re: [R] scalar assignment within a vector within function

2012-03-29 Thread Peter Langfelder
On Thu, Mar 29, 2012 at 3:49 PM, Benjamin Caldwell wrote: > Hello, > > I'm trying to create a vector of r^2 values for using a function which I > will run in a "for" loop. Example: > > per<-rnorm(100,.5,.2)^2 > x<-rnorm(100,10,5) > y<-rnorm(100,20,5) > fr<-data.frame(x,y,per) > > test<-rep(0,9) >

Re: [R] How to create arbitrary number of loops in R

2012-03-29 Thread Dai, Hongying,
Thanks, ilai and Christian! Both codes are working but I have one more question. Both codes return results in array format. In my original code, I get icc value from icc(data)$value and use loop to get icc value vector. Under the array format, how can I extract icc value from the array output an

Re: [R] Random sample from a data frame where ID column values don't match the values in an ID column in a second data frame

2012-03-29 Thread inkhorn
When I use that exact syntax (with the ID variable names in quotes within the square brackets after a comma) it just doesn't work. Also, I'm looking for a random sample, not all possible rows with ID values that don't match the second data frame. -- View this message in context: http://r.789695.

Re: [R] Rcmd build -binary -- problem

2012-03-29 Thread jack306
Thanks for the comments. Using "INSTALL" rather than "install" gets the job done. Best regards, Jixiang Wu On Thu, Mar 29, 2012 at 2:52 PM, Uwe Ligges-3 [via R] < ml-node+s789695n4516710...@n4.nabble.com> wrote: > > > On 28.03.2012 22:22, jack306 wrote: > > After I used rtools 2.15 and R-2.14.

[R] Simple For Loop Help

2012-03-29 Thread arun.gurubaramurugeshan
Hi, I need help with the following. I have a dataset Y with 200 observations and three variables Y1, Y2 & Y3. I have to find the minimum of Y1, Y2 & Y3 and if the minimum is Y1 then I have to assign 1 to a variable (Y4), if Y2 is the minimum then "2" to Y4 else "3" to Y4. This is what I have done

Re: [R] How to improve, at all, a simple GLM code

2012-03-29 Thread Abigail Clifton
Hi Ben, Thank you for all your help so far! I appreciate it. I am wanting to find a good predictive model, yes. It's part of a project so if I have time after finding the model I may want to find some patterns but it's not a priority. I just want the model for now (I need the coefficients abo

Re: [R] Memory shortage running Repeated Measures (nlme)

2012-03-29 Thread maycobra1
I'm no expert and this doesn't really address your question but generally I try to increase my memory limit when I get these errors. You can increase your memory to 3G with the following: memory.limit(3000) -- View this message in context: http://r.789695.n4.nabble.com/Memory-shortage-running-Re

[R] scalar assignment within a vector within function

2012-03-29 Thread Benjamin Caldwell
Hello, I'm trying to create a vector of r^2 values for using a function which I will run in a "for" loop. Example: per<-rnorm(100,.5,.2)^2 x<-rnorm(100,10,5) y<-rnorm(100,20,5) fr<-data.frame(x,y,per) test<-rep(0,9) plotter<-function(i){ temp.i<-fr[fr$per <=(i*.10),] with(temp.i, plot(x, y, mai

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread Steven R Corsi
Thanks for this feedback. I was able to get that example to work, but I have gotten conflicting results with factors converted via POSIXct using the format= and tz= options to bring in excel-type dates and times. Here is what I have tried: dt.factor <- factor(c("3/17/2011 14:07","3/20/2011 7:18

Re: [R] Error: argument of length 0

2012-03-29 Thread Duncan Murdoch
On 12-03-29 2:57 PM, ens wrote: Problem: I keep getting: "Error in (index - 9):index : argument of length 0" when I run this code in an automated loop, but when I step through it by hand, I have no problems. It keep crashing when i<-10. I cannot figure this out to save my life! Please help and

Re: [R] different offset for each label?

2012-03-29 Thread Uwe Ligges
On 29.03.2012 07:38, Jinsong Zhao wrote: Hi there, I hope to give a different offset for each label in a complex plot. However, the following code does not work. > plot(1:4) > text(c(1:4), letters[1:4], pos = c(4,3,2,1), offset=c(1,2,3,4)) it seems that text() only use the first element of

Re: [R] How to improve, at all, a simple GLM code

2012-03-29 Thread Ben Bolker
Abigail Clifton me.com> writes: > I am trying to fit a logit model to some data in a CSV file in R. It would be helpful to link back to your previous question: http://thread.gmane.org/gmane.comp.lang.r.general/259353 > Here is my code: > > Prepared_Data = read.csv("Prepared_Data.csv", heade

Re: [R] Weird POSIXct behaviour

2012-03-29 Thread Worik R
I have a reproducible example of my problem below On Mon, Mar 26, 2012 at 9:22 AM, Joshua Ulrich wrote: > > Given two identical string representations of POSIXct objects, can the > two > > objects represent different times? > > > Yes. Here's an example (from my Ubuntu machine) of one way: > > >

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread Prof Brian Ripley
On 29/03/2012 21:05, Steven R Corsi wrote: That is a good tip. I have tried it and found that it works if I make sure it was converted to character first. strptime appears to accept factor variables which is the default when reading in the file originally. I would say that POSIXct is the way to

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread Steven R Corsi
That is a good tip. I have tried it and found that it works if I make sure it was converted to character first. strptime appears to accept factor variables which is the default when reading in the file originally. Thanks Steve On 3/29/2012 2:31 PM, MacQueen, Don wrote: I also find that POSIXc

Re: [R] Random sample from a data frame where ID column values don't match the values in an ID column in a second data frame

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 2:37 PM, inkhorn wrote: Hello, Let's say I've drawn a random sample () from a large data frame (main.df), and I want to create a second random sample (sample2.df) where the values in its ID column *are not* in the equivalent ID column in the first sample (sample1.df).

[R] How to improve, at all, a simple GLM code

2012-03-29 Thread Abigail Clifton
Hi There, I am trying to fit a logit model to some data in a CSV file in R. Here is my code: Prepared_Data = read.csv("Prepared_Data.csv", header=TRUE) Prepared_Data attach(Prepared_Data) lrfit<-glm(C3~A1*B2*D4*E5,family = binomial) anova(lrfit, test="Chisq") write.csv(anova(lrfit, test="Chisq")

Re: [R] Rcmd build -binary -- problem

2012-03-29 Thread Uwe Ligges
On 28.03.2012 22:22, jack306 wrote: After I used rtools 2.15 and R-2.14.2 to create an R package, I have some thoughts that some R users may try: 1. If rcmd is not recognized even the path is set under advanced environmental variables, use "path C:\Program Files\R\R-2.14.2\bin\x64" if you try

Re: [R] How to calculate the Deviance for test data based on Cox model

2012-03-29 Thread Thomas Lumley
On Thu, Mar 29, 2012 at 11:03 PM, ChiangKevin wrote: > > > Dear List, > > If I got a Cox model based on training set, then how should I calculate the > Cox log partial likelihood for the test data? > Actually I am trying to calculate the deviance on test dataset to evaluate > the performance of

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread MacQueen, Don
I also find that POSIXct is generally the most useful, and only use POSIXlt in special cases. But have you considered as.POSIXct() instead of strptime()? It works for me, and I can't remember the last time I had to use strptime() for converting character to date/time. (But I mostly don't work with

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread Steven R Corsi
Thanks for the link Michael. This is a very good explanation with some very useful tips on which date classes to use for different purposes. It generally strengthened the concept that POSIXct is the way to go unless you need to extract specific components of the date from POSIXlt. Since strptim

[R] Error: argument of length 0

2012-03-29 Thread ens
Problem: I keep getting: "Error in (index - 9):index : argument of length 0" when I run this code in an automated loop, but when I step through it by hand, I have no problems. It keep crashing when i<-10. I cannot figure this out to save my life! Please help and THANK YOU in advance! variables:

[R] Random sample from a data frame where ID column values don't match the values in an ID column in a second data frame

2012-03-29 Thread inkhorn
Hello, Let's say I've drawn a random sample (sample1.df) from a large data frame (main.df), and I want to create a second random sample (sample2.df) where the values in its ID column *are not* in the equivalent ID column in the first sample (sample1.df). How would I go about doing this? In other

Re: [R] Hosmer-Lemeshow 'goodness of fit'

2012-03-29 Thread JimeBoHe
I am a new user in R, so I am sorry if this is a basic question but I am kind of lost here and I really would appreciatte your help. I have behavioral information of sea lions and I've done a binomial Generalized Linear model using Rcmdr, to understand what variables are affecting the place where

[R] simulate correlated binary, categorical and continuous variable

2012-03-29 Thread Burak Aydin
Hi, I d like to simulate 9 variables; 3 binary, 3 categorical and 3 continuous with a known covariance matrix. Using mvtnorm and later dichotimize/categorize variables is not efficient. Do you know any package or how to simulate mixed data? -- View this message in context: http://r.789695.n4.nabb

Re: [R] Retrieving matrix column and row names by index value

2012-03-29 Thread R. Michael Weylandt
This seems to work: namesFromIndex <- function(indx, obj){ mapply(`[`, dimnames(obj), arrayInd(indx, dim(obj))) } Michael On Thu, Mar 29, 2012 at 2:20 PM, Lanna Jin wrote: > Hi all, > > So let's say I have a matrix, mdat and I only know the index number. How do > I retrieve the column and r

[R] Retrieving matrix column and row names by index value

2012-03-29 Thread Lanna Jin
Hi all, So let's say I have a matrix, mdat and I only know the index number. How do I retrieve the column and row names? For example, > mdat <- matrix(c(1,2,3, 11,12,13), nrow = 2, ncol=3, byrow=TRUE, dimnames = list(c("row1", "row2"), c("C.1", "C.2"

Re: [R] How to test for the difference of means in population, please help

2012-03-29 Thread ali_protocol
Dear Wu, Thank you indeed very much for your response. Is it possible that I use this method to compare the distribution of original population that this observations come from? Thank you ideed very much. On 3/28/12, alan wu [via R] wrote: > > > try anova if they have same observe points. >

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread R. Michael Weylandt
That's generally my reaction to them, but you should also read "R News 4/1 -- Help Desk" (http://cran.r-project.org/doc/Rnews/Rnews_2004-1.pdf) which gives some tips on Date()s and the various time classes. Best, Michael On Thu, Mar 29, 2012 at 2:19 PM, Steven R Corsi wrote: > Thanks very much f

Re: [R] POSIXlt vs POSIXct

2012-03-29 Thread Steven R Corsi
Thanks very much for the response. That was a very good article and gives me a good appreciation for the history and covers the structure of the two date/time formats well. What I was specifically looking for is a feel for the situations when one format should be used over the other. In my wor

Re: [R] matrix with Loop

2012-03-29 Thread R. Michael Weylandt
apply() will hit all the rows/columns at once so you don't need the loop construct at all. E.g., x <- matrix(rnorm(20), ncol = 5) ## One Line y1 <- apply(x, 1, mean) ## Or Four y2 <- numeric(nrow(x)) for(i in 1:nrow(x)){ y2[i] <- mean(x[i,]) } ## But they're the same identical(y1, y2) # TR

Re: [R] Handling functions as objects

2012-03-29 Thread Julio Sergio
David Winsemius comcast.net> writes: > > > There is also the `do.call` function to construct proper calls from a > character that matches the name of a function > > f1 = function(foo) { > do.call(foo, list(1,2)) >} > > f1("+") > [1] 3 > Thanks David, this information has bee

Re: [R] Load datasets

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 1:50 PM, R. Michael Weylandt wrote: Yes, but if the OP wants to assign the values to "ineed" (which I think is the request), he'll need get() Perhaps. I assumed he wanted to load 'phones'. (That's what he said he wanted.) If he did this : ineed <- get(data(list = arg)

Re: [R] Load datasets

2012-03-29 Thread R. Michael Weylandt
Yes, but if the OP wants to assign the values to "ineed" (which I think is the request), he'll need get() Michael On Mar 29, 2012, at 12:50 PM, David Winsemius wrote: > > On Mar 29, 2012, at 12:13 PM, R. Michael Weylandt wrote: > >> Perhaps something like > >>> alldata = data(package="MASS"

Re: [R] Is it possible to de-select with sqlQuery from the RODBC library?

2012-03-29 Thread Bart Joosen
Another way is to use VBA to create a table which contains all the table names and column names. Then use select from this table to create your query. I didn't find any other solutions Bart -- View this message in context: http://r.789695.n4.nabble.com/Is-it-possible-to-de-select-with-sqlQuery-

Re: [R] Handling functions as objects

2012-03-29 Thread Julio Sergio
Gabor Grothendieck gmail.com> writes: > > See ?match.fun > > There is also an enhanced version, match.funfn, in the gsubfn package. > Thanks Gabor! --Sergio. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

Re: [R] Handling functions as objects

2012-03-29 Thread Julio Sergio
Duncan Murdoch gmail.com> writes: > You are seeing the effects of the evaluator and parser being helpful. > When you say > > foo(1,2) > > Thanks Duncan! --Sergio __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-

Re: [R] Handling functions as objects

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 1:34 PM, Duncan Murdoch wrote: On 29/03/2012 1:02 PM, Julio Sergio wrote: I learnt that functions can be handled as objects, the same way the variables are. So, the following is perfectly valid: > f = function(a, b) { +print(a) +print(b) + } > > f1 = function(f

Re: [R] Handling functions as objects

2012-03-29 Thread Gabor Grothendieck
On Thu, Mar 29, 2012 at 1:02 PM, Julio Sergio wrote: > I learnt that functions can be handled as objects, the same way the variables > are. So, the following is perfectly valid: > >> f = function(a, b) { > +    print(a) > +    print(b) > + } >> >> f1 = function(foo) { > +    foo(1,2) > + } >> >> f

Re: [R] Handling functions as objects

2012-03-29 Thread Duncan Murdoch
On 29/03/2012 1:02 PM, Julio Sergio wrote: I learnt that functions can be handled as objects, the same way the variables are. So, the following is perfectly valid: > f = function(a, b) { +print(a) +print(b) + } > > f1 = function(foo) { +foo(1,2) + } > > f1(f) [1] 1 [1] 2 > I also

Re: [R] split list

2012-03-29 Thread Bert Gunter
Sorry -- that 2nd line should of course be: yourlist <- split( gl[!omit], ,cumsum(omit)[!omit]) -- Bert On Thu, Mar 29, 2012 at 10:07 AM, Bert Gunter wrote: > Here's a more "minimalist" and perhaps faster approach (asit uses indexing) > > Let "gl" be the the vector with the gene list. > > omit

Re: [R] abline with xyplot does not work

2012-03-29 Thread Bert Gunter
?panel.abline You need grid/lattice functions for xyplot ! -- Bert On Thu, Mar 29, 2012 at 9:38 AM, John Sorkin wrote: > I am trying to plot the results of a random effects model where each subject > is allowed to have his, or her, own intercept. I use xyplot to plot the data, > lme to comput

Re: [R] split list

2012-03-29 Thread Bert Gunter
Here's a more "minimalist" and perhaps faster approach (asit uses indexing) Let "gl" be the the vector with the gene list. omit <- gl == "batch" yourlist <- split( gl[omit], ,cumsum(omit)[!omit]) Cheers, Bert On Thu, Mar 29, 2012 at 9:25 AM, Martin Morgan wrote: > On 03/29/2012 08:18 AM, konik

[R] Handling functions as objects

2012-03-29 Thread Julio Sergio
I learnt that functions can be handled as objects, the same way the variables are. So, the following is perfectly valid: > f = function(a, b) { +print(a) +print(b) + } > > f1 = function(foo) { +foo(1,2) + } > > f1(f) [1] 1 [1] 2 > I also know that operators are functions, so, I ca

Re: [R] Load datasets

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 12:13 PM, R. Michael Weylandt wrote: Perhaps something like alldata = data(package="MASS") arg = alldata$results[70,3] ineed <- data(arg, package="MASS") get(data(list = arg)) I think the get() is superfluous: > rm(phones) > exists("phones") [1] FALSE > data(list=arg

[R] abline with xyplot does not work

2012-03-29 Thread John Sorkin
I am trying to plot the results of a random effects model where each subject is allowed to have his, or her, own intercept. I use xyplot to plot the data, lme to compute the regression and then try to put a summary regression line on the xyplot. As can be seen by the output pasted below, I am ge

[R] SVM performance/optimization

2012-03-29 Thread Alekseiy Beloshitskiy
Dear All, I m trying to build SVM model with large dataset. However, svm from package e1071 works slowly (takes hours) to build model for like 1 million observations. I was thinking about CVM (Core Vector Machines: http://www.cse.ust.hk/~jamesk/papers/jmlr05.pdf

Re: [R] split list

2012-03-29 Thread Martin Morgan
On 03/29/2012 08:18 AM, konika chawla wrote: Hi Is there a function like splitstr, for splitting lists? I want to divide a list of gene names based on a recurring value like "batch" the list is like [1,] "AT4G25480" [2,] "AT3G20810" [3,] "AT2G46670" [4,] "AT4G27310" [5,] "batch" [6,] "AT1G04570"

Re: [R] Load datasets

2012-03-29 Thread R. Michael Weylandt
Perhaps something like get(data(list = arg)) 2012/3/29 Hua Liang : > > I am trying to use datasets within R with a loaded package, for example, > MASS. When I use the dataset phones, it can be done using data(phones, > package=”MASS”). I am thinking about an alternative but more flexible way to

[R] Load datasets

2012-03-29 Thread Hua Liang
I am trying to use datasets within R with a loaded package, for example, MASS. When I use the dataset phones, it can be done using data(phones, package=”MASS”). I am thinking about an alternative but more flexible way to load this dataset. Because phones is the 70th dataset in this package, I

[R] copy matrix another matrix

2012-03-29 Thread MSousa
> results val_user v_source v_destine count average 1 7 2222 4 186.25 2 7 2222 2 383.50 3 7 2222 1 19.00 4 7 9797 1 196.00 5 7 16197 1 68.00 6 7 22 130 1 21

[R] split list

2012-03-29 Thread konika chawla
Hi Is there a function like splitstr, for splitting lists? I want to divide a list of gene names based on a recurring value like "batch" the list is like [1,] "AT4G25480" [2,] "AT3G20810" [3,] "AT2G46670" [4,] "AT4G27310" [5,] "batch" [6,] "AT1G04570" [7,] "AT5G62360" [8,] "AT2G

[R] How to get the most frequent value of the subgroup

2012-03-29 Thread Yongsuhk Jung
Dear Members of the R-Help, While using a R function - 'aggregate' that you developed, I become to have a question. In that function, > aggregate(x, by, FUN, ..., simplify = TRUE) I was wondering about what type of FUN I should write if I want to get "the most frequent value of the subgro

[R] mb.long {timecourse}

2012-03-29 Thread statfan
How do you identify the genes which are differentially expressed using the mb.long function? More specifically, in the fruitfly example (see below), we begin with an expression matrix containing 2000 genes. How do I obtain not only the proportion of differentially expressed genes, but also the su

Re: [R] binomial sample size calculation

2012-03-29 Thread Marc Schwartz
On Mar 28, 2012, at 4:26 PM, McGuire, Rhydwyn wrote: > Hi everyone. > > > I need to do a sample size calculation for a one sample based on a CI > interval of +- 5% of the proportion, we expect to have a rate of 0.07 based > on similar studies. I have looked at the pwr-package as well as the

Re: [R] How to create arbitrary number of loops in R

2012-03-29 Thread ilai
On Thu, Mar 29, 2012 at 9:27 AM, ilai wrote: Oops, sent to fast. A (maybe) clearer solution: f <- function(x,m){ cmway <- combn(ncol(x),m) xx <- x[,cmway] dim(xx) <- c(nrow(x),nrow(cmway),ncol(cmway)) xx } f(M,3) str(sapply(2:4,f,x=M)) And again lapply / apply , or even return icc(xx) in f C

Re: [R] Adding duration (hh:mm:ss)\Converting factor column into duration class

2012-03-29 Thread R. Michael Weylandt
Factor -> numeric is tricky sometimes: you need to do this as.numeric(as.character(x)) but that's not going to work for you here because you don't really want numbers. Instead try something like this (untested though): parseDuration <- function(t1, t2){ t1 <- as.numeric(unlist(strsplit(as.ch

Re: [R] matrix with Loop

2012-03-29 Thread R. Michael Weylandt
apply(x, 1, mean) apply(x, 2, median) or for more speed rowMeans() ? apply Michael On Thu, Mar 29, 2012 at 9:00 AM, Christopher Kelvin wrote: > Hello! > I got something to ask..whether you can help me with the R program...i got > this for example 5x4 matrix..and i want to find: >  i) mean for

Re: [R] Error, Variable is missing

2012-03-29 Thread R. Michael Weylandt
I believe you need to actually pass the values to your function: pdf(x, mu, sigma, alpha, beta, rho) # Works pdf(x) # Doesn't. If not, please show us how you are calling pdf(). Michael On Thu, Mar 29, 2012 at 9:25 AM, Guaramy wrote: > Hi, I am writing a function to plot a pdf of a distribution

Re: [R] How to create arbitrary number of loops in R

2012-03-29 Thread ilai
To cbind, you don't need a loop (M <- matrix(1:50,nc=10)) c2way <- combn(ncol(M),2) MM <- M[,c2way] dim(MM) <- c(nrow(M),nrow(c2way),ncol(c2way)) MM c3way <- combn(ncol(M),3) MMM <- M[,c3way] dim(MMM) <- c(nrow(M),nrow(c3way),ncol(c3way)) MMM etc. etc. Than you can (untested for icc) loop your

Re: [R] How to get the most frequent value of the subgroup

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 9:30 AM, Jung, Yongsuhk wrote: Dear Members of the R-Help, While using a R function - 'aggregate' that you developed, I become to have a question. In that function, aggregate(x, by, FUN, ..., simplify = TRUE) I was wondering about what type of FUN I should write if

Re: [R] How to get the most frequent value of the subgroup

2012-03-29 Thread R. Michael Weylandt
What you are looking for is commonly called the mode, but (surprisingly?) there doesn't seem to be a standard implementation for mode() in R. (the mode function gives you something else entirely) -- this SO thread may be of help: http://stackoverflow.com/questions/2547402/standard-library-function-

Re: [R] xyplot lattice fine control of axes limits and thick marks (with log scale)

2012-03-29 Thread ilai
On Thu, Mar 29, 2012 at 3:04 AM, maxbre wrote: > To answer your question: > - I did not put relation=’same’ because that is not what I want: i.e **for > each single panel** (in my case 4) I want to set the same limits for both x > and y axes (I want the diagonal line exactly bisect each panel);

[R] problem with the MLE of the skew-normal shape parameter

2012-03-29 Thread knouri
Hi everyone: my likelihood function involves the shape parameter of the skew-normal in addition to other parameters. I used both optim and nlm function to find the MLS's. However, every time that I use a different initial value for the shape parameter, I get a different estimate for it. No such p

[R] How to get the most frequent value of the subgroup

2012-03-29 Thread Jung, Yongsuhk
Dear Members of the R-Help, While using a R function - 'aggregate' that you developed, I become to have a question. In that function, > aggregate(x, by, FUN, ..., simplify = TRUE) I was wondering about what type of FUN I should write if I want to get "the most frequent value of the subgr

[R] How to create arbitrary number of loops in R

2012-03-29 Thread Dai, Hongying,
Dear R users, I'm wondering how I can generate an arbitrary number of loops in R. For instance, I can generate two "for" loops to get ICC among any two-way combination among 10 variables. Here is the code n<-10 for (i in 1:(n-1)) { for (j in (i+1):n) { icc(cbind(DATA[,i],DATA[,j])) } } If I need

[R] Error, Variable is Missing

2012-03-29 Thread Guaramy
Hi, I am writing a function to plot a pdf of a distribution, GNL.pdf.fn = function(x,mu,sigma,alpha,beta,rho) { y = x-rho*mu cf.fn = function(s){ cplex = complex(1,0,1) temp1 = alpha*beta*exp(-sigma*s^2/2) temp2 = (alpha-cplex*

[R] matrix with Loop

2012-03-29 Thread Christopher Kelvin
Hello! I got something to ask..whether you can help me with the R program...i got this for example 5x4 matrix..and i want to find:  i) mean for each row of the matrix ii) median for each column of the matrix and i need to do this using a loop function...below is my program..u try to check it for

[R] Error, Variable is missing

2012-03-29 Thread Guaramy
Hi, I am writing a function to plot a pdf of a distribution x=seq(-4,4,length=200) mu = 0 sigma = 0.01 alpha = 17.5 beta = 17.5 rho = 0.1 GNL.pdf.fn = function(x,mu,sigma,alpha,beta,rho) { y = x-rho*mu cf.fn = function(s){ cplex = complex(1,0,1)

[R] Re : Replace NaN with 0

2012-03-29 Thread Pascal Oettli
Hi, try ?is.nan Regards - Mail original - De : garima_sharma À : r-help@r-project.org Cc : Envoyé le : Jeudi 29 mars 2012 18h19 Objet : [R] Replace NaN with 0 I need help with replacing NaN with zero (the value '0') in my dataset. How can I do this? Thanks Garima Sharma -- View

[R] multiple plots in vis.gam()

2012-03-29 Thread Mabille, Geraldine
Hi, I'm working with gamm models of this sort: gm<- gamm(Z~te(x,y),data=DATA,random=list(Group=~1)) gm1<-gamm(Z~te(x,y,by=Factor)+Factor,data=DATA,random=list(Group=~1)) with a dataset of about 7 rows and 110 levels for Group if I use plot(gm1$gam), I obtain 3 different surface plots, one for

Re: [R] histogram break width

2012-03-29 Thread David Winsemius
On Mar 29, 2012, at 10:12 AM, Sarah Goslee wrote: See below: On Thu, Mar 29, 2012 at 10:05 AM, Vihan Pandey wrote: Hi all, I am generating histograms with the following R script : #!/usr/bin/Rscript out_file = "histo.png" png(out_file) scan("values.csv") -> myvalues hist(myvalues, brea

Re: [R] histogram break width

2012-03-29 Thread Sarah Goslee
See below: On Thu, Mar 29, 2012 at 10:05 AM, Vihan Pandey wrote: > Hi all, > > I am generating histograms with the following R script : > > #!/usr/bin/Rscript > > out_file = "histo.png" > png(out_file) > > scan("values.csv") -> myvalues > hist(myvalues, breaks = 50) > > dev.off() > > print(paste(

  1   2   >