Re: [R] multiplication question

2008-07-02 Thread N. Lapidus
Hi Murali, Just an idea, probably not the best : x<-1:4 y<-1:6 z<-matrix(1:(length(x)*length(y)),nrow=length(x)) I <- matrix(1,nrow=length(x),ncol=length(y)) I[row(I)==col(I)] <- 0 sum (outer (x, y, '*') * I) sum (outer (x, y, '*') * z * I) Hope this helps, Nael On Wed, Jul 2, 2008 at 6:3

Re: [R] Coefficients of Logistic Regression from bootstrap - how to get them?

2008-07-22 Thread N. Lapidus
Hi Michal, This paper by John Fox may help you to precise what you are looking for and to perform your analyses http://cran.r-project.org/doc/contrib/Fox-Companion/appendix-bootstrapping.pdf Nael On Tue, Jul 22, 2008 at 3:51 PM, Michal Figurski < [EMAIL PROTECTED]> wrote: > Dear all, > > I don't

Re: [R] Convert list of lists <--> data frame

2008-07-23 Thread N. Lapidus
Not very elegant but seems to work: pats.df <- as.data.frame(t(sapply (1:length(pats), function (i) do.call(cbind,pats[[i]] colnames(pats.df) <- names(pats[[1]]) # then pats2 <- lapply (1:nrow(pats.df), function (i) as.list(t(pats.df)[,i])) Nael On Wed, Jul 23, 2008 at 3:23 PM, Michael Frie

[R] error in passing an argument to do.call when do.call is in a for statement

2008-08-14 Thread Smits N
ith all kinds of other functionalities, which work fine). #This function is unimportant; it generates random paths randomstring<-function(a=1,n=31){ z<-vector(length=a) for (h in 1:a){ x<-"n" for (i in 1:n){ if (runif(1)>0.5){ y<-round(runif(1,-.5,9.5)) }

Re: [R] error in passing an argument to do.call when do.call is in a for statement

2008-08-15 Thread Smits N
Dear Dr. Ripley, Thank you very much for your comments concerning do.call and call. Obviously, until this week I was fully unaware of the existence of both functions. I changed the following code x<-do.call(method,methodArgs) into x<-call(method,Path) eval(x) and after deleting `

Re: [R] Converting 1-D array to vector

2008-08-27 Thread N. Lapidus
You were very close to an answer : as.vector(unlist(df[1,])) Nael On Wed, Aug 27, 2008 at 7:53 AM, Ronnen Levinson <[EMAIL PROTECTED]> wrote: > > Hi. > How do I convert a one-dimensional array of characters to a character > vector? In the example below I am trying to get the result c("a",

[R] Matrix _0.999375-14 "Note" under CRAN Check, Hmisc_3.4-3 has "Warning", Dpackage_1.0-5 has an "Error"

2008-09-25 Thread n . manganaro
Sorrry for re-sending this message as 1) a non-subscriber initially, then 2) from an un-subscribed e-mail. As context, I am a newbie, but preparing for a moderately deep dive into new areas af analysis while becoming familiar with R, at the same time. I have looked at the dependencies, amd im

Re: [R] Return a list

2008-09-26 Thread N. Lapidus
to the chosen environment > test2 <- function(){ + a <- 1 + b <- 2 + assign("a", a, envir=parent.frame(n=1)) + assign("b", b, envir=.GlobalEnv) + return(NULL) + } > > # Suppose test2 is launched by another function > test2.launcher <- function() { + test2()

Re: [R] How can I easily rbind a list of data frames into one data frame?

2008-09-27 Thread N. Lapidus
Try do.call("rbind", nameofyourlist) Nael On Sat, Sep 27, 2008 at 8:51 AM, Matthew Pettis <[EMAIL PROTECTED]>wrote: > Hi, > > I have a list output from the 'lapply' function where the value of > each element of a list is a data frame (each data frame in the list > has the same column types). How

Re: [R] vectorized sub, gsub, grep, etc.

2008-10-07 Thread N. Lapidus
Hi John, Wouldn't you get the same with just mapply(sub, patt, repl, X) ? Nael On Tue, Oct 7, 2008 at 9:58 PM, Thaden, John J <[EMAIL PROTECTED]> wrote: > R pattern-matching and replacement functions are > vectorized: they can operate on vectors of targets. > However, they can only use one pat

Re: [R] detect repeated number in a vector

2008-10-08 Thread N. Lapidus
Can this be an answer ? which(v %in% names(table(v)[table(v)>1])) [1] 2 5 Nael On Wed, Oct 8, 2008 at 8:36 PM, liujb <[EMAIL PROTECTED]> wrote: > > Dear R users, > > I have this vector that consists numeric numbers. Is there a command that > detects the repeated numbers in a vector and returns

Re: [R] Function for AUC?

2007-12-17 Thread N. Lapidus
Hi Armin, Do you know the rocr package ? This is very easy to draw ROC curves and to calculate AUC with it. http://rocr.bioinf.mpi-sb.mpg.de/ Hope this will help. Nael On Dec 17, 2007 2:58 AM, Stephen Weigand <[EMAIL PROTECTED]> wrote: > RSiteSearch("AUC") > > would lead you to > > http://finzi.

Re: [R] array addition

2007-12-19 Thread N. Lapidus
Hi Robin, Before someone gives a better solution, you can try this : x1<-array(1:10,c(2,5)) x2<-array(1:9,c(3,3)) ArrayAdd<-function(array1,array2){ x<-array(0,c(max(nrow(array1),nrow(array2)),max(ncol(array1),ncol(array2 x[1:nrow(array1),1:ncol(array1)]<-x[1:nrow(array1),1:ncol(array1

Re: [R] How can I join two lists?

2008-01-25 Thread N. Lapidus
Try c(q1,q2) Nael On Jan 25, 2008 4:45 PM, <[EMAIL PROTECTED]> wrote: > How can I join two lists? I have q1 and q2 and I want to merge them. I > have tried to use the comand merge, but not work. Any solutions? Thanks! > > > q1 > $Input1 > 7.84615384615385 > 0.5 > > $Input2 > 8.92307

Re: [R] Constructing dummy variables for months for a time series object

2008-04-25 Thread N. Lapidus
> GenDummyVar <- function (NumMonth) rep(c(rep(0, NumMonth-1), 1, rep(0, 12-NumMonth)), 17) > NameDummy <- c("DJan", "DFeb", "DMar", "DApr", "DMay", "DJun", "DJul", "DAug", "DSep", "DOct", "DNov", "DDec") > for (NumMonth in 1:12) assign(NameDummy, GenDummyVar (NumMonth)) > DJan [1] 0 0 0 0 0 0 0

Re: [R] Constructing dummy variables for months for a time series object

2008-04-25 Thread N. Lapidus
Oops.. the last line should have been : for (NumMonth in 1:12) assign(NameDummy[NumMonth], GenDummyVar (NumMonth)) On Fri, Apr 25, 2008 at 10:18 AM, N. Lapidus <[EMAIL PROTECTED]> wrote: > > GenDummyVar <- function (NumMonth) rep(c(rep(0, NumMonth-1), 1, rep(0, > 12-NumMonth)),

Re: [R] extracting columns from a list

2008-05-23 Thread N. Lapidus
Hi Mohamed Try: lapply (NameOfYourList, function (dat, NumCol) dat[,NumCol], c(12,13)) But there must be a shorter way to write this. Nael On Fri, May 23, 2008 at 3:37 PM, mohamed nur anisah < [EMAIL PROTECTED]> wrote: > Dear all, > > i have 2 lists of data with each of the list contain 14 c

Re: [R] extracting columns from a list

2008-05-23 Thread N. Lapidus
explicit. Nael On Fri, May 23, 2008 at 3:54 PM, N. Lapidus <[EMAIL PROTECTED]> wrote: > Hi Mohamed > > Try: > lapply (NameOfYourList, function (dat, NumCol) dat[,NumCol], c(12,13)) > > But there must be a shorter way to write this. > > Nael > > > On Fri,

Re: [R] naming components of a list

2008-05-25 Thread N. Lapidus
And if you have "thousands of names" like this: names(L) <- paste ("names", 1:length(L), sep="") Nael On Sun, May 25, 2008 at 10:38 PM, Erin Hodgess <[EMAIL PROTECTED]> wrote: > try this: > > > names(L) <- c("name1","name2","name3") > > L > $name1 > [1] "Fred" > > $name2 > [1] "Mary" > > $name3

Re: [R] locate the rows in a dataframe with some criteria

2008-03-07 Thread N. Lapidus
Hi Zhihua, M <- data.frame (x=c(10, 13, 8, 11), y=c('A', 'B', 'A', 'A')) which (M$x >= 10 & M$y == 'A') # [1] 1 4 Hope it helps, Nael 2008/3/7 N. Lapidus <[EMAIL PROTECTED]>: > Hi Zhihua, > > M <- data.frame (x=c(10

Re: [R] Calculate Specificity and Sensitivity for a given threshold value

2008-11-13 Thread N. Lapidus
Hi Pierre-Jean, Sensitivity (Se) and specificity (Sp) are calculated for cutoffs stored in the "performance" x.values of your prediction for Se and Sp: For example, let's generate the performance for Se and Sp: sens <- performance(pred,"sens") spec <- performance(pred,"spec") Now, you can have a

[R] Which "apply" function to use?

2009-09-14 Thread Masca, N.
Dear All, I have a problem which *should* be pretty straightforward to resolve - but I can't work out how! I have a list of 3 coefficient estimates for 4 different datasets: Coefs<-list(c(1,0.6,0.5),c(0.98,0.65,0.4),c(1.05,0.55,0.45),c(0.99,0.50,0.47)) All I want to do is take the sum (or mean

Re: [R] Which "apply" function to use?

2009-09-14 Thread Masca, N.
Excellent - the "as.data.frame" trick was just what I needed! Many thanks, Nick From: baptiste auguie [baptiste.aug...@googlemail.com] Sent: 14 September 2009 17:48 To: Masca, N. Cc: r-h...@stat.math.ethz.ch Subject: Re: [R] Which "apply&q

Re: [R] Problem in installation of "Rgraphviz" package

2009-06-14 Thread Takeshi N
Hi,there, I could install "Rgraphviz" in R version 2.6. I could not install this in R version 2.7 or 2.8. Please try in version2.6. ram basnet wrote: > > Dear R users, >   > I am not so used to this R software. I have to use the package " > Rgraphviz" but found some problem in the installatio

[R] extract species in a phylog tree

2008-09-24 Thread Christine N. Meynard
Hi, I am working with a phylog tree and I would like to extract a subset of the tree based on the species names (conserving the evolutionary distance and relationships between the pairs of species I am interested in). I see there is an option to select a subset of the tree using node names (phylog

[R] odfWeave error

2007-12-02 Thread Cleber N. Borges
hello all, I trying to use the package 'odfWeave' and I get the follow error: ### error message # ... Removing content.xml Post-processing the contents Error in .Call("RS_XML_Parse", file, handlers, as.logical(addContext), : E

[R] how to not sort factors when plotting

2008-05-01 Thread Lydia N. Slobodian
Hello, When making a graph, plot and boxplot automatically sort my factor levels (y axis) into alphabetical order. Is there a way to make it NOT do this? I've tried: sort.by="none", sorted=FALSE, sort=FALSE, reorder=FALSE. Thank you. __ R-help@r-pro

Re: [R] how to not sort factors when plotting

2008-05-12 Thread Lydia N. Slobodian
Hello. I'm trying find the ratios between each of the integers in a vector. I have: for (n in x) { ratio <- (x[n]/x[n-1]) ratio.all <- c(ratio.all, ratio) } Of course this doesn't work, nor does diff(n)/diff(n-1). Is there a way to specify a pair of integers in a ve

Re: [R] how to not sort factors when plotting

2008-05-12 Thread Lydia N. Slobodian
: > > > # Vector > x=rnorm(10,0,1) > > # Suggestion > new.ratio=function(x) x[2:length(x)]/x[1:(length(x)-1)] > > # My horrible function > my.ratio=function(x){ > > temp=NULL > for (n in 1:length(x)) temp=c(temp,x[n]/x[n-1]) > temp > } > >

[R] efficient writing of calculation involving each element of 2 data frames.

2008-02-22 Thread Vikas N Kumar
Hi I have 2 data.frames each of the same number of rows (approximately 3 or more entries). They also have the same number of columns, lets say 2. One column has the date, the other column has a double precision number. Let the column names be V1, V2. Now I want to calculate the correlation of

[R] Corrected : Efficient writing of calculation involving each element of 2 data frames

2008-02-22 Thread Vikas N Kumar
Hi I have 2 data.frames each of the same number of rows (approximately 3 or more entries). They also have the same number of columns, lets say 2. One column has the date, the other column has a double precision number. Let the column names be V1, V2. Now I want to calculate the correlation of

[R] there are fontencoding problem in Sweave

2009-04-16 Thread Угодай n/a
I want write article by russian language using Sweave. For cyrillic text LaTeX use T2A encoding \usepackage[T2A]{fontenc} But in Sweave.sty we find: \RequirePackage[T1]{fontenc} It is source of critical problem. For example Rnw file $ cat estimation.Rnw \documentclass[A4paper]{article} \us

Re: [R] there are fontencoding problem in Sweave

2009-04-17 Thread Угодай n/a
2009/4/17 Peter Dalgaard > Doesn't \usepackage[noae]{Sweave} do the trick? Sweave.sty has this > conditionalized. > > Yes, it is working. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mai

[R] how to sort data frame order by column?

2009-05-30 Thread Угодай n/a
I have a data frame, for exampe > dat <- data.frame(a=rnorm(5),b=rnorm(5),c=rnorm(5)) ab c 1 -0.1731141 0.002453991 0.1180976 2 1.2142024 -0.413897606 0.7617472 3 -0.9428484 -0.609312786 0.5132441 4 0.1343336 0.178208961 0.7509650 5 -0.1402286 -0.333476839 -

[R] configure encoding by default

2009-07-15 Thread Угодай n/a
I want using russian letters for my diagrams. I do it in this manner m <- "заголовок" Encode(m) <- "UTF-8" plot(1,1,main=m) But it is not convenient . How to configure R for using UTF-8 for all string, to work without Encode-function, as plot(1,1,main="заголовок") [[al

[R] binary digit

2009-07-24 Thread Угодай n/a
Does R has package for providing work for binary digit: arithmetic operation, convert to/from decimal digit, etc? I not found it, but think that CRAN contain it. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://

Re: [R] R project web site

2008-08-24 Thread George N. White III
Nor can I jump to the R homepage from the CRAN mirror. I had that yesterday (Saturday) afternoon in Nova Scotia, but it is working now (Sunday AM). -- George N. White III <[EMAIL PROTECTED]> __ R-help@r-project.org mailing list https://s

Re: [R] Ubuntu vs. Windows

2008-04-26 Thread George N. White III
n linux. 5. does the slow system exhibit a lot more disk activity? Sometimes this is hard to detect, but most systems do provide some statistics. Try running some I/O intensive benchmark at the same time your R job is running. -- George N. White III <[EMAIL PROTECTED]> ___

Re: [R] R 2.70 + ps2pdf14

2008-05-18 Thread George N. White III
, /ivo How are you viewing the files? Problems with evince using an old poppler version (such as you get with Fedora 8) were reported recently, and seem to have been fixed with the newer version of poppler used in debian unstable. -- George N. White III <[EMAIL PROTEC

Re: [R] Problems with installing the rgl package on Linux

2008-03-08 Thread George N. White III
dencies on commonly required -devel packages, but of course there will still be problems with packages that use uncommonly required libs. -- George N. White III <[EMAIL PROTECTED]> <[EMAIL PROTECTED]> __ R-help@r-project.org mailing list http