Re: [R] Finding distance matrix for categorical data

2010-06-13 Thread kapil mahant
Thanks Guys , I am able to generate the distance matrix for mixed column values ( categorical and ordinal ) using daisy function But can anyone tell me how to generate clusters out of it , The point being i dont know the number of cluster beforehand Let me give an overview of the problem i a

Re: [R] using latticeExtra plotting confidence intervals

2010-06-13 Thread Deepayan Sarkar
On Sun, Jun 13, 2010 at 10:10 AM, Joe P King wrote: > I am wanting to plot a 95% confidence band using segplot, yet I am wanting > to have groups. For example if I have males and females, and then I have > them in different races, I want the racial groups in different panels. I > have this minor c

[R] font path problem in Ubuntu

2010-06-13 Thread Tae-Hoon Chung
I am not exactly sure whether this is the right place to ask this but I hope this might be relevant to some other users of ubuntu linux as well. I've installed R-2.11.1 in my ubuntu 10.04 LTS. When I tried to generate a simple plot, however, it crashed: > plot(rnorm(100)) Error in axis(side = side

Re: [R] Multiple regressions

2010-06-13 Thread Steve Lianoglou
Hi, On Sun, Jun 13, 2010 at 8:30 PM, Amy Hessen wrote: > > Hi, > Could you please tell me whether SVM can do multiple regression or not? Yes, an SVM can. -steve -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical Colleg

[R] logistic regression with 50 varaibales

2010-06-13 Thread array chip
Hi, this is not R technical question per se. I know there are many excellent statisticians in this list, so here my questions: I have dataset with ~1800 observations and 50 independent variables, so there are about 35 samples per variable. Is it wise to build a stable multiple logistic model wit

[R] Multiple regressions

2010-06-13 Thread Amy Hessen
Hi, Could you please tell me whether SVM can do multiple regression or not? Cheers, Amy _ Browse profiles for FREE! Meet local singles online. [[alternative HTML version deleted]] ___

Re: [R] Count of unique factors within another factor

2010-06-13 Thread Dennis Murphy
Hi: Another possibility: as.data.frame(with(data[!duplicated(data), ], table(unit)) unit Freq 1 1233 2 3454 HTH, Dennis On Sun, Jun 13, 2010 at 9:07 AM, Birdnerd wrote: > > I have a data frame with two factors (sampling 'unit', 'species'). I want > to > calculate the number of uni

Re: [R] Get a list of installed commands

2010-06-13 Thread Data Monkey
Enrique, That's fantastic. Thanks for that1 I got a couple of warnings but for the most part it looks like it gives what I want. Cheers. On 14/06/2010, at 5:44 AM, Henrique Dallazuanna wrote: > Try this: > > sapply(installed.packages()[,1], function(x)try(ls(asNamespace(x > > On Sun, Jun

[R] Registration deadline, useR! 2010

2010-06-13 Thread Katharine Mullen
The final registration deadline for the R User Conference is June 20, 2010, one week away. Later registration will not be possible on site! Conference webpage: http://www.R-project.org/useR-2010 Conference program: http://www.R-project.org/useR-2010/program.html Registration: http://www.R-pro

Re: [R] Best way to remove double precision round off chaff

2010-06-13 Thread Bert Gunter
Jason: Many print methods have specific options to control this: ?print.default See also the "digits" and "scipen" settings in ?options for global control (these can be put in your startup file, for example). See also ?format and e.g. ?sprintf for more precise control of print format. All of th

[R] Best way to remove double precision round off chaff

2010-06-13 Thread Jason Rupert
I would like to get rid of the double precision round off chaff, so is the following the best way to handle it? > 0.625-0.8+0.45-0.275 [1] -5.551115e-17 > round(0.625-0.8+0.45-0.275, digits=4) [1] 0 Motivation for removing the chaff is for no other reason than to titty up the digits for displa

Re: [R] Standard error of regression coefficient

2010-06-13 Thread Erik Iverson
Josh B wrote: Hi all, This should be a very simple question for you, whereas it is proving devilish for me. How do I output the STANDARD ERROR of the regression coefficient (i.e., the standard error of b) from a simple linear regression? The first 'See Also' in ?lm is for ?summary.lm, whic

[R] Standard error of regression coefficient

2010-06-13 Thread Josh B
Hi all, This should be a very simple question for you, whereas it is proving devilish for me. How do I output the STANDARD ERROR of the regression coefficient (i.e., the standard error of b) from a simple linear regression? Consider this data, taken directly from ?lm: ctl <- c(4.17,5.58,5.18,

Re: [R] ERROR need finite 'ylim' values

2010-06-13 Thread Giuseppe
Peter Ehlers wrote: > > Giuseppe, > > See comments below. > > On 2010-06-13 10:24, David Winsemius wrote: >> >> >> Giuseppe wrote: >>> >>> Hello: >>> I use R with MAC >>> I have a simple data table, numeric and text columns, named dt. The >>> table >>> is imported through read.csv from a csv f

Re: [R] Count of unique factors within another factor

2010-06-13 Thread Charles C. Berry
On Sun, 13 Jun 2010, Birdnerd wrote: I have a data frame with two factors (sampling 'unit', 'species'). I want to calculate the number of unique 'species' per 'unit.' I can calculate the number of unique values for each variable separately, but can't get a count for each ‘unit’. If I underst

Re: [R] ERROR need finite 'ylim' values

2010-06-13 Thread David Winsemius
On Jun 13, 2010, at 3:49 PM, Peter Ehlers wrote: Giuseppe, See comments below. On 2010-06-13 10:24, David Winsemius wrote: Giuseppe wrote: Hello: I use R with MAC I have a simple data table, numeric and text columns, named dt. The table is imported through read.csv from a csv file. Ro

Re: [R] Get a list of installed commands

2010-06-13 Thread David Winsemius
On Jun 13, 2010, at 3:44 PM, Henrique Dallazuanna wrote: Try this: sapply(installed.packages()[,1], function(x)try(ls(asNamespace(x You could clean that up a bit with: funlist <- sapply(installed.packages()[,1], function(x)try(ls(asNamespace(x function.list <- fun.list[lapply(fu

Re: [R] Count of unique factors within another factor

2010-06-13 Thread jim holtman
You can also use the sqldf package: > x unit species 1 123ACMA 2 123LIDE 3 123LIDE 4 123SESE 5 123SESE 6 123SESE 7 345HEAR 8 345LOHI 9 345QUAG 10 345TODI > require(sqldf) > sqldf('select unit, count(distinct species) as count from x gro

Re: [R] ERROR need finite 'ylim' values

2010-06-13 Thread Peter Ehlers
Giuseppe, See comments below. On 2010-06-13 10:24, David Winsemius wrote: Giuseppe wrote: Hello: I use R with MAC I have a simple data table, numeric and text columns, named dt. The table is imported through read.csv from a csv file. Row numbers are automatically assigned, header is set to

Re: [R] Mid-P value for a chi-squared test

2010-06-13 Thread David Winsemius
On Jun 13, 2010, at 2:19 PM, (Ted Harding) wrote: On 13-Jun-10 17:12:45, David Winsemius wrote: On Jun 1, 2010, at 4:17 AM, Wilson, Andrew wrote: Can anyone tell me how to calculate a mid-p value for a chi-squared test in R? I cannot see that this has been answered. It has a date from 12 d

Re: [R] Get a list of installed commands

2010-06-13 Thread Henrique Dallazuanna
Try this: sapply(installed.packages()[,1], function(x)try(ls(asNamespace(x On Sun, Jun 13, 2010 at 9:30 AM, Data Monkey wrote: > Thanks Joris. Very helpful. > > I had thought of that, just curious to see if it was possible to get a > fresh list in R. > After reading your email I think perhap

Re: [R] losing line of mtext when saving to png format

2010-06-13 Thread John Kane
Oh, how embarrassing! I made the exact same mistake about 2-3 years ago. Thanks a lot. It was not even that important a graph but it was really bothering me. --- On Sun, 6/13/10, Joshua Wiley wrote: > From: Joshua Wiley > Subject: Re: [R] losing line of mtext when saving to png format >

Re: [R] losing line of mtext when saving to png format

2010-06-13 Thread Joshua Wiley
Hey John, I believe this issue is that the png device is different from the onscreen one. You set the margins for the on screen with a call to par() but not for the png(). The code below works for me. mydata <- data.frame(kel=c(13,253,263,273,283,292,303,313,323,333,573,853),

Re: [R] HOW to install RSQLite database

2010-06-13 Thread John Kane
select a cran mirror > Packages > Select Cran Mirror In R use the following command install.packages("RSQLite") --- On Sun, 6/13/10, vijaysheegi wrote: > From: vijaysheegi > Subject: Re: [R] HOW to install RSQLite database > To: r-help@r-project.org > Received: Sunday, June 13, 2010, 2:

Re: [R] Are any values in one list contained within a second list

2010-06-13 Thread Phil Spector
I think the simplest way is to translate the English directly :-) list1 = c('a','b','c','d','e','f','g') list2 = c('z','y','x','w','v','u','b') any(list2 %in% list1) [1] TRUE list2 = c('z','y','x','w','v','u','t') any(list2 %in% list1) [1] FALSE - Phil

[R] losing line of mtext when saving to png format

2010-06-13 Thread John Kane
I have a simple graph (oode below) which looks fine on the screen but when I save it in png format the title (actually the last mtext line) is cut off. I am pretty sure that I am doing something very stupid but other than playing around with the png height and width commands which don't seem to

Re: [R] Are any values in one list contained within a second list

2010-06-13 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of GL > Sent: Sunday, June 13, 2010 11:18 AM > To: r-help@r-project.org > Subject: [R] Are any values in one list contained within a second list > > > Silly question, but, can I te

Re: [R] Are any values in one list contained within a second list

2010-06-13 Thread Jorge Ivan Velez
Hi GL, Tr this: # example 1 list1 <- list(letters[1:7]) list1 list2 <- list(c('z','y','x','w','v','u','b')) list2 mapply(function(x, y) any(x %in% y), list1, list2) # example 2 list2 <- list(c('z','y','x','w','v','u','t')) list2 mapply(function(x, y) any(x %in% y), list1, list2) HTH,

Re: [R] Are any values in one list contained within a second list

2010-06-13 Thread David Winsemius
On Jun 13, 2010, at 2:17 PM, GL wrote: Silly question, but, can I test to see if any value of list a is contained in list b without doing a loop? A loop is easy enough, but wanted to see if there was a cleaner way. By way of example: List 1: a, b, c, d, e, f, g List 2: z, y, x, w, v, u,

Re: [R] Pairwise cross correlation from data set

2010-06-13 Thread David Winsemius
On Jun 13, 2010, at 1:47 PM, Claus O'Rourke wrote: Dear list, Following up on an earlier post, I would like to reorder a dataset and compute pairwise correlations. But I'm having some real problems getting this done. My data looks something like: Participant Stimulus Measurement p1

Re: [R] Mid-P value for a chi-squared test

2010-06-13 Thread Ted Harding
On 13-Jun-10 17:12:45, David Winsemius wrote: > On Jun 1, 2010, at 4:17 AM, Wilson, Andrew wrote: > >> Can anyone tell me how to calculate a mid-p value for a chi-squared >> test in R? > > I cannot see that this has been answered. It has a date from 12 days > ago but I cannot see a reply in t

[R] Are any values in one list contained within a second list

2010-06-13 Thread GL
Silly question, but, can I test to see if any value of list a is contained in list b without doing a loop? A loop is easy enough, but wanted to see if there was a cleaner way. By way of example: List 1: a, b, c, d, e, f, g List 2: z, y, x, w, v, u, b Return true, since both lists contain b Lis

Re: [R] Count of unique factors within another factor

2010-06-13 Thread Jorge Ivan Velez
Hi there, Try with(data, tapply(species, unit, function(x) length(unique(x HTH, Jorge On Sun, Jun 13, 2010 at 12:07 PM, Birdnerd <> wrote: > > I have a data frame with two factors (sampling 'unit', 'species'). I want > to > calculate the number of unique 'species' per 'unit.' I can calcul

Re: [R] Count of unique factors within another factor

2010-06-13 Thread Erik Iverson
I think ?tapply will help here. But *please* read the posting guide and provide minimal, reproducible examples! Birdnerd wrote: I have a data frame with two factors (sampling 'unit', 'species'). I want to calculate the number of unique 'species' per 'unit.' I can calculate the number of unique

Re: [R] ERROR need finite 'ylim' values

2010-06-13 Thread David Winsemius
Giuseppe wrote: > > Hello: > I use R with MAC > I have a simple data table, numeric and text columns, named dt. The table > is imported through read.csv from a csv file. Row numbers are > automatically assigned, header is set to TRUE. there are 599 rows and > several columns. > > I am trying to

[R] Count of unique factors within another factor

2010-06-13 Thread Birdnerd
I have a data frame with two factors (sampling 'unit', 'species'). I want to calculate the number of unique 'species' per 'unit.' I can calculate the number of unique values for each variable separately, but can't get a count for each ‘unit’. > data=read.csv("C:/Desktop/sr_sort_practice.csv") > a

Re: [R] add only selected labels using thigmophobe

2010-06-13 Thread David Winsemius
joerg wrote: > > I am trying to label data points within a scatter plot using thigmophobe. > While the data set consists of about 3000 points I only would like to > label a subset of these points. > > I read the x and y coordinates in from a txt file and define them as: > > MLPM1<-log2(Ra

[R] Pairwise cross correlation from data set

2010-06-13 Thread Claus O'Rourke
Dear list, Following up on an earlier post, I would like to reorder a dataset and compute pairwise correlations. But I'm having some real problems getting this done. My data looks something like: Participant Stimulus Measurement p1 s`15 p1 s`2

Re: [R] Finding an order for an hclust (dendrogram) object without intersections

2010-06-13 Thread Tal Galili
o.k, I found an example where my algorithm can't fix the tree order. But I don't know how to resolve it. Here is the code to reproduce the problem: # order.a.tree <- function(tree) { num.of.leafs <- length(tree$order) for(i in 1:(num.of.lea

Re: [R] Simulating a Poisson Process in R by calling C Code over .Call

2010-06-13 Thread Thomas Lumley
On Sun, 13 Jun 2010, Fabian Zäpernick wrote: Hi I want to write a C function for the R Code below and call it with .Call: SimPoisson <- function(lambda,tgrid,T2M) #Simulation eines Poissonprozesses return(list(NT=NT,Ni=Ni,tau=tau)) } I read the manual "writing R extensions" over an

Re: [R] Mid-P value for a chi-squared test

2010-06-13 Thread David Winsemius
On Jun 1, 2010, at 4:17 AM, Wilson, Andrew wrote: Can anyone tell me how to calculate a mid-p value for a chi-squared test in R? I cannot see that this has been answered. It has a date from 12 days ago but I cannot see a reply in the archives. So, what is a "mid-p value" and which "chi-

Re: [R] Finding an order for an hclust (dendrogram) object without intersections

2010-06-13 Thread Tal Galili
Thanks Charles. In the meantime, I found out the following code does the trick. But I am wondering if: 1) I might have made a mistake in it somewhere 2) If there are other (smarter) ways of going about this. Here is the solution I wrote: # - order.a.tre

Re: [R] Finding an order for an hclust (dendrogram) object without intersections

2010-06-13 Thread Charles C. Berry
On Sun, 13 Jun 2010, Tal Galili wrote: Hello all, I manually created an hclust object. Now I am looking to reorder the leafs so they won't intersect with each other, and would be happy for advises on how to do that. Have a look at the code for hclust(). If you can instead create an object l

[R] add only selected labels using thigmophobe

2010-06-13 Thread joerg
hi, I am trying to label data points within a scatter plot using thigmophobe. While the data set consists of about 3000 points I only would like to label a subset of these points. I read the x and y coordinates in from a txt file and define them as: MLPM1<-log2(Ratio.M.L.G2.PM) HLG2<-log2(R

[R] Finding an order for an hclust (dendrogram) object without intersections

2010-06-13 Thread Tal Galili
Hello all, I manually created an hclust object. Now I am looking to reorder the leafs so they won't intersect with each other, and would be happy for advises on how to do that. Here is an example code: #- a <- list() # initialize empty object # define mergin

Re: [R] Boxplot intervals combining names

2010-06-13 Thread Sarah Goslee
Hi Ross, You are indeed missing something simple. If there are 60 bars, the axis runs from 1 to 60, and you want a label at every second one, rather than at every one. Like this (with 10 instead of 60): testdata <- matrix(runif(100), ncol=10) boxplot(testdata, xaxt="n") axis(1, at=seq(1.5, 9.5,

Re: [R] Clustering algorithms don't find obvious clusters

2010-06-13 Thread Joris Meys
Henrik, the methods you use are NOT applicable to directed graphs, in the contrary even. They will split up what you want to put together. In your data, an author never cites himself. Hence, A and B are far more different than B and D according to the techniques you use. Please check out Etiennes

[R] Boxplot intervals combining names

2010-06-13 Thread RCulloch
Hi R users, This seems like a simple problem but I have searched nabble for the answer and can't seem to find it. All I want to do is produce a boxplot where I have two boxes for one Individual but on the xaxis I only have one tick mark centred between the boxes so I can add the Individuals' na

[R] Simulating a Poisson Process in R by calling C Code over .Call

2010-06-13 Thread Fabian Zäpernick
Hi I want to write a C function for the R Code below and call it with .Call: SimPoisson <- function(lambda,tgrid,T2M) #Simulation eines Poissonprozesses { NT <- 0 Ni <- rep(0,length(tgrid)) tau <- 0 sign <- 0 if(lambda != 0) { i=1

[R] ERROR need finite 'ylim' values

2010-06-13 Thread Giuseppe
Hello: I use R with MAC I have a simple data table, numeric and text columns, named dt. The table is imported through read.csv from a csv file. Row numbers are automatically assigned, header is set to TRUE. there are 599 rows and several columns. I am trying to plot using the stripchart command:

Re: [R] Can one get a list of recommended packages?

2010-06-13 Thread Uwe Ligges
On 13.06.2010 01:09, Dr. David Kirkby wrote: On 06/12/10 05:27 PM, Douglas Bates wrote: On Sat, Jun 12, 2010 at 8:37 AM, Dr. David Kirkby wrote: R 2.10.1 is used in the Sage maths project. Several recommended packages (Matrix, class, mgcv, nnet, rpart, spatial, and survival) are failing to b

Re: [R] How to output text to sink from data frame line by line without column names

2010-06-13 Thread Joris Meys
col1<-c(2,45,67) col2<-c("a","B","C") col3<-c(234,44,566) mydf<-as.data.frame(cbind(col1,col2,col3),stringsAsFactors=F) n<-ncol(mydf) nr<-nrow(mydf) #sink("test.txt") cat("I will be including text of various sorts in this file so cannot use print table or similar command") for (i in 1:n){ cat(coln

Re: [R] setting the current working directory to the location of the source file

2010-06-13 Thread Gabor Grothendieck
On Thu, Jun 10, 2010 at 8:33 PM, Marcin Gomulka wrote: > AFAIK a script run through source() does not have any legit way to learn > about it's own location. > > I need this to make sure that the script will find its datafiles after I > move the whole directory. (The datafiles are in the same direc

Re: [R] setting the current working directory to the location of the source file

2010-06-13 Thread Marcin Gomulka
On Fri, Jun 11, 2010 at 11:30 AM, Henrik Bengtsson wrote: > Isn't this what source(..., chdir=TRUE) is for? See help(source). > > not really. Imagine you give someone a script, but you have no control over where and how they run it. They shouldn't be required to put in the chdir parameter. Say,

Re: [R] setting the current working directory to the location of the source file

2010-06-13 Thread Marcin Gomulka
Charles' hint was what I was looking for. Thanks! mg. On Fri, Jun 11, 2010 at 7:40 AM, Charles C. Berry wrote: > > > cat("print(eval(sys.calls()[[1]][[2]]))",file='test.R') >> > >> >> > See > >?sys.calls > > [[alternative HTML version deleted]] __

Re: [R] Get a list of installed commands

2010-06-13 Thread Data Monkey
Thanks Joris. Very helpful. I had thought of that, just curious to see if it was possible to get a fresh list in R. After reading your email I think perhaps my wording was a bit loose. I meant commands in the pre-installed packages. So basically, "out of the box" what commands will R recognize.

Re: [R] Get a list of installed commands

2010-06-13 Thread Gabor Grothendieck
On Sun, Jun 13, 2010 at 3:31 AM, Data Monkey wrote: > I'm pretty new to R, but have experience with other languages, both OO and > scripting. > > I'm trying to add support for R to my text editor of choice and to do this I > need a list of installed commands I can markup with XML. > I'd then sim

Re: [R] Scope and sapply

2010-06-13 Thread Gabor Grothendieck
On Sat, Jun 12, 2010 at 11:40 PM, Worik R wrote: > I was careless. > > Here is a better example of what I am trying to.  With the '<<-' you > offered. > > ?<<- > > That was exactly what I needed, thankyou. > Just as an aside I am assuming these are just examples to illustrate scope. In reality y

Re: [R] Get a list of installed commands

2010-06-13 Thread Joris Meys
Hi, Take a look at any of the R-editors, like Tinn-R, Emacs-ESS, Eclipse with StatET,... They contain lists you can use. Also the listings package of LaTeX contains a wordlist for R. Getting all installed commands out of R is not doable with a single command as far as I know. R works completely d

Re: [R] Break in the y-axis

2010-06-13 Thread Jim Lemon
On 06/13/2010 01:48 PM, beloitstudent wrote: Hello all, I have been having trouble getting a break in my y-axis. All of my data points are up around 100-200, but the graph has to start at zero, so i would like to remove all the white space using a break symbol. I have been able to get the bre

Re: [R] Scope and sapply

2010-06-13 Thread Berend Hasselman
Worik R wrote: > > ... > > N <- 10 > ## x simulate a return series > x <- runif(N)-.5 > > ## Build an array of cumulative returns of a portfolio starting with $1 as > it changes over time > y <- rep(0, length(x)) > y[1] <- 1+1*x[1] > for(i in 2:N){ > y[i] <- y[i-1]+y[i-1]*x[i] > } > > ## y

[R] How to write a customized hclust algorithm in R?

2010-06-13 Thread Tal Galili
Hello dear R-help mailing list members, I wish to create an hclust object which will be based on a customized hierarchical clustering algorithm, programmed in R. After looking into the hclust function, I noticed that the algorithms themselves are implemented in Fortran. In order for me to implem

[R] Get a list of installed commands

2010-06-13 Thread Data Monkey
I'm pretty new to R, but have experience with other languages, both OO and scripting. I'm trying to add support for R to my text editor of choice and to do this I need a list of installed commands I can markup with XML. I'd then simply feed in the marked up list into my text editor's library and

Re: [R] calling a function with new inputs every 1 minute

2010-06-13 Thread schuster
How about Sys.sleep(60) in a loop from 1 to 500? ?Sys.sleep On Saturday 12 June 2010 08:45:32 pm KstuS wrote: > I have inputs to a function which are changing all the time - I pull these > values from the internet. I then apply a function to the values. What I'd > like to do is automate the