Re: [R] Summary using by() returns character arrays in a list

2012-10-11 Thread PIKAL Petr
Hi But i still wonder what is wrong on aggregate? aggregate(iris, list(iris$Species), summary) gives you somewhat complicated data frame with numeric values, which you can extract as you wish. > names(aggregate(iris, list(iris$Species), summary)[2]) [1] "Sepal.Length" > aggregate(iris, list(i

Re: [R] Columns and rows

2012-10-11 Thread Jeff Newmiller
Better, but you didn't do your reading. Seriously... learn to make it reproducible... you will get quicker help from more skilled R users. Also, post in text, not HTML. Note that data frames are not really the right data structure for doing the kinds of operations you are describing below, si

Re: [R] Columns and rows

2012-10-11 Thread arun
HI, Try this: dat1<-read.table(text=" Names Colx Coly Colz rowName1 A E H rowName2 B F I rowName3 C G J rowName4 D K ",sep="",header=TRUE,stringsAsFactors=FALSE,fill=TRUE)  dat2<-t(dat1) dat3<-dat2[2:4,] dat4<-do.call(rbind,sapply(dat3,list))) row.names(dat4)<-1:nrow(dat4)  dat4  dat4 #   [,1] #1

Re: [R] How to handle Chinese character in R plot?

2012-10-11 Thread Manish Gupta
But i need to read my data from XML. 表 3 2.9 笔 3.3 3 铅笔 2.3 2.9

Re: [R] How to handle Chinese character in R plot?

2012-10-11 Thread huang min
I think this only works when you already have a Chinese OS. Huang On Fri, Oct 12, 2012 at 11:01 AM, Jinsong Zhao wrote: > On 2012-10-12 10:16, Manish Gupta wrote: > >> Hi, >> >> I am working on Chinese language plot. >> >> But names and labels are in chinese language. How can i print chineese >

[R] (no subject)

2012-10-11 Thread louise wilson
Hi All, I am performing GEV analysis on temperature/precipitation data using L moments: dim(data) [1] 145 192 156 Lmoments <- apply(data, 1:2, function(x) samlmu(x,nmom=4,sort.data=TRUE)) params_GEV <- apply(Lmoments,2:3,pelgev) location <- params_GEV[1,,] (xi) scale <- params_GEV[2,,]

[R] ks.test not working?

2012-10-11 Thread Louise.Wilson
Hi, I am performing GEV analysis on temperature/precipitation data and want to use the ks.boot function but I am unsure of how to implement it using the pgev distribution. For example: ks.test(data,pgev,shape,location,scale) ks.boot(data,(distribution parameters?),alternative="pgev",nboots=100

Re: [R] Columns and rows

2012-10-11 Thread Santana Sarma
Hi, Trying to give an example here. Say, I have read in a .csv file using read.csv (), and the file contains the following info. Names Col x Col y Col z rowName1 A E H rowName2 B F I rowName3 C G J rowName4 D K Now, this is what is required: 1. Combine/stack/join contents from -

Re: [R] How to handle Chinese character in R plot?

2012-10-11 Thread Jinsong Zhao
On 2012-10-12 10:16, Manish Gupta wrote: Hi, I am working on Chinese language plot. But names and labels are in chinese language. How can i print chineese characters as lable in R plot. 名称 类 学生 木材 2 2 表 3 4 笔 4 2 垃圾桶 5 6 杯 6

Re: [R] Reading labels for very large heatmaps

2012-10-11 Thread JIMonroe
Jean, I have attached an example set of data. The code for reading and manipulating it before display as a heatmap is as follows: Apo_Mut<-read.table("Example_Data.txt") require(cluster) blah <- agnes(as.matrix(max(Apo_Mut)-Apo_Mut)) blah2<-as.hclust(blah) LabsDend <- as.dendrogram(blah2) RowCol

Re: [R] Columns and rows

2012-10-11 Thread David Winsemius
On Oct 11, 2012, at 5:55 PM, Santana Sarma wrote: > Hi, > > Could you please advice some easy way to do the following for a dataframe > (header=F) having unequal column- & row- length. > > 1. Combine/stack/join contents from - > a) multiple rows into one column. > b) m

[R] How to handle Chinese character in R plot?

2012-10-11 Thread Manish Gupta
Hi, I am working on Chinese language plot. But names and labels are in chinese language. How can i print chineese characters as lable in R plot. 名称 类 学生 木材 2 2 表 3 4 笔 4 2 垃圾桶 5 6 杯 6 3 like we can do in excel as shown belo

Re: [R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread scoyoc
Nice! Exactly what I was looking for. I just needed to call the rows in both vector arguments. Thanks, MVS -- View this message in context: http://r.789695.n4.nabble.com/Changing-NA-to-0-in-selected-columns-of-a-dataframe-tp4645917p4645949.html Sent from the R help mailing list archive at Nabb

Re: [R] Error in matrix (unlist(value, recursive = FALSE, use.names = FALSE), nrow = nr, : attempt to set an attribute on NULL

2012-10-11 Thread marsyxp
Hi Michael, thank you for your reply. I haved contacted the author of the package. Hopefully I could fix the error very soon ^ ^ -- View this message in context: http://r.789695.n4.nabble.com/Error-in-matrix-unlist-value-recursive-FALSE-use-names-FALSE-nrow-nr-attempt-to-set-an-attribute-on-L

Re: [R] Columns and rows

2012-10-11 Thread Jeff Newmiller
Data frames don't have unequal column or row lengths within a single object. Your terminology is obscuring your intent. Perhaps you should read the posting guide for guidance on posting here and then generate a reproducible example. Since you seem to be having difficulty with the "how", at least

Re: [R] Fonts in *.Rd files.

2012-10-11 Thread Rolf Turner
Message received; thanks. cheers, Rolf On 12/10/12 12:38, Duncan Murdoch wrote: On 12-10-11 6:05 PM, Rolf Turner wrote: I wanted to put a certain string in sans serif font in an *.Rd file that I was writing. I tried {\sf ...} and \textsf{...} but both resulted in the warning

[R] ccf(x,y) vs. cor() of x and lagged values of y

2012-10-11 Thread Mihnea Constantinescu
Hi I'm computing the correlation between two time-series x_t and y_t-1 (time-series lagged using the lag(y,-1) function) using the cor() function and the returned value is different from the value of ccf() function at the same lag. Any ideas why this is so? Thanks in advance for any hints.

[R] nls NAs

2012-10-11 Thread Elizabeth Webb
Hi- I am using the following code: start=c(alpha=0.4,beta=0.4) warm.10<-nls(warming$umoles60~alpha*exp(beta*warming$T10cm),start = start,data=warming,na.action=na.omit) This code works for other columns in my dataset that are similar to $T10cm but the code does not work for this particular

[R] extracting groups from hclust() for a very large matrix

2012-10-11 Thread Christopher R. Dolanc
Hello, I'm having trouble figuring out how to see resulting groups (clusters) from my hclust() output. I have a very large matrix of 4371 plots and 29 species, so simply looking at the graph is impossible. There must be a way to 'print' the results to a table that shows which plots were in wh

Re: [R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread Rui Barradas
Hello, Try the following. data[ , 2:3][is.na(data[ , 2:3] ) ] = 0 You have to tell the interpreter which columns you want to change. Hope this helps, Rui Barradas Em 11-10-2012 23:05, scoyoc escreveu: I've been beating my head on the table for hours now and don't understand why this doesn't

[R] mclogit

2012-10-11 Thread Katelyn Weaver
Hello, I am new to R and am trying to complete a mixed conditional logistic regression. There are two issues that I am currently having: 1. I am not sure how to insert the random effects variable into the equation. My current equation is model<-mclogit(Presence~AllWet+AllAg+strata(Pair)) where Pr

[R] Error with cForest

2012-10-11 Thread James Erickson (Student)
All -- I have been trying to work with the 'Party' package using R v2.15.1 and have cobbled together a (somewhat) functioning code from examples on the web. I need to run a series of unbiased, conditional, cForest tests on several subsets of data which I have made into a loop. The results ide

[R] Columns and rows

2012-10-11 Thread Santana Sarma
Hi, Could you please advice some easy way to do the following for a dataframe (header=F) having unequal column- & row- length. 1. Combine/stack/join contents from - a) multiple rows into one column. b) multiple columns into one row. 2. Stack contents from multiple col

Re: [R] survey package question

2012-10-11 Thread Sebastián Daza
Hello Thomas, I use both svymean (with the expanded sample = people), and svyratio (voting unit level), using the same design: design <-svydesign(id=~station + unit, fpc=~probstation+probunits, data=sample, pps="brewer") I got different results using the same sample: svyratio (voting unit)

[R] error msg using na.approx "x and index must have the same length"

2012-10-11 Thread Jay Rice
Below I have written out some simplified data from my dataset. My goal is to interpolate Price based on timestamp. Therefore the closer a Price is in time to another price, the more like that price it will be. I want the interpolations for each St and not across St (St is a factor with levels A, B

Re: [R] Fonts in *.Rd files.

2012-10-11 Thread Duncan Murdoch
On 12-10-11 6:05 PM, Rolf Turner wrote: I wanted to put a certain string in sans serif font in an *.Rd file that I was writing. I tried {\sf ...} and \textsf{...} but both resulted in the warning "unknown macro". The manual on "Writing R Extensions" seems to me to imply that one should be able

Re: [R] characters, mathematical expressions and computed values

2012-10-11 Thread William Dunlap
I think that bquote, with its .() operator, suffices for [almost?] any single title; don't bother fiddling with expression(), substitute(), or parse(). (You can make those work in many situations, but if you stick with just bquote then you can spend your time on the title itself.) E.g., hist

Re: [R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread arun
Hi Michael, Sorry!  You are right. That was OP's code, which I cut and paste without noticing it.  To Scoyoc: You can also try this: dat1 <-data.frame(A, B, C, D, E ) dat1new<-dat1[,2:3]  dat1new[is.na(dat1new)]<-0  dat1[,2:3]<-dat1new  dat1 #  A B  C  D  E #1 1 6  0 16 21 #2 2 7  0 17 NA #3

Re: [R] a question

2012-10-11 Thread Rui Barradas
Hello, What a terribly asked question. Let me rephrase it. You have a time series 'x' simulated with garchSim from package fGarch and have fitted a model using garchFit. 1. You want to extract the coefficients. coef(fit) 2. You want the series of observations (simulated) and of conditional sd.

Re: [R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread R. Michael Weylandt
On Thu, Oct 11, 2012 at 11:58 PM, arun wrote: > Hi, > Try this: > dat1 = as.data.frame ( cbind ( A, B, C, D, E ) ) No. Do not try this. It is a Very Bad Thing to use as.data.frame(cbind(...)) instead of data.frame(...) for reasons I've mentioned before on this list. In short, cbind() forces

Re: [R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread arun
Hi, Try this:  dat1 = as.data.frame ( cbind ( A, B, C, D, E ) ) dat1$B[is.na(dat1$B)]<-0  dat1$C[is.na(dat1$C)]<-0  dat1 #  A B  C  D  E #1 1 6  0 16 21 #2 2 7  0 17 NA #3 3 0 13 18 NA #4 4 0 14 19 NA #5 5 0 15 20 25 A.K. - Original Message - From: scoyoc To: r-help@r-project.org Cc:

Re: [R] Formatting data for bootstrapping for confidence intervals

2012-10-11 Thread Paul Wennekes
Thank you! That had me stuck for quite a while and this worked like a charm! -- View this message in context: http://r.789695.n4.nabble.com/Formatting-data-for-bootstrapping-for-confidence-intervals-tp4645860p4645920.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread scoyoc
Actually what does "only logical matrix subscripts are allowed in replacement" mean. I can designate columns using is.na. -- View this message in context: http://r.789695.n4.nabble.com/Changing-NA-to-0-in-selected-columns-of-a-dataframe-tp4645917p4645918.html Sent from the R help mailing list a

[R] Question on survival

2012-10-11 Thread lau pel
Hi, I'm going crazy trying to plot a quite simple graph. i need to plot estimated hazard rate from a cox model. supposing the model i like this: coxPhMod=coxph(Surv(TIME, EV) ~ AGE+A+B+strata(C) data=data) with 4 level for C. how can i obtain a graph with 4 estimated (better smoothed) hazard curve

[R] Changing NA to 0 in selected columns of a dataframe

2012-10-11 Thread scoyoc
I've been beating my head on the table for hours now and don't understand why this doesn't work. I have a dataframe that I want to change NAs to 0 for some of the columns and not others. Consider this... >#create dataframe > A = c(1:5) > B = c(6, 7, NA, NA, NA) > C = c(NA, NA, 13, 14, 15) > D = c(

[R] characters, mathematical expressions and computed values

2012-10-11 Thread 1Rnwb
Hello, I have to add "Age (bar(x)=14.3) as a title on a chart. I am unable to get this to working. I have tried bquote, substitute and expression, but they are only doing a part of the job. new<- c(14.3, 18.5, 18.1, 17.7, 18, 15.9, 19.6, 17.3, 17.8, 17.5, 15.4, 16.3, 15, 17.1, 17.1, 16.4, 15.2,

[R] In vegan package: running adonis (or similar) on a distance matrix

2012-10-11 Thread Roey Angel
Hi, Using Vegan package I was wondering if there's a way to use a distance matrix as an input for adonis (or any of the other similar hypothesis testing functions) instead of the usual species by sample table. Working in the field of microbial ecology, what I'm trying to do is to overcome the p

[R] a question

2012-10-11 Thread mina izadi
Dear R-helpers, I need to read some data from output of garchFit in fGarch. my model is garch(1,1) and i want to read coefficients(omega,alpha,beta) and timeseries(x) and conditional SD(s). because i need them to use in other formula. for example :omega+x[1]+s[3] and maybe i have several simulati

[R] model selection with spg and AIC (or, convert list to fitted model object)

2012-10-11 Thread Ravi Varadhan
Adam, See the attached R code that solves your problem and beyond. One important issue is that you are enforcing constraints only indirectly. You need to make sure that P1, P2, and P3 (which are functions of original parameters and time) are all between 0 and 1. It is not enough to impose co

Re: [R] Formatting data for bootstrapping for confidence intervals

2012-10-11 Thread arun
Hi, Try this: dat1<-read.table(text=" Area    NAME    DATE    X    Xn    Y 1    X    1/10/10    1    1    0 1    Y    1/11/10    0    0    1 1    X    1/12/10    1    0    0 1    X    1/12/10    1    0    0 1    X    1/12/10

[R] Error in file(file, "rt") : cannot open the connection

2012-10-11 Thread Navin Goyal
Hi, I am using R package "QT" which call runs alongwith SAS I get this error : " Error in file(file, "rt") : cannot open the connection" I have tried using setwd or running R directly from that directory but still get the same error. Any help would be appreciated setwd("C:\\Documents and Settin

[R] Fonts in *.Rd files.

2012-10-11 Thread Rolf Turner
I wanted to put a certain string in sans serif font in an *.Rd file that I was writing. I tried {\sf ...} and \textsf{...} but both resulted in the warning "unknown macro". The manual on "Writing R Extensions" seems to me to imply that one should be able to invoke such LaTeX macros (section 2.3)

Re: [R] replacing ugly for loops

2012-10-11 Thread Bert Gunter
I hate to decline such praise, but honesty demands that I must. In fact, my solution is **not** fully vectorized at all! The tapply() and mapply() calls are, in fact, in some sense hidden loops at the interpreted levels. They do have the virtue of being true to R's functional paradigm, but they ar

Re: [R] replacing ugly for loops

2012-10-11 Thread andrewH
Dear Bert-- I tried your function on the data that I provided (data.df) and it worked beautifully (after I added a missing final parenthesis), producing exactly the same output as my function. This is an excellent example of what I was looking for, because it is (a) 50% shorter than mine,

Re: [R] Selecting n observation

2012-10-11 Thread David Winsemius
On Oct 11, 2012, at 12:48 PM, bibek sharma wrote: > Hello R help, > I have a question similar to what is posted by someone before. my > problem is that Instead of last assessment, I want to choose last two. > > I have a data set with several time assessments for each participant. > I want to sel

Re: [R] simple parsing question?

2012-10-11 Thread Fuchs Ira
Yes, in my case it would be re-learning regular expressions. Unlike riding a bicycle, this is something I have managed to forget (except for the simplest cases). I even have an old O'reilly book on the subject which I can dust off. I was thinking (hoping?) that quantmod had functions to manipu

Re: [R] simple parsing question?

2012-10-11 Thread arun
HI, Try this:  sprintf("%.2f",as.numeric(sub("^.* ([-+]?[[:digit:].]+)%$", "\\1", as.character(aapl[[2]] #[1] "-2.00" A.K. - Original Message - From: Fuchs Ira To: r-help@r-project.org Cc: Sent: Thursday, October 11, 2012 4:45 PM Subject: Re: [R] simple parsing question? I'm gl

Re: [R] simple parsing question?

2012-10-11 Thread William Dunlap
But I thought the intention was to turn the string into a number, not into another string. Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > From: arun [mailto:smartpink...@yahoo.com] > Sent: Thursday, October 11, 2012 1:54 PM > To: Fuchs Ira > Cc: R help; Wi

Re: [R] simple parsing question?

2012-10-11 Thread Fuchs Ira
I'm glad I asked as I would have thought that this was a common requirement and quantmod itself or a simple R function would have done the conversion. You saved me from having to master R's sub function. One remaining thing…when I use your snippet for AAPL, I get: > aapl=getQuote("aapl",what=ya

Re: [R] simple parsing question?

2012-10-11 Thread William Dunlap
> qs <- getQuote(c("aapl","tibx","gm","badWolf"),what=yahooQF(c("Change Percent > (Real-time)"))) > qs Trade Time %Change (RT) aapl2012-10-11 04:00:00 N/A - -2.00% tibx2012-10-11 04:00:00 N/A - -0.85% gm 2012-10-11 04:00:00 N/A - +1.77% badWolf N/A -

Re: [R] "optim" and "nlminb"

2012-10-11 Thread nserdar
I have already try "optimx" but I got this error message. How to solve it. fn is Linn Function has 10 arguments par[ 1 ]: 0 http://r.789695.n4.nabble.com/optim-and-nlminb-tp4645772p4645907.html Sent from the R help mailing list archive at Nabble.com. ___

Re: [R] Selecting n observation

2012-10-11 Thread Peter Ehlers
On 2012-10-11 12:48, bibek sharma wrote: Hello R help, I have a question similar to what is posted by someone before. my problem is that Instead of last assessment, I want to choose last two. I have a data set with several time assessments for each participant. I want to select the last assess

Re: [R] Exporting summary plm results to latex

2012-10-11 Thread arun
HI Sebastian, Sorry, I found an error in my solution (the values and coefficients got mixed up in sorting). Try this: library(reshape) extract.plm <- function(model) { if (!class(model)[1] == "plm") { stop("Internal error: Incorrect model type! Should be a plm object!") } zz1<-summary(model)$coe

[R] simple parsing question?

2012-10-11 Thread Fuchs Ira
I am using the getQuote function in the Quantmod package to retrieve the % change for a stock as follows: > getQuote("aapl",what=yahooQF(c("Change Percent (Real-time)"))) Trade Time %Change (RT) aapl 2012-10-11 03:41:00 N/A - -1.67% How can I extract the numeric "change %" which is

[R] Selecting n observation

2012-10-11 Thread bibek sharma
Hello R help, I have a question similar to what is posted by someone before. my problem is that Instead of last assessment, I want to choose last two. I have a data set with several time assessments for each participant. I want to select the last assessment for each participant. My dataset looks

[R] Problems with getURL (RCurl) to obtain list files of an ftp directory

2012-10-11 Thread Francisco Zambrano
Dear all, I have a problem with the command 'getURL' from the RCurl package, which I have been using to obtain a ftp directory list from the MOD16 (ET, DSI) products, and then to download them. (part of the script by Tomislav Hengl, spatial-analyst). Instead of the list of files (from ftp), I am

[R] epiR//Incidence rate//beginner question on syntax

2012-10-11 Thread ninbut
Hi, new in R and I would like to start with calculating an incidence rate. My data is imported into R from a tab delimited txt file, as shown below: ID DATE_BIRTH DATE_UNT EVENT TIME_EV 1 4867 08/02/1959 19/10/2001 1 31 2 52 15/07/1941 08/02/1999 1 6 3 63 02/01/1946 11/0

Re: [R] survey package question

2012-10-11 Thread Thomas Lumley
On Fri, Oct 12, 2012 at 6:56 AM, Sebastián Daza wrote: > Hello, > > I have got a cluster sample using an election dataset where I already > had the final results of a county-specific election. I am trying to > figure out what would be the best sampling design for my data. > > The structure of the

[R] struggling with R2wd or SWord? Try rtf!

2012-10-11 Thread Jean V Adams
I have been looking for a way to write R-generated reports to Microsoft Word documents. In the past, I used the package R2wd, but for some reason I haven't been able to get it to work on my current set up. R version 2.15.0 (64-bit) Windows 7 Enterprise - Service Pack 1 Mi

Re: [R] bug tracker broken

2012-10-11 Thread Uwe Ligges
On 11.10.2012 19:56, Antonio Piccolboni wrote: Hi, I get a 404 page not found on the root. There is not webmaster link on r-project.org that I can see. Whom should I contact? Thanks Thanks for the note. The servers where the bug tracker is installed are experiencing problems that are known. Th

Re: [R] bug tracker broken

2012-10-11 Thread peter dalgaard
On Oct 11, 2012, at 19:56 , Antonio Piccolboni wrote: > Hi, > I get a 404 page not found on the root. There is not webmaster link on > r-project.org that I can see. Whom should I contact? Thanks > The machine hosting the bug tracker is having some issues. Just wait for the dust to settle... -

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread arun
HI Shantanu, I saw your reply to Rui regarding multiple underscores in Nabble: (Actually, I see now that part of the problem is that many of the names have multiple underscores such as "red_apple_pre" or "post_banana_organic". I think this is causing a problem for this line in your code:) I w

[R] Course: Data exploration, regression, GLM & GAM with R introduction

2012-10-11 Thread Highland Statistics Ltd
We would like to announce the following statistics course: Data exploration, regression, GLM & GAM. With introduction to R When: 4 - 8 February 2013. Where: Coimbra, Portugal. For details, see: http://www.highstat.com/statscourse.htm Course flyer: http://www.highstat.com/Courses/Flyer2013FebC

Re: [R] Help on probability distribution question

2012-10-11 Thread Ted Harding
(I made a slip with the mulstivariate case below: see at [***]) On 11-Oct-2012 17:51:51 Ted Harding wrote: > On 11-Oct-2012 17:22:44 Andras Farkas wrote: >> Dear All, >> I have a questions I would like to ask about and wonder if you >> have any thoughts to make it work in R. >> >> 1. I work in th

Re: [R] Help on probability distribution question

2012-10-11 Thread Andras Farkas
Ted,   thanks for the answer. I actually think I have it the other way around. Let me give you an example:   1. I know the mean parameter value of a variable (V), lets call it M with a value of 5, and I also know the SD, let us call it SD with a value of 3: #V M <-5 SD <-3   2. Usually in case

Re: [R] Repeating a series of commands

2012-10-11 Thread Bert Gunter
encapsulate them into a function and call the function ?? -- Bert On Thu, Oct 11, 2012 at 11:09 AM, KoopaTrooper wrote: > I'm trying to figure out how to repeat a series of commands in R and have the > outputs added to a dataframe after each iteration. > > My code starts this way... > > a<-read.

Re: [R] Formatting data for bootstrapping for confidence intervals

2012-10-11 Thread Rui Barradas
Hello, To aggregate the data use, yes, it's exists, function aggregate. with(dat, aggregate(cbind(X, Xn, Y), list(Area, DATE), FUN = sum)) # output Group.1 Group.2 X Xn Y 1 1 1/10/10 1 1 0 2 1 1/11/10 0 0 1 3 1 1/12/10 3 0 0 4 2 2/12/10 2 1 1 5 2 2/13/10 3 0

[R] Repeating a series of commands

2012-10-11 Thread KoopaTrooper
I'm trying to figure out how to repeat a series of commands in R and have the outputs added to a dataframe after each iteration. My code starts this way... a<-read.csv("File1.csv") b<-read.csv("File2.csv") a$Z<-ifelse(a$Z=="L",sample(1:4,length(a$Z),replace=TRUE),ifelse(a$Z=="M",sample(5:8,lengt

[R] bug tracker broken

2012-10-11 Thread Antonio Piccolboni
Hi, I get a 404 page not found on the root. There is not webmaster link on r-project.org that I can see. Whom should I contact? Thanks Antonio PS: Yes I was trying to report my first bug. It's a conspiracy with p < 0.01. [[alternative HTML version deleted]] ___

Re: [R] Friedman test for replicated blocked data

2012-10-11 Thread kolassa
It looks like friedman in "agricolae" package handles replicates by averaging and then doing the unreplicated Freidman analysis. Any pointers to the fully replicated analysis, given, for ex., in Conover, Practical Nonparametric Statistics (3rd Edn.), pp 383f? Thanks, John -- View this message

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread Sarah Goslee
I'm pretty sure you were already given the answer: order() in conjunction with a factor with the level in an order you specify. mydf$Season <- factor(mydf$Season, levels=c("Summer","Fall","Winter","Spring")) mydf[order(mydf$Season),] Thanks for making sure to include the context in your replies

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread arun
HI, In this case, specifying the factor levels would be easier. Try this: set.seed(1) df <- data.frame(Season=rep(c("Summer","Fall","Winter","Spring"),4),Obs= runif(length(rep(c("Summer","Fall","Winter","Spring"),4 df1<-within(df,{Season<-factor(Season,levels=c("Summer","Fall","Winter","Spring"

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread Bert Gunter
On Thu, Oct 11, 2012 at 10:43 AM, ROLL Josh F wrote: > Sorry if I wasn't clear. Actually, my bad -- I didn't read carefully enough. But the answer is still essentially correct -- just change the ordering of the levels of Season, which, by default, is alphabetic. df$Season <- factor(df$Season, le

[R] survey package question

2012-10-11 Thread Sebastián Daza
Hello, I have got a cluster sample using an election dataset where I already had the final results of a county-specific election. I am trying to figure out what would be the best sampling design for my data. The structure of the dataset is: 1) polling station (in general schools where people vo

Re: [R] plots for presentation

2012-10-11 Thread Duncan Murdoch
On 11/10/2012 1:08 PM, mamush bukana wrote: Dear users, I am preparing a presentation in latex(beamer) . I would like to show parts of my plots per click. Example, consider I have two time series x and y: x<-ts(rnorm(100), start=1900,end=1999) y<-ts(rnorm(100), start=1900,end=1999) plot(x) lines

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread ROLL Josh F
Sorry if I wasn't clear but the result I am looking for is as follows #   Season   Obs #1  Summer 0.2141001 #5  Summer 0.2141001 #9  Summer 0.2141001 #13 Summer 0.2141001 #3    Fall 0.6722337 #7    Fall 0.6722337 #11   Fall 0.6722337 #15   Fall 0.6722337 #2  Winter 0.9318599 #6  Winter 0.931859

Re: [R] replacing ugly for loops

2012-10-11 Thread Bert Gunter
Sorry, you **did** supply data and my solution **does** work (except I left off 1 closing ")" . > sq.n <- seq_len(nrow(data.df)) > tapply(sq.n,data.df$seq,function(x)with(data.df[x,], + sort(unique(do.call(c,mapply(seq,from=startNo,length=len,SIMPLIFY=FALSE)) $`1` [1] 3 4 5 6 10 11 $`2` [

Re: [R] Help on probability distribution question

2012-10-11 Thread Ted Harding
On 11-Oct-2012 17:22:44 Andras Farkas wrote: > Dear All, > I have a questions I would like to ask about and wonder if you > have any thoughts to make it work in R. > > 1. I work in the field of medicine where physiologic variables > are often simulated, and they can not have negative values. > Mos

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread arun
Hi, In your dataset, it seems like it is already ordered in the way you wanted to. df.. <- data.frame(Season=rep(c("Summer","Fall","Winter","Spring"),4),Obs= runif(length(rep(c("Summer","Fall","Winter","Spring"),4 #Suppose the order you want is:  vec2<-c("Summer","Winter","Fall","Spring") df1

Re: [R] Expected number of events, Andersen-Gill model fit via coxph in package survival

2012-10-11 Thread Omar De la Cruz C.
Thank you, Dr. Therneau, that was very helpful. Best regards, Omar. On Mon, Oct 8, 2012 at 9:58 AM, Terry Therneau wrote: > >> I am interested in producing the expected number of events, in a >> recurring events setting. I am using the Andersen-Gill model, as fit >> by the function "coxph" in

[R] Help on probability distribution question

2012-10-11 Thread Andras Farkas
Dear All,   I have a questions I would like to ask about and wonder if you have any thoughts to make it work in R.   1. I work in the field of medicine where physiologic variables are often simulated, and they can not have negative values. Most often the assumption is made to simulate this pa

Re: [R] Sorting a data frame by specifying a vector

2012-10-11 Thread Bert Gunter
?order df[order(yourcolumn, ] -- Bert On Thu, Oct 11, 2012 at 10:08 AM, LCOG1 wrote: > Hello all, >I cannot seem to figure out this seemingly simple procedure. > > I want to sort a data frame by a specified character vector. > > So for : > > df.. <- data.frame(Season=rep(c("Summer","Fall","

Re: [R] "optim" and "nlminb"

2012-10-11 Thread Spencer Graves
a fortune? On 10/11/2012 9:56 AM, John C Nash wrote: Indeed in several years on the list, I've never seen a query with a short, testable case fail to get an answer very quickly. JN -- Spencer Graves, PE, PhD President and Chief Technology Officer Structure Inspection and Monitoring,

[R] Sorting a data frame by specifying a vector

2012-10-11 Thread LCOG1
Hello all, I cannot seem to figure out this seemingly simple procedure. I want to sort a data frame by a specified character vector. So for : df.. <- data.frame(Season=rep(c("Summer","Fall","Winter","Spring"),4),Obs= runif(length(rep(c("Summer","Fall","Winter","Spring"),4 I want to so

[R] plots for presentation

2012-10-11 Thread mamush bukana
Dear users, I am preparing a presentation in latex(beamer) . I would like to show parts of my plots per click. Example, consider I have two time series x and y: x<-ts(rnorm(100), start=1900,end=1999) y<-ts(rnorm(100), start=1900,end=1999) plot(x) lines(y,col=2) Then I imported this plot into late

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread arun
Hi Shantanu, I guess the below code should solve both the issues: set.seed(432) dat2<-data.frame(apple_pre=sample(10:20,5,replace=TRUE),orange_post=sample(18:28,5,replace=TRUE),pre_banana=sample(25:35,5,replace=TRUE),post_apple=sample(20:30,5,replace=TRUE),banana_post=sample(40:50,5,replace=TRUE)

[R] Formatting data for bootstrapping for confidence intervals

2012-10-11 Thread Paul Wennekes
Hi all, New to R, so this may be obvious to some. I've been trying to figure this out for a while, I have a dataset "events" that looks something like this: AreaNAMEDATEX Xn Y 1 X 1/10/10 1 1 0 1 Y 1/11/10

Re: [R] "optim" and "nlminb"

2012-10-11 Thread John C Nash
It appears you are using the approach "throw every method at a problem and select the answer you like". I use this quite a lot with optimx to see just what disasters I can create, but I do so to see if the software will return sensible error messages. You will have to provide a reproducible exam

Re: [R] dotplot in ".R" with lattice & latticeExtra: proper visualization

2012-10-11 Thread David Winsemius
On Oct 11, 2012, at 6:48 AM, Andres LaCortadora wrote: > Dear everyone, > > I'm trying to do a dotplot with the libraries "lattice" and "latticeExtra". > However, no proper representation of the values on the vertical y-axis is > done by ".R". Instead of choosing the actual values of the numeric

Re: [R] Options to extend memory limit

2012-10-11 Thread Marc Schwartz
On Oct 11, 2012, at 9:55 AM, "Sebastian P. Luque" wrote: > On Thu, 11 Oct 2012 14:45:16 +0200, > wrote: > >> Dear All, at the moment I am using R for calculations of large >> databases. Unfortunately, R only manages to complete certain >> operations at some times, and not at others. I usually

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread Rui Barradas
Hello, Em 11-10-2012 15:14, arun escreveu: HI Rui, By running your code, I got the results as: result # MeanDiff CIlowerCIupper p.value #apple -12.6 -16.68052 -8.519476 0.0010166626 #banana-15.0 -17.91196 -12.088040 0.0001388506 #orange-18.2 -22.79583 -13.604166 0.

Re: [R] Options to extend memory limit

2012-10-11 Thread Sebastian P. Luque
On Thu, 11 Oct 2012 14:45:16 +0200, wrote: > Dear All, at the moment I am using R for calculations of large > databases. Unfortunately, R only manages to complete certain > operations at some times, and not at others. I usually get the error > message "cannot allocate vector of size XX" > I am

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread Rui Barradas
Hello, If that is the problem now, then change the variables' names. In what follows, the first line is just the example you gave. In the actual runnunig code uncomment the commented out lines. vars <- c("red_apple_pre", "post_banana_organic") #vars <- names(dat) vars <- gsub("_pre", "=pre",

Re: [R] own function: computing time

2012-10-11 Thread Tonja Krueger
That's perfect, thanks a lot! Tonja Gesendet: Mittwoch, 10. Oktober 2012 um 21:37 Uhr Von: "William Dunlap" An: "tonja.krue...@web.de" , "r-help@r-project.org" Betreff: RE: [R] own function: computing time Your original method would be the following function f <- funct

[R] dotplot in ".R" with lattice & latticeExtra: proper visualization

2012-10-11 Thread Andres LaCortadora
Dear everyone, I'm trying to do a dotplot with the libraries "lattice" and "latticeExtra". However, no proper representation of the values on the vertical y-axis is done by ".R". Instead of choosing the actual values of the numeric variable, ".R" plots the rank of the value. That is, there are val

Re: [R] Options to extend memory limit

2012-10-11 Thread Ben Bolker
de.pwc.com> writes: > at the moment I am using R for calculations of large databases. > Unfortunately, R only manages to complete certain operations at some > times, and not at others. I usually get the error message "cannot allocate > vector of size XX" > > I am using the 64-bit version wi

Re: [R] multiple t-tests across similar variable names

2012-10-11 Thread arun
HI Rui, By running your code, I got the results as: result #   MeanDiff   CIlower    CIupper  p.value #apple -12.6 -16.68052  -8.519476 0.0010166626 #banana    -15.0 -17.91196 -12.088040 0.0001388506 #orange    -18.2 -22.79583 -13.604166 0.0003888560 >From my code: res3 #   meandi

Re: [R] Exporting each row in the table as new table

2012-10-11 Thread R. Michael Weylandt
On Thu, Oct 11, 2012 at 2:04 PM, kallu wrote: > Dear all, > > I am new to R and I am familiar with very basic stuff. I am trying to create > tables in text format from each row of my table and export these tables with > specific attribute in the table. I tried after reading some forums but > nothi

Re: [R] performance analytics- package

2012-10-11 Thread R. Michael Weylandt
On Thu, Oct 11, 2012 at 11:04 AM, sheenmaria wrote: > In performance analytics - performance summary session , i cant run the > code of - > charts.PerformanceSummary(datafrom_table, rf = 0, main = NULL, method = > "ModifiedVaR", width = 0,event.labels = NULL, ylog = FALSE, wealth.index = > FALSE

Re: [R] Exporting summary plm results to latex

2012-10-11 Thread arun
Hi, I tried this function on an example dataset and it seems to be working. extract.plm <- function(model) { if (!class(model)[1] == "plm") { stop("Internal error: Incorrect model type! Should be a plm object!") } zz1<-summary(model)$coef[,1:2]  zz2<-as.data.frame(apply(zz1,2,function(x) sprintf(

  1   2   >