[R] Performance of graph and igraph package

2011-02-04 Thread William Tu
Dear R users, I'm using graph library to create a mesh-like network topology and implement a load balance routing algorithm. The current implementation uses graph, RBGL, and Rgraphviz libraries. I have a few attributes on every edge to represent the network loading and capacity, and I frequently u

Re: [R] uniroot

2011-02-04 Thread Petr Savicky
On Fri, Feb 04, 2011 at 04:35:00AM -0800, dpender wrote: > > Hi, > > I am using the uniroot function in order to carry out a bivariate Monte > Carlo simulation using the logistics model. > > I have defined the function as: > > BV.FV <- function(x,y,a,A) > (((x^(-a^-1)+y^(-a^-1))^(a-1))*(y^(a-1/

Re: [R] Help!!! from R beginner

2011-02-04 Thread jim holtman
You should be able to use 'ifelse' Os.chr4.gene.new$color <- ifelse(Os.chr4.gene.new$if_TE_related == "TE_related", "black", "orange") On Fri, Feb 4, 2011 at 7:09 PM, Tae-Jin Lee wrote: > Hello, > > I'm trying to add a column to the following data frame. The new column > will contain "blac

[R] Fwd: Help!!! from R beginner

2011-02-04 Thread Tae-Jin Lee
Sorry. I made a typo. It is the 5th column (not 4th). Thank you. Tae-Jin Begin forwarded message: > From: Tae-Jin Lee > Date: February 4, 2011 7:09:38 PM EST > To: r-help@R-project.org > Subject: Help!!! from R beginner > > Hello, > > I'm trying to add a column to the following data frame. The

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread Hugo Mildenberger
Danny, sounds like you already have a certain idea how a 'nugget' distribution could look like. Maybe you also could intentionally produce some experimental data having such distributions, harvest the related patterns from the microarray and then apply a method as it was described in http://ww

[R] Help!!! from R beginner

2011-02-04 Thread Tae-Jin Lee
Hello, I'm trying to add a column to the following data frame. The new column will contain "black" when the 5th column(if_TE_related) is "TE_related", or "orange" when the 4th column is " " (space). "chromo""MSU_locus" "end5" "end3" "if_TE_related" "chr04" "LOC_Os04g01006"

[R] different results in MASS's mca and SAS's corresp

2011-02-04 Thread Gong-Yi Liao
Dear list: I have tried MASS's mca function and SAS's PROC corresp on the farms data (included in MASS, also used as mca's example), the results are different: R: mca(farms)$rs: 1 2 1 0.059296637 0.0455871427 2 0.043077902 -0.0354728795 3 0.059834286

Re: [R] aggregate function - na.action

2011-02-04 Thread Gene Leynes
Ista, Thank you again. I had figured that out... and was crafting another message when you replied. The NAs do come though on the variable that is being aggregated, However, they do not come through on the categorical variable(s). The aggregate function must be converting the data frame variabl

Re: [R] aggregate function - na.action

2011-02-04 Thread Gene Leynes
Just to be clear: This works: > set.seed(100) > dat=data.frame( + x1=sample(c(NA,'m','f'), 100, replace=TRUE), + x2=sample(c(NA, 1:10), 100, replace=TRUE), + x3=sample(c(NA,letters[1:5]), 100, replace=TRUE), + x4=sample(c(NA,T,F), 100, replace=TRUE), + y=sam

[R] [OT] BLUE vs. BLUP

2011-02-04 Thread Laura Smith
Hi! Does anyone have a numeric example for calculating BLUE and BLUP, please? Thanks, Laura [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

Re: [R] aggregate function - na.action

2011-02-04 Thread Ista Zahn
oops. For clarity, that should have been sum(ddply(dat, .(x1,x2,x3,x4), function(x){data.frame(y.sum=sum(x$y, na.rm=TRUE))})$y.sum) -Ista On Fri, Feb 4, 2011 at 7:52 PM, Ista Zahn wrote: > Hi again, > > On Fri, Feb 4, 2011 at 7:18 PM, Gene Leynes wrote: >> Ista, >> >> Thank you again. >> >> I

Re: [R] aggregate function - na.action

2011-02-04 Thread Ista Zahn
Hi again, On Fri, Feb 4, 2011 at 7:18 PM, Gene Leynes wrote: > Ista, > > Thank you again. > > I had figured that out... and was crafting another message when you replied. > > The NAs do come though on the variable that is being aggregated, > However, they do not come through on the categorical va

Re: [R] Quadratic regression: estimating the maximizing value

2011-02-04 Thread Greg Snow
No, your approach is not correct. For one you have not taken the covariance between B and C into account, another thing is that the ratio of 2 normal random variables is not necessarily normal, in some cases it can even follow a Cauchy distribution. Also note that with only 1 degree of freedom

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread Greg Snow
Have you looked into bioconductor? There is a separate mailing list and many packages designed for genetic analysis within the bioconductor project. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- >

Re: [R] aggregate function - na.action

2011-02-04 Thread Ista Zahn
Hi, On Fri, Feb 4, 2011 at 6:33 PM, Gene Leynes wrote: > Thank you both for the thoughtful (and funny) replies. > > I agree with both of you that sum is the one picking up aggregate.  Although > I didn't mention it, I did realize that in the first place. > Also, thank you Phil for pointing out th

Re: [R] rbinom and probability

2011-02-04 Thread David Winsemius
On Feb 4, 2011, at 4:24 PM, Mcmahon, Kwyatt wrote: Hello compadRes, I'm developing a script that selects "cells" over a certain metabolic rate to kill them. A rate between 9 and 12 means that the cells are candidates for death. I'll show you what I mean: # a would be a vector of cell m

Re: [R] problem barplot width

2011-02-04 Thread Ista Zahn
Hi Mario, >From the help file for barplot: "Specifying a single value will have no visible effect unless 'xlim' is specified." OK, so: barplot(d,col=barcol,ylim=c(min(d-s*1.25),max(d+s*1.25)), xlim=c(0,1), width=.1, space = 2) Best, Ista On Fri, Feb 4, 2011 at 4:15 PM, Mario Beolco wrote: > De

Re: [R] aggregate function - na.action

2011-02-04 Thread Gene Leynes
Thank you both for the thoughtful (and funny) replies. I agree with both of you that sum is the one picking up aggregate. Although I didn't mention it, I did realize that in the first place. Also, thank you Phil for pointing out that aggregate only accepts a formula value in more recent versions!

[R] Quadratic regression: estimating the maximizing value

2011-02-04 Thread gheine
A bioligist colleague sent me the following data. x Y 3 1 7 5 148 240 (Yes, only four data points.) I don't know much about the application, but apparently there are good empirical reasons to use a quadratic model. The goal is to find the X value which maximizes the respons

[R] problem barplot width

2011-02-04 Thread Mario Beolco
Dear R-users, apologies for the total beginner's question, but I have been trying to solve this problem for ages and I seem to be getting nowhere. I also have tried to search through the archives of the R mailing list, but I am still left with my problem. How do I change the width of the bars for

[R] rbinom and probability

2011-02-04 Thread Mcmahon, Kwyatt
Hello compadRes, I'm developing a script that selects "cells" over a certain metabolic rate to kill them. A rate between 9 and 12 means that the cells are candidates for death. I'll show you what I mean: # a would be a vector of cell metabolic rates. a<-c(8, 7, 9, 6, 10, 11, 4, 5, 6) #now id

Re: [R] Where does R look for library packages - there is no package called 'BRugs'

2011-02-04 Thread conor1725
I created a file called .Renviron and set R_LIBS_USER to the same path I had set R_LIBS to. I put this file in C:/Users/myusername/Documents/mysubdirectory. I also commented out the line I had put in the Renviron.site file. Now I get the same error as I originally got. When I put .Renvrion in C:/U

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread DB1984
Greg, Dennis - thanks for your input, I really appreciate the feedback, as it is not easy to source. In terms of the data; I've described it as 20 columns, which is the smallest dataset, but this can run to 320 columns, so in some cases there is likely to be enough power to detect non-normality.

Re: [R] aggregate function - na.action

2011-02-04 Thread Ista Zahn
Sorry, I didn't see Phil's reply, which is better than mine anyway. -Ista On Fri, Feb 4, 2011 at 5:16 PM, Ista Zahn wrote: > Hi, > > Please see ?na.action > > (just kidding!) > > So it seems to me the problem is that you are passing na.rm to the sum > function. So there is no missing data for th

Re: [R] aggregate function - na.action

2011-02-04 Thread Ista Zahn
Hi, Please see ?na.action (just kidding!) So it seems to me the problem is that you are passing na.rm to the sum function. So there is no missing data for the na.action argument to operate on! Compare sum(aggregate(y~x1+x2+x3+x4, data=dat, sum, na.action=na.fail)$y) sum(aggregate(y~x1+x2+x3+x4

Re: [R] aggregate function - na.action

2011-02-04 Thread Phil Spector
Gene - Let me try to address your concerns one at a time: Since the formula interface to aggregate was introduced pretty recently (I think R-2.11.1, but I might be wrong) so when you try to use it in an R-2.10.1 it won't work. Now let's take a close look at the help page for aggregate. The

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread Dennis Murphy
Hi: The problem you have, IMO, is the multiplicity of tests and the p-value adjustments that need to be made for them. Here's a little simulation using normal and exponential distributions of the size you're contemplating. # Normal data d <- matrix(rnorm(40), nrow = 2) # Function to compu

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread Greg Snow
It is fine, you just overthought the solution and used both the applys and for loops (see another thread today where I made the same mistake of overthinking and combining 2 different methods). I was just pointing out the errors so you could improve for next time. But here is some things to thi

Re: [R] exact logistic regression

2011-02-04 Thread Łukasz Ręcławowicz
data2elrm<-cbind(mydata,n=rep(1,dim(mydata)[1])) > More logic would be: data2elrm2<-cbind(mydata,n=rep(1,nrow(mydata))) Sorry for obfuscation. -- Mi³ego dnia [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://

Re: [R] exact logistic regression

2011-02-04 Thread Łukasz Ręcławowicz
2011/2/4 Den > To use elrm() I have to aggregate my data,which is really time consuming > when I look for the way out through many variables. You don't have to do that. *One exception is that the binomial response should be specified as success/trials, where success gives the number of successes

Re: [R] how to learn more from R

2011-02-04 Thread Gene Leynes
Search the help archive and you'll find dozens of suggestions about beginner manuals You can search the archive at nabble.com or markmail.com http://r-project.markmail.org/ http://r.789695.n4.nabble.com/R-help-f789696.html (I don't know why the nabble URL is so complicated) For seeing R examples

[R] aggregate function - na.action

2011-02-04 Thread Gene Leynes
Can someone please tell me what is up with na.action in aggregate? My (somewhat) reproducible example: (I say somewhat because some lines wouldn't run in a separate session, more below) set.seed(100) dat=data.frame( x1=sample(c(NA,'m','f'), 100, replace=TRUE), x2=sample(c(NA, 1:10

Re: [R] lapply, strsplit, and list elements

2011-02-04 Thread Greg Snow
Darn, Good catch, I fell victim to overthinking the problem. I think I was more thinking of: '[0-9]+(?=/)' Which uses the whole match (then I switched thinking and captured the number, but did not simplify the other part). Yours is the best. -- Gregory (Greg) L. Snow Ph.D. Statistical Data C

Re: [R] Changing the direction of axis labels on a plot

2011-02-04 Thread Uwe Ligges
On 04.02.2011 01:42, Longe wrote: On 02/03/2011 01:57 PM, Peter Alspach wrote: Tena koe ?par and check the las argument. HTH Peter Alspach Thank you, Peter, and also David and William. The las argument indeed helps in setting the tick labels horizontally. Beautiful! But how do I rot

Re: [R] Avoiding two loops

2011-02-04 Thread Petr Savicky
On Fri, Feb 04, 2011 at 02:03:22PM -0500, sudhir cr wrote: > Hello, > > I have a R code for doing convolution of two functions: > > convolveSlow <- function(x, y) { > nx <- length(x); ny <- length(y) > xy <- numeric(nx + ny - 1) > for(i in seq(length = nx)) { > xi <- x[[i]] >

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread DB1984
Thanks Peter. I understand your point, and that there is potentially a high false discovery rate - but I'd expect the interesting data points (genes on a microarray) to be within that list too. The next step would be to filter based on some greater understanding of the biology... Alternative ap

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread DB1984
Yes, that was dumb - I got that... -- View this message in context: http://r.789695.n4.nabble.com/Finding-non-normal-distributions-per-row-of-data-frame-tp3259439p3260843.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-projec

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread Peter Ehlers
On 2011-02-04 11:00, DB1984 wrote: Hi Greg, In addition to the reply above, to address your questions - I fully appreciate that my understanding of the code is basic - this is my first attempt at putting this together... My starting point is a data frame with numeric and text columns, but I ca

Re: [R] lapply, strsplit, and list elements

2011-02-04 Thread Gabor Grothendieck
On Fri, Feb 4, 2011 at 1:27 PM, Greg Snow wrote: > Try this: > >> x <- c("349/077,349/074,349/100,349/117", > +          "340/384.2,340/513,367/139,455/128,D13/168", > +          "600/437,128/903,128/904") >> >> library(gsubfn) >> out <- strapply(x, '([0-9]+)(?=/)') >> out > [[1]] > [1] "349" "349

[R] GWAF package: lme.batch.imputed(): object 'kmat' not found

2011-02-04 Thread Jim Moon
Hello, All, GWAF 1.2 R.Version() is below. system(lme.batch.imputed( phenfile = 'phenfile.csv', genfile = 'CARe_imputed_release.0.fhsR.gz', pedfile='pedfile.csv', phen='phen1', covar=c('covar1','covar2'), kinmat='imputed_fhs.kinship.RData', outfile='imputed.FHS.IBC.GWAF.LME.output.0.txt' )) Give

Re: [R] Avoiding two loops

2011-02-04 Thread Dirk Eddelbuettel
On 4 February 2011 at 14:03, sudhir cr wrote: | Hello, | | I have a R code for doing convolution of two functions: | | convolveSlow <- function(x, y) { | nx <- length(x); ny <- length(y) | xy <- numeric(nx + ny - 1) | for(i in seq(length = nx)) { | xi <- x[[i]] | for(

[R] Avoiding two loops

2011-02-04 Thread sudhir cr
Hello, I have a R code for doing convolution of two functions: convolveSlow <- function(x, y) { nx <- length(x); ny <- length(y) xy <- numeric(nx + ny - 1) for(i in seq(length = nx)) { xi <- x[[i]] for(j in seq(length = ny)) { ij <- i+j-1 xy[[ij

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread DB1984
Hi Greg, In addition to the reply above, to address your questions - I fully appreciate that my understanding of the code is basic - this is my first attempt at putting this together... My starting point is a data frame with numeric and text columns, but I can cut columns to make a fully numeric

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread David Winsemius
On Feb 4, 2011, at 1:41 PM, DB1984 wrote: Thanks David - but '1' (if I understood correctly) returns the same value for each row, which I took to be an error. And exactly what were you expecting with that data? nt V1V2V3V4V5V6 1 24.71 23.56 24.71 23.56 24.71 23.

Re: [R] lapply, strsplit, and list elements

2011-02-04 Thread Henrique Dallazuanna
Try this: strsplit(x, "/\\d+\\.\\d+,|/\\d+,|/\\d+") On Fri, Feb 4, 2011 at 1:37 PM, Dick Harray wrote: > Hi there, > > I have a problem about lapply, strsplit, and accessing list elements, > which I don't understand or cannot solve: > > I have e.g. a character vector with three elements: > > x

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread DB1984
Thanks David - but '1' (if I understood correctly) returns the same value for each row, which I took to be an error. nt V1V2V3V4V5V6 1 24.71 23.56 24.71 23.56 24.71 23.56 2 25.64 25.06 25.64 25.06 25.64 25.06 3 21.29 20.87 21.29 20.87 21.29 20.87 4 25.92 26.92 25.92 26.92

[R] switching y-axis to x-axis for qqmath

2011-02-04 Thread Anderson, Chris
This is the qqmath example from the lattice package. I added the scales to the example. I would like to switch the axis and not sure how? Meaning I would like the "height" on the x-axis and the probability on the y-axis. Will you show me the correct syntax for this switch thanks. qqmath(~ hei

Re: [R] Apply parameters to a function from a list

2011-02-04 Thread Florian Burkart
Of course. Thanks. On 04/02/2011 18:32, Greg Snow wrote: Try: do.call(test,point) __ 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 pro

Re: [R] Apply parameters to a function from a list

2011-02-04 Thread Greg Snow
Try: > do.call(test,point) -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Florian Burkart > Sent: Friday, F

Re: [R] lapply, strsplit, and list elements

2011-02-04 Thread Greg Snow
Try this: > x <- c("349/077,349/074,349/100,349/117", + "340/384.2,340/513,367/139,455/128,D13/168", + "600/437,128/903,128/904") > > library(gsubfn) > out <- strapply(x, '([0-9]+)(?=/)') > out [[1]] [1] "349" "349" "349" "349" [[2]] [1] "340" "340" "367" "455" "13" [[3]] [1]

Re: [R] dataframes from a function

2011-02-04 Thread Phil Spector
Chris - You can solve your problem by removing the print statements and replacing them with answer = list(org.plot[org.plot$sub %in% ex.plot,], new.pl[new.pl$yar %in% "1991",], new.pl[new.pl$yar %in% "1993",]) prefix = sub('-','.',ex.plot) names(answer) = paste(pr

Re: [R] Apply parameters to a function from a list

2011-02-04 Thread Henrique Dallazuanna
Try this: do.call(test, point) On Fri, Feb 4, 2011 at 12:35 PM, Florian Burkart wrote: > Hey, > > this may be a simple question, but I am struggling to apply a list of > parameters to a function. > > > Say I have the following function: > > test<-function(a=1,b=2,c=3,d=4){a+b+c+d} > > And the f

[R] spatial autocorrelation for data that are temporally pseudoreplicated

2011-02-04 Thread Gagic, Vasna
Dear all, I collected my data from the different agricultural fields every week over a period of a month. how can I test for spatial autocorrelation in R with data that are temporally pseudoreplicated? I used lme with correlation=corCompSymm(form=~Date) to model temporal pseudoreplication. Reg

[R] Suppress only Z axis tick marks and numbers in wireframe statement

2011-02-04 Thread Matthew A. H. Walters
I actually have several questions revolving around the generation of wireframe plots. The most pressing is that which is described by the subject line. I am trying to produce a figure with x, y, and z labels, but only tick marks on the x, and y axes. I have supplied sample code below subst

Re: [R] always about positive definite matrix

2011-02-04 Thread Mike Miller
(Apologies to the cc-list: I'm resending from a different address because I didn't realize it was going to r-help.) I'm also not an expert on this topic. I just wanted to list a couple of ways that non-PD matrices might arise. I'll just add now a couple of pointers: First, I believe the te

Re: [R] always about positive definite matrix

2011-02-04 Thread Spencer Graves
1. Martin Maechler's comments should be taken as replacements for anything I wrote where appropriate. Any apparent conflict is a result of his superior knowledge. 2. 'eigen' returns the eigenvalue decomposition assuming the matrix is symmetric, ignoring anything in m[upper.tri(

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread David Winsemius
On Feb 4, 2011, at 10:48 AM, DB1984 wrote: Thanks for the feedback Patrizio - but your function is performing the shapiro.test on columns instead of rows... I tried: nt<-data.frame(#a dataframe with 6 columns and 9 rows) nr <- nrow(nt) test <- apply(nt, nt[1:nr,], shapiro.test) Error in d

Re: [R] always about positive definite matrix

2011-02-04 Thread spencerg
1. Martin Maechler's comments should be taken as replacements for anything I wrote where appropriate. Any apparent conflict is a result of his superior knowledge. 2. 'eigen' returns the eigenvalue decomposition assuming the matrix is symmetric, ignoring anything in m[upper.tri(

Re: [R] pass nrow(x) to dots in function(x){plot(x,...)}

2011-02-04 Thread rex.dwyer
Hi Marianne, The quick-and-dirty solution is to add one character and make ns global: ns <<- nrow(x) Poor practice, but OK temporarily if you're just debugging. This is an issue of "scope". You are assuming dynamic scope, whereas R uses static scope. 'ns' was not defined when you said paste("n=

Re: [R] get caller's name

2011-02-04 Thread Luke Tierney
The options showWarnCalls and showErrorCalls may also help -- they can be use do enable automatic printing of a call stack summary. From ?options: ‘showWarnCalls’, ‘showErrorCalls’: a logical. Should warning and error messages show a summary of the call stack? By default

Re: [R] always about positive definite matrix

2011-02-04 Thread Mike Miller
I'm also not an expert on this topic. I just wanted to list a couple of ways that non-PD matrices might arise. I'll just add now a couple of pointers: First, I believe the term "semipositive definite" is considered ambiguous because in some literature it means that the matrix the smallest e

[R] exact logistic regression

2011-02-04 Thread Den
Hate to say that, but it looks like Stata is way above R, considering exact logistic regression. To use elrm() I have to aggregate my data,which is really time consuming when I look for the way out through many variables. But the worst thing is that I am not not sure if I can trust to p-values in

[R] MSBVAR and hc.forecast

2011-02-04 Thread david ostrowski
attempting to do multivariate modelling in R with known future conditions (in this case variable 'b') using MSBVAR and hc.forecast. The sample code (a paired down representation) does not give anywhere near the expected results - I am assuming that a forecast 8 steps out would approximate 'a' as th

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread DB1984
Thanks for the feedback Patrizio - but your function is performing the shapiro.test on columns instead of rows... I tried: nt<-data.frame(#a dataframe with 6 columns and 9 rows) nr <- nrow(nt) test <- apply(nt, nt[1:nr,], shapiro.test) Error in ds[-MARGIN] : invalid subscript type 'list' fr

Re: [R] Applying multiple functions to one object

2011-02-04 Thread Den
'Aggregate multiple functions into a single function. Combine multiple functions to a single function returning a named vector of outputs' This is a short description of each() function from plyr package Here is an example from help each(min, max)(1:10) Hope this helps Regards Denis У Пят

[R] RODBC : how to avoid truncatig big integer when using sqlsave

2011-02-04 Thread PtitBleu
Hello, I'm still trying to modify my script in order to use RODBC instead of RMySQL (no more ready-to-use package for windows). My new problem is the following one (not seen with RMySQL): I'd like to copy a data.frame to a mysql table. One column is a numeric one with big integer like : 2005000

[R] Apply parameters to a function from a list

2011-02-04 Thread Florian Burkart
Hey, this may be a simple question, but I am struggling to apply a list of parameters to a function. Say I have the following function: test<-function(a=1,b=2,c=3,d=4){a+b+c+d} And the following list: point<-list(a=3,d=2) Is there a way I can evaluate function test at point? (Apart fro

Re: [R] exact logistic regression

2011-02-04 Thread Denis Kazakiewicz
Dear Łukasz Thank you very much for information Dear R people could you please help please with following questions Sorry for my silly questions, because I am not a mathematician. 1. Is elrm() works similar as exact regression in SAS or Stata? After double check in Stata and R some results from m

[R] dataframes from a function

2011-02-04 Thread chris20
Hi, I'm trying to create a function to return three dataframes for later use in a graphic so I want the return from the function to give me dataframes and with unique names relating to the variable they are based on. For example. sub<-c("6-1a","6-1a","6-1a","9-2b","9-2b","9-2b","7c","7c","7c"

Re: [R] recode according to specific sequence of characters within a string variable

2011-02-04 Thread Greg Snow
You can do this with regular expressions, since you want to extract specific values from the string I would suggest learning about the gsubfn package, it is a bit easier with gsubfn than with the other matching tools. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healt

Re: [R] recode according to specific sequence of characters within a string variable

2011-02-04 Thread Greg Snow
So you want to combine multiple columns back into a single column with the strings pasted together? If that is correct then look at the paste and sprintf functions (use one or the other, not both). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail

Re: [R] How to get the variables used in stepwise logistic regression?

2011-02-04 Thread Soyeon Kim
Thank you. This is what I want. I need to study about attr :). Soyeon On Fri, Feb 4, 2011 at 11:07 AM, David Winsemius wrote: > > On Feb 4, 2011, at 11:56 AM, Soyeon Kim wrote: > >> Dear All, >> >> I used glm and then used step function for stepwise regression. >> Now, I want to store the variab

Re: [R] How to get the variables used in stepwise logistic regression?

2011-02-04 Thread David Winsemius
On Feb 4, 2011, at 11:56 AM, Soyeon Kim wrote: Dear All, I used glm and then used step function for stepwise regression. Now, I want to store the variables used in the stepwise regression. I am not sure that what you ask here is actually what you eventually ask and will limit my answer to

[R] How to get the variables used in stepwise logistic regression?

2011-02-04 Thread Soyeon Kim
Dear All, I used glm and then used step function for stepwise regression. Now, I want to store the variables used in the stepwise regression. The code is the following. m_logistic <- glm(y ~ . + M1:T + M2:T + M3:T+ M4:T +M5:T, family=binomial("logit"), data = data) step_glm <- step(m_logistic

Re: [R] Finding non-normal distributions per row of data frame?

2011-02-04 Thread Greg Snow
I get a different set of errors than you do (what version of R are you using?). Patrizio showed one way to do what you want. But, what is it that you are really trying to accomplish? What do you think the result of 20,000 normality tests (each of which may not be answering the real question on

[R] (no subject)

2011-02-04 Thread Yan Jiao
Dear R users? I want to know how to use strata in survival analysis, I want to combine multiple dataset: Coxph(Surv(merged.time.v, merged.event.v)~merged.score+ strata(dataset.v)) So merged.time.v and merged.event.v are from multiple datasets. How should I define dataset.v here? Ma

Re: [R] in object of class formula

2011-02-04 Thread Prof Brian Ripley
Did you look at the help? ?formula has a whole section about why formulas have environments and what they do. On Fri, 4 Feb 2011, Aviad Klein wrote: # Hi all, # I've made a function to make a formula out of a data.frame without columns which contain a constant value. # The function "which.c

Re: [R] get caller's name

2011-02-04 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Duncan Murdoch > Sent: Friday, February 04, 2011 6:03 AM > To: Ernest Adrogué > Cc: r-h...@stat.math.ethz.ch > Subject: Re: [R] get caller's name > > On 03/02/2011 10:27 AM, Erne

Re: [R] uniroot

2011-02-04 Thread Berend Hasselman
dpender wrote: > > Hi, > > I am using the uniroot function in order to carry out a bivariate Monte > Carlo simulation using the logistics model. > > I have defined the function as: > > BV.FV <- function(x,y,a,A) > (((x^(-a^-1)+y^(-a^-1))^(a-1))*(y^(a-1/a))*(exp(-((1^(-a^-1)+y^(-a^-1))^a)+y^-1

Re: [R] lapply, strsplit, and list elements

2011-02-04 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Dick Harray > Sent: Friday, February 04, 2011 7:37 AM > To: r-help@r-project.org > Subject: [R] lapply, strsplit, and list elements > > Hi there, > > I have a problem about lap

[R] in object of class formula

2011-02-04 Thread Aviad Klein
# Hi all, # I've made a function to make a formula out of a data.frame without columns which contain a constant value. # The function "which.constant" returns the indices of colums with constant values: which.constant <- function(data.frame) { # counts the number of columns in a data.frame which

Re: [R] recode according to specific sequence of characters within a string variable

2011-02-04 Thread David Winsemius
On Feb 4, 2011, at 8:26 AM, Denis Kazakiewicz wrote: Dear R people Could you please help I have similar but opposite question How to reshape data from DF.new to DF from example, Mark kindly provided? Well, I don't think you want a random order, right? If what you are asking is for a singl

[R] lapply, strsplit, and list elements

2011-02-04 Thread Dick Harray
Hi there, I have a problem about lapply, strsplit, and accessing list elements, which I don't understand or cannot solve: I have e.g. a character vector with three elements: x = c("349/077,349/074,349/100,349/117", "340/384.2,340/513,367/139,455/128,D13/168", "600/437,128/903,1

Re: [R] My own distribution in survreg function

2011-02-04 Thread Terry Therneau
--- begin included message I'm trying to do some analysis using survreg function. I need to implement there my own distribution with density: lambda*exp(-lambda*y), where y = a1/(1+exp(-a2*x)). a1, a2 are unknown parameters and x >0. --- end inclusion -- The survreg

Re: [R] Estimation and Forecast of Seasonal Component

2011-02-04 Thread Giovanni Petris
I would probably use a Dynamic Linear Model, combining seasonal component and regression. See package dlm and its vignette for examples. HTH, Giovanni On Tue, 2011-02-01 at 11:01 +, Paolo Rossi wrote: > Hi list, > > > I would like to estimate and forecast the seasonal component of a series

[R] Layout control from RCytoscape

2011-02-04 Thread Fahim M
Hi I have a list of nodes and edges. I want to draw a graph from two different direction left and right. I am drawing the required graph which is growing from left. Similar will be the case that will grow from right. the one that grows from right may have few nodes present in left subtree.

Re: [R] GAM quasipoisson in MuMIn - SOLVED

2011-02-04 Thread Karen Moore
Hi, Got my issues sorted. Error message solved: I heard from the guy who developed MuMIn and his suggestion worked. "As for the error you get, it seems you are running an old version of MuMIn. Please update the package first." I did (I was only 1 version behind in both R and in MuMIn) and erro

Re: [R] vegan and sweave using xtable

2011-02-04 Thread Olga Lyashevska
Thanks Ista, Very instructive and works like a charm! Cheers! Olga __ 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, mi

Re: [R] vegan and sweave using xtable

2011-02-04 Thread Ista Zahn
Hi Olga, Here is how I would approach this problem. I hope it is instructive. library(vegan) data(BCI) mod <- radfit(BCI[1,]) class(mod) #find out what mod is methods(class="radfit") #find out what methods are available for objects of this class. Nothing looks promising, so define a summary metho

Re: [R] Importing dates from SPSS file

2011-02-04 Thread dunner
as.POSIXlt(book$DATE, origin="1582/10/14") works. The Gregorian calendar was the kicker, thanks to ggrothendieck at gmail.com Ross -- View this message in context: http://r.789695.n4.nabble.com/Importing-dates-from-SPSS-file-tp3260293p3260329.html Sent from the R help mailing list archive at

Re: [R] Importing dates from SPSS file

2011-02-04 Thread Gabor Grothendieck
On Fri, Feb 4, 2011 at 9:47 AM, dunner wrote: > > Hello all, kind regards, > > I have imported a data.frame from SPSS using "foreign":read.spss but > unfortunately it is reading dates in a way neither R nor myself can > understand. > >> book$DATE >  [1] 13502246400 13443321600 13477795200 13472956

Re: [R] coxph fails to survfit

2011-02-04 Thread Bond, Stephen
Responding to T. Therneau: > sessionInfo() R version 2.10.1 (2009-12-14) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 LC_MONETARY=English_United States.1252 [4] LC_NUMERIC=C LC_TIME=English_United States.125

Re: [R] Importing dates from SPSS file

2011-02-04 Thread jim holtman
What do the dates look like in the original file? On Fri, Feb 4, 2011 at 9:47 AM, dunner wrote: > > Hello all, kind regards, > > I have imported a data.frame from SPSS using "foreign":read.spss but > unfortunately it is reading dates in a way neither R nor myself can > understand. > >> book$DATE

[R] Importing dates from SPSS file

2011-02-04 Thread dunner
Hello all, kind regards, I have imported a data.frame from SPSS using "foreign":read.spss but unfortunately it is reading dates in a way neither R nor myself can understand. > book$DATE [1] 13502246400 13443321600 13477795200 13472956800 13501728000 13445395200 13501382400 13502851200 134441856

Re: [R] Applying multiple functions to one object

2011-02-04 Thread jctoll
On Wed, Feb 2, 2011 at 7:59 AM, Karl Ove Hufthammer wrote: > Dear list members, > > I recall seeing a convenience function for applying multiple functions to > one object (i.e., almost the opposite of 'mapply’) somewhere. > Example: If the function was named ’fun’ the output of > >  fun(3.14, mode

[R] Adding axes label to image:Fixed

2011-02-04 Thread ogbos okike
Dear Jim, One touch!! Thank you very much Best regards Ogbos On 4 February 2011 13:47, Jim Lemon wrote: > On 02/04/2011 09:14 PM, ogbos okike wrote: > >> Dear all, >> Using the code I got from the link ( >> http://www.phaget4.org/R/image_matrix.html), I obtained a nice plot that >> suits

[R] sensitivity analysis with external simulation model - decoupling in package "sensitivity" or alternative?

2011-02-04 Thread Rainer M Krug
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hi I hava a simulation model, of which I want to do a sensitivity analysis. I have identified a number of input variables and my response variable. What I hava done so far: 1) I created a Latin Hypercube with the lhs package (10.000 simulations) 2) s

Re: [R] recode according to specific sequence of characters within a string variable

2011-02-04 Thread Denis Kazakiewicz
Dear R people Could you please help I have similar but opposite question How to reshape data from DF.new to DF from example, Mark kindly provided? Thank you Denis On Пят, 2011-02-04 at 07:09 -0600, Marc Schwartz wrote: > On Feb 4, 2011, at 6:32 AM, D. Alain wrote: > > > Dear R-List, > > > >

[R] vegan and sweave using xtable

2011-02-04 Thread Olga Lyashevska
Dear all, Using: library(vegan) data(BCI) mod <- radfit(BCI[1,]) mod RAD models, family poisson No. of species 93, total abundance 448 par1 par2 par3Deviance AIC BIC Null 39.5261 315.4362 315.4362 Preemption 0.042797

Re: [R] get caller's name

2011-02-04 Thread Duncan Murdoch
On 03/02/2011 10:27 AM, Ernest Adrogué wrote: Hi, Suppose a function that checks an object: stop.if.dims<- function(x) { if (! is.null(dim(x))) { stop("cannot handle dimensional data") } } This would be used by other functions that can only work with dimensionless objects. The proble

  1   2   >