[R] help need on working in subset within a dataframe

2011-03-21 Thread Umesh Rosyara
Dear R-experts Execuse me for an easy question, but I need help, sorry for that. >From days I have been working with a large dataset, where operations are needed within a component of dataset. Here is my question: I have big dataset where x1:.x1000 or so. What I need to do is to work on 4

[R] why the survival function estimate using package 'mstate' & package 'cmprsk' vary from sas and LTA (From WHO).

2011-03-21 Thread chaijian
hello,everyone: I am now confused in multistate survival , when I want to poccess a multistate survival analysis, I turn to R and the package 'mstate' and packege 'cmprsk'. When I come to publishing the article. Follow requirement of the magzine, the statistic is carry out in LTA package

Re: [R] Using the mahalanobis( ) function

2011-03-21 Thread Tyler Rinker
This is what I've tried so far and just can't get it. I know I want a value of 3.93 (for Age= y and m) using mahalanobis d as an effect size for a follow up to an MANOVA: age.frame<-data.frame(Age, Friend.Agression, Parent.Agression, Stranger.Agression) > age.frame Age Friend.Agression Pa

Re: [R] Rmark and scientific notation issue

2011-03-21 Thread Ben Bolker
odaniel utas.edu.au> writes: > Just wondering if anyone might know a way to stop R reading my survival > history that has zeros at the beginning in as scientific notation. Gmane doesn't want me to quote much, but maybe read.table("myfile.dat",colClasses=c("character",rep("numeric",2)) ?

[R] Rmark and scientific notation issue

2011-03-21 Thread odaniel
Hi all, Just wondering if anyone might know a way to stop R reading my survival history that has zeros at the beginning in as scientific notation. The data is being read in from a .txt file via read.table to be used with Rmark I have the same issues at the moment with reading in .csv and .xls file

Re: [R] How to substract a valur from dataframe with condition

2011-03-21 Thread Bill.Venables
dat <- within(dat, { X2 <- ifelse(X2 > 50, 100-X2, X2) X3 <- ifelse(X3 > 50, 100-X3, X3) }) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of joe82 Sent: Tuesday, 22 March 2011 7:40 AM To: r-help@r-project.org Subjec

[R] Using the mahalanobis( ) function

2011-03-21 Thread Tyler Rinker
Hello all, I am a 2 month newbie to R and am stumped. I have a data set that I've run multivariate stats on using the manova function (I included the data set). Now it comes time for a table of effect sizes with significance. The univariate tests are easy. Where I run into trouble filling

Re: [R] How to substract a valur from dataframe with condition

2011-03-21 Thread David Winsemius
On Mar 21, 2011, at 5:39 PM, joe82 wrote: Hello All, I need help with my dataframe, it is big but here I am using a small table as an example. My dataframe df looks like: X1 X2X3 1 2011-02 0.00 96.00 2 2011-02 0.00 2.11 3 2011-02 2.00 3.08 4 2011-02 0.06 2.79

[R] How to substract a valur from dataframe with condition

2011-03-21 Thread joe82
Hello All, I need help with my dataframe, it is big but here I am using a small table as an example. My dataframe df looks like: X1 X2X3 1 2011-02 0.00 96.00 2 2011-02 0.00 2.11 3 2011-02 2.00 3.08 4 2011-02 0.06 2.79 5 2011-02 0.00 96.00 6 2011-02 0.00 97.00

[R] Basic Looping Trouble

2011-03-21 Thread armstrwa
Hi all, Forgive me for this basic question. I've been doing some research and haven't been able to figure out how to best do this yet. I have 75 variables defined as vector time series. I am trying to create a script to automate calculations on each of these variables, but I wasn't sure how to

Re: [R] Exponential distribution

2011-03-21 Thread danielepippo
The code is like this: plot(0,0, type="n", xlim=c(1,15), ylim=0:1, xlab="...", ylab="...", main="Example) lines(1:15, line1, col=4) lines(1:15, line2, col=2) legend("topright", c("alpha = 0.2", "alpha = 0.4"), col=c(4,2), lty=1) How can I build the vectors line1 and line2 ? -- View this messag

[R] Kendall v MannKendall Functions

2011-03-21 Thread armstrwa
Hi, I am running a correlation analysis on a temporal dataset. I was wondering if you would receive the same tau and p values running the function: MannKendall(x), where x is the dependant variable that changes with time as you would running: Kendall(d,x), where x is the exact same dataset a

Re: [R] Merging by() results back into original data frame?

2011-03-21 Thread baptiste auguie
I find it quite neat with plyr, library(plyr) ddply(d, .(group), transform, max=max(val)) HTH, baptiste On 22 March 2011 12:09, William Dunlap wrote: >> -Original Message- >> From: r-help-boun...@r-project.org >> [mailto:r-help-boun...@r-project.org] On Behalf Of ivo welch >> Sent: Mon

Re: [R] Merging by() results back into original data frame?

2011-03-21 Thread ivo welch
thank you, william and bill. wow, this was fast. I have been tearing my hair out over this one, trying to work the wrong tool. (this would make a good "see also" in the "by" function.) Ivo Welch (ivo.we...@brown.edu, ivo.we...@gmail.com) On Mon, Mar 21, 2011 at 7:09 PM, William Dunlap

Re: [R] Merging by() results back into original data frame?

2011-03-21 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of ivo welch > Sent: Monday, March 21, 2011 3:43 PM > To: r-help > Subject: [R] Merging by() results back into original data frame? > > dear R experts---I am trying to figure out wh

Re: [R] Merging by() results back into original data frame?

2011-03-21 Thread Thomas Lumley
On Tue, Mar 22, 2011 at 11:42 AM, ivo welch wrote: > dear R experts---I am trying to figure out what the recommended way is > to merge by() results back into the original data frame.  for example, > I want to have a flag that tells me whether a particular row contains > the maximum for its group.

Re: [R] odfWeave Error unzipping file in Win 7

2011-03-21 Thread Duncan Murdoch
On 11-03-21 6:28 PM, rmail...@justemail.net wrote: I tried with no spaces in either file name and got the same error. Can you put together an example that produces the error without using odfWeave? To do that, figure out what odfWeave is doing, and do it outside of that package. If not, th

Re: [R] Help with POSIXct

2011-03-21 Thread Bill.Venables
You might try dat$F1 <- format(as.Date(dat$F1), format = "%b-%y") although it rather depends on the class of F1 as it has been read. Bill Venables. (It would be courteous of you to give us yor name, by the way.) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bo

[R] Merging by() results back into original data frame?

2011-03-21 Thread ivo welch
dear R experts---I am trying to figure out what the recommended way is to merge by() results back into the original data frame. for example, I want to have a flag that tells me whether a particular row contains the maximum for its group. d <- data.frame(group=as.factor(rep(1:3,each=3)), val=rno

Re: [R] odfWeave Error unzipping file in Win 7

2011-03-21 Thread rmailbox
I tried with no spaces in either file name and got the same error. - Original message - From: "Max Kuhn" To: rmail...@justemail.net Cc: r-help@r-project.org Date: Mon, 21 Mar 2011 17:04:40 -0400 Subject: Re: [R] odfWeave Error unzipping file in Win 7 I don't think that this is the issu

Re: [R] R as a non-functional language

2011-03-21 Thread Bill.Venables
That's not the point. The point is that R has functions which have side-effects and hence does not meet the strict requirements for a functional language. -Original Message- From: ONKELINX, Thierry [mailto:thierry.onkel...@inbo.be] Sent: Monday, 21 March 2011 7:20 PM To: russ.abb...@g

Re: [R] odfWeave Error unzipping file in Win 7

2011-03-21 Thread Max Kuhn
I don't think that this is the issue, but test it on a file without spaces. On Mon, Mar 21, 2011 at 2:25 PM, wrote: > > I have a very similar error that cropped up when I upgraded to R 2.12 and > persists at R 2.12.1. I am running R on Windows XP and OO is at version 3.2. > I did not make any

[R] Help with POSIXct

2011-03-21 Thread info
I rarely work with dates in R, so I know very little about the POSIXct and POSIXlt classes. I'm importing an excel file into R using the RODBC package, and am having issues reformatting the dates. 1. The important info: > sessionInfo() R version 2.12.2 (2011-02-25) Platform: i386-pc-mingw32/i386

Re: [R] Part of density plot not showing up

2011-03-21 Thread Jim Silverton
I am doing a histogram with 2 superimposed densities. However, the density of one of the graphs is not coming out..its being erased.. Any ideas on how to fix this problem? -- Thanks, Jim. [[alternative HTML version deleted]] __ R-help@r-projec

Re: [R] Stucked with as.numeric function

2011-03-21 Thread Tóth Dénes
> > On Mar 21, 2011, at 2:59 PM, Tóth Dénes wrote: > >> >> Hi, >> >> I guess you have commas as decimals in your data. Replace it to >> decimal >> points. > > If that is true then the easiest fix would be to set the proper > decimal argument in read.table In this particular case, sure. If patsko

Re: [R] Computing row differences in new columns

2011-03-21 Thread Henrique Dallazuanna
Try this: dat$DATE <- as.Date(dat$DATE, "%d-%b-%y") dat <- cbind(dat, lapply(mapply(tapply, MoreArgs = list(INDEX = c(dat$SUBJECT, unique(dat$SUBJECT)), FUN = diff), lapply(dat[,2:3], c, unique(dat$SUBJECT) / NA), SIMPLIFY = FALSE), unlist)) On Mon, Mar 21, 2011 at 4:38 PM, Roberto Lodeiro Mull

Re: [R] Computing row differences in new columns

2011-03-21 Thread David Winsemius
On Mar 21, 2011, at 3:38 PM, Roberto Lodeiro Muller wrote: -Original Message- From: Roberto Lodeiro Muller To: roberto.mul...@doctor.com Sent: Mon, Mar 21, 2011 3:37 pm Subject: Re: [R] Computing row differences in new columns Sorry, my data appeared badly formatted to me, so I conv

Re: [R] Computing row differences in new columns

2011-03-21 Thread Dennis Murphy
Hi: Here's one way. Calling your data frame below d, # Function to compute consecutive differences dif <- function(x) c(diff(x), NA) # Make sure that DATE is a Date variable d$DATE <- as.Date(d$DATE, format = '%d-%b-%y') # Apply the function to each individual ddply(d, 'SUBJECT', transform, dif

Re: [R] Computing row differences in new columns

2011-03-21 Thread Alexander Engelhardt
(mods: can you un-flag me if I am still flagged?) Hi, First, I would convert the DATE column to an integer. I found this by quick googling, perhaps as.Date is your weapon of choice: https://stat.ethz.ch/pipermail/r-help/2008-August/169870.html For the column generation I think you will have t

Re: [R] How do I delete multiple blank variables from a data frame?

2011-03-21 Thread Rita Carreira
Allan and Josh, Thanks for the help. I did d[, sapply(d, function(x) !all(is.na(x)))] and it worked great. Thanks so much again! Rita "If you think education is expensive, try ignorance"--Derek Bok > Date: Sat, 19 Mar 2011 08:36:43 + > From:

[R] Exponential distribution

2011-03-21 Thread danielepippo
Dear R-users, I have to plot a exponential distribution like the plot in the pdf attached. I've write this code but I don't know how to draw the two lines.. Can anyone help me please? Thank you very much Pippo http://r.789695.n4.nabble.com/file/n3394476/exponential_smoothing.pdf exponentia

Re: [R] Computing row differences in new columns

2011-03-21 Thread Roberto Lodeiro Muller
-Original Message- From: Roberto Lodeiro Muller To: roberto.mul...@doctor.com Sent: Mon, Mar 21, 2011 3:37 pm Subject: Re: [R] Computing row differences in new columns Sorry, my data appeared badly formatted to me, so I converted it to plain text: And just to clarify, for each subject

Re: [R] Randomly generating data

2011-03-21 Thread Dennis Murphy
Hi: It's unclear what you want for your vector of probabilities, but here's one approach: u$p <- runif(1000)# generate a random vector of success probabilities samp <- function(x) { p <- as.numeric(x[3]) # x will be character as constructed, pick out the numeric value of p

Re: [R] Correlation for no of variables

2011-03-21 Thread Patrick Burns
Getting the correlation of a 1000 by 1500 matrix takes about 3.5 seconds on my unimpressive Windows machine. Is that really a tremendous amount of time? You don't say what you are using the correlation matrix for. It is common for a semi-definite matrix (as you will be getting) to cause problem

[R] Computing row differences in new columns

2011-03-21 Thread Roberto Lodeiro Muller
Hi I have the following columns with dates and results, sorted by subject and date. I'd like to compute the differences in dates and results for each patient, based on the previous row. Obviously the last entry for each subject should be a NA. Which would be the best way to accomplished tha

Re: [R] Stucked with as.numeric function

2011-03-21 Thread David Winsemius
On Mar 21, 2011, at 2:59 PM, Tóth Dénes wrote: Hi, I guess you have commas as decimals in your data. Replace it to decimal points. If that is true then the easiest fix would be to set the proper decimal argument in read.table ?read.table # with ... , dec = "," , -- david. Best

Re: [R] string interpolation

2011-03-21 Thread Henrique Dallazuanna
Try this: sprintf("%s_%s", rep(1:58, each = 2), c("input", "output")) On Mon, Mar 21, 2011 at 4:03 PM, Justin Haynes wrote: > Is there a way to do this in R? I have data in the form: > > 57_input  57_output  58_input  58_output  etc. > > can i use a for loop (i in 57:n)  that plots only the out

Re: [R] string interpolation

2011-03-21 Thread Douglas Bates
On Mon, Mar 21, 2011 at 2:03 PM, Justin Haynes wrote: > Is there a way to do this in R? I have data in the form: > > 57_input  57_output  58_input  58_output  etc. > > can i use a for loop (i in 57:n)  that plots only the outputs?  I want > this to be robust so im not specifying a column id but ra

[R] string interpolation

2011-03-21 Thread Justin Haynes
Is there a way to do this in R? I have data in the form: 57_input 57_output 58_input 58_output etc. can i use a for loop (i in 57:n) that plots only the outputs? I want this to be robust so im not specifying a column id but rather something like c++ code, %s_input, i is that doable in R?

Re: [R] Stucked with as.numeric function

2011-03-21 Thread Kenn Konstabel
On Mon, Mar 21, 2011 at 5:57 PM, wrote: > Hi list, > > I have problems with the as.numeric function. I have imported probabilities > from external data, but they are classified as factors as str() shows. > Therefore my goal is to convert the colum from factor to numeric level with > keeping the d

Re: [R] Stucked with as.numeric function

2011-03-21 Thread Tóth Dénes
Hi, I guess you have commas as decimals in your data. Replace it to decimal points. Best, Denes > > On Mar 21, 2011, at 1:57 PM, pat...@gmx.de wrote: > >> Hi list, >> >> I have problems with the as.numeric function. I have imported >> probabilities from external data, but they are classified

Re: [R] Stucked with as.numeric function

2011-03-21 Thread David Winsemius
On Mar 21, 2011, at 1:57 PM, pat...@gmx.de wrote: Hi list, I have problems with the as.numeric function. I have imported probabilities from external data, but they are classified as factors as str() shows. Therefore my goal is to convert the colum from factor to numeric level with keepin

Re: [R] Lat Lon NetCDF subset

2011-03-21 Thread David Pierce
hgreatrex wrote: > Hi, > > ... > I've managed to extract the lat / lon variables, so I know that I could > work > out manually which pixels correspond to which location. However, it's easy > to make a mistake in such a calculation, so I thought I would check here > before reinventing the wheel. Hi

Re: [R] odfWeave Error unzipping file in Win 7

2011-03-21 Thread rmailbox
I have a very similar error that cropped up when I upgraded to R 2.12 and persists at R 2.12.1. I am running R on Windows XP and OO is at version 3.2. I did not make any changes to my R code or ODF code or configuration to produce this error. Only upgraded R. Many Thanks, Eric R session: >

[R] Stucked with as.numeric function

2011-03-21 Thread patsko
Hi list, I have problems with the as.numeric function. I have imported probabilities from external data, but they are classified as factors as str() shows. Therefore my goal is to convert the colum from factor to numeric level with keeping the decimals. I have googled the problem for a while n

[R] Lat Lon NetCDF subset

2011-03-21 Thread hgreatrex
Hi, I'm trying to read a subset of a netcdf file into R, but although I'm relatively experienced using R, I'm still new to netCDF files, so this may be a very simple/stupid question! I've included an example of the type of file I'm looking at here. www.met.reading.ac.uk/~swp06hg/ccd1983_01-d

Re: [R] BFGS and Neldear-Mead

2011-03-21 Thread LC-Bea
Ravi please look my last mail. I tried again, and in my last mail i described the results, i reach the convergence but the values are still very diferent. thank you so much! Lucía -- View this message in context: http://r.789695.n4.nabble.com/BFGS-and-Neldear-Mead-tp3388017p3394334.html Sent f

[R] Clustering problem

2011-03-21 Thread Abhishek Pratap
Hi Guys I want to apply a clustering algo to my dataset in order to find the regions points(X,Y) which have similar values(percent_GC and mean_phred_quality). Details below. I have sampled 1% of points from my main data set of 85 million points. The result is still somewhat large 800K points and

Re: [R] Need help with error

2011-03-21 Thread Savitri N Appana
Thank you for your suggestion Allan. I should have paid attention to the posting instructions. Pls find below the sample code from the ?splsda in the caret package. Note: It used to work fine in R v2.8.1, but this error shows up now, given that I've modified the code on how the splsda or predi

[R] Randomly generating data

2011-03-21 Thread Lisa
Hi, everybody, I have a problem and need your help. There are two columns that look like this: [1,] "t" "f" [2,] "f" "t" [3,] "t" "f" [4,] "t" "t" [5,] "f" "f" I just want to generate the third column based on these two columns. First, I randomly choose one of the two columns, sa

Re: [R] Correlation for no of variables

2011-03-21 Thread Vincy Pyne
Thanks Mr Langfelder, Definitely I will go through the packages you have suggested. Actually, I will be multiplying three matrices of the order (1 X 1500)%*%(1500 X 1500) %*% (1500, 1) giving me one value at the end. I will be starting my process in a couple of days time and in between will re

Re: [R] Convert Sweave document to a function

2011-03-21 Thread Brian Diggs
On 3/20/2011 12:19 PM, David.Epstein wrote: I like Sweave, which I consider to be a great contribution. I have just written a .Rnw document that comes to about 6 pages of mixed code and mathematical explanation. Now I want to turn the R code into a function. My R code currently contains statement

Re: [R] help regarding RPostgreSQL and R 2.12.2

2011-03-21 Thread Gabor Grothendieck
On Mon, Mar 21, 2011 at 3:50 AM, Shaunak Bangale wrote: > Prof Ripley, > Thanks for the first reply. Yes, I am using windows xp. > The problem that I am facing is: > I want to use RPostgreSQL and xtable packages together. > R 2.11.1 has RPostgreSQL but not xtable.  R 2.12.2 has xtable but not > R

[R] lattice histogram and grouping

2011-03-21 Thread Evans, David G (DFG)
Hi, >From the following pseudo-code (tweaked from another user): library(lattice) variable<-sample(rep(1:2,100)) individual<-rep(1:3, length(variable)) group<-rep(LETTERS[1:2],length(variable)/2) mydata<-data.frame(variable,individual,group) individual<-as.factor(individual) group<-as.factor(group

Re: [R] Correlation for no of variables

2011-03-21 Thread Peter Langfelder
On Mon, Mar 21, 2011 at 8:34 AM, Vincy Pyne wrote: > Dear R helpers, > > Suppose I have stock returns data of say 1500 companies each for say last 4 > years. Thus I have a matrix of dimension say 1000 * 1500 i.e. 1500 columns > representing companies and 1000 rows of their returns. > > I need to

Re: [R] Sweave, white space and code blocks

2011-03-21 Thread Dennis Murphy
Hi: I have a template preamble file for Sweave; near the bottom, I put in this commented code some time ago so I would never forget it: %% -- %% IMPORTANT NOTE %% All Sweave tokens MUST begin in column 1 or they will be ignored

Re: [R] Curry with `[.function` ?

2011-03-21 Thread Gabor Grothendieck
On Mon, Mar 21, 2011 at 12:20 PM, Kenn Konstabel wrote: > On Mon, Mar 21, 2011 at 2:53 PM, Gabor Grothendieck > wrote: >> >> On Mon, Mar 21, 2011 at 8:46 AM, Kenn Konstabel >> wrote: >> > Dear all, >> > >> > I sometimes use the following function: >> > >> > Curry <- function(FUN,...) { >> >   #

Re: [R] recalling different data frames (the way you do in Excel VB but now) in

2011-03-21 Thread Ista Zahn
Hi Bodnar, The "R way" is to put the data frames in a list: id <-c(1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3) a <-c(3,1,3,3,1,3,3,3,3,1,3,2,1,2,1,3,3,2,1,1,1,3,1,3,3,3,2,1,1,3) b <-c(3,2,1,1,1,1,1,1,1,1,1,2,1,3,2,1,1,1,2,1,3,1,2,2,1,3,3,2,3,2) c <-c(1,3,2,3,2,1,2,3,3,2,2,3,1,2,3,

Re: [R] value changed after paste() function

2011-03-21 Thread Bert Gunter
Inline below. On Mon, Mar 21, 2011 at 8:18 AM, kellysong wrote: > Hi all, > > I am new user in R, I am trying to to use paste function to concatenate > strings which has been fetched from database table(postgres database), the > following are my code: > > when i do: >  > sqlFetch(channel,'transac

Re: [R] Curry with `[.function` ?

2011-03-21 Thread Kenn Konstabel
On Mon, Mar 21, 2011 at 2:53 PM, Gabor Grothendieck wrote: > On Mon, Mar 21, 2011 at 8:46 AM, Kenn Konstabel > wrote: > > Dear all, > > > > I sometimes use the following function: > > > > Curry <- function(FUN,...) { > > # by Byron Ellis, > > https://stat.ethz.ch/pipermail/r-devel/2007-Novembe

[R] recalling different data frames (the way you do in Excel VB)

2011-03-21 Thread Bodnar Laszlo EB_HU
Hello everyone, I'd like to ask you a question again, basically focusing on referring to different objects. Let's suppose we create the following databases this way: id <-c(1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3) a <-c(3,1,3,3,1,3,3,3,3,1,3,2,1,2,1,3,3,2,1,1,1,3,1,3,3,3,2,1

[R] recalling different data frames (the way you do in Excel VB but now) in

2011-03-21 Thread Bodnar Laszlo EB_HU
Hello everyone, I'd like to ask you a question again, basically focusing on referring to different objects. Let's suppose we create the following databases this way: id <-c(1,1,1,1,1,1,1,1,1,1,2,2,2,2,2,2,2,2,2,2,3,3,3,3,3,3,3,3,3,3) a <-c(3,1,3,3,1,3,3,3,3,1,3,2,1,2,1,3,3,2,1,1,1,3,1,3,3,3,2,1

[R] binary data with correlation

2011-03-21 Thread yvonne fabian
Dear posters, I have a question concerning binary data analysis. I have presence absence data of 5 sampling sessions within 3 years, of 12 fields. Each field had 12 traps. I would like to analyse the data with a Generalized Estimating Equations (GEE) Model in R. For the abundance data I used a gls

[R] value changed after paste() function

2011-03-21 Thread kellysong
Hi all, I am new user in R, I am trying to to use paste function to concatenate strings which has been fetched from database table(postgres database), the following are my code: when i do: > sqlFetch(channel,'transactions') outputs are following(only parts, there are around 200 transactions in

Re: [R] appending collums in for loop

2011-03-21 Thread Scott Chamberlain
I can't reproduce your work, but I think you just need > regionMatchABCDE[,i] <- cbind(regionMatch[,10:18]) instead of regionMatchABCDE <- cbind(regionMatch[,10:18]) within the for loop Scott On Monday, March 21, 2011 at 7:36 AM, Who Am I? wrote: Hoi All, > > I am trying to append collums

Re: [R] BFGS and Neldear-Mead

2011-03-21 Thread LC-Bea
I´m triying to give you more information -other function (the problem its the same with both) pen.wls<-function(x){ ax<-x[32:40] indice<-x[1:31] bx<-x[41:49] awlsbind1<-matrix(rep(ax,31),nrow=9,ncol=31) indice<-as.vector(indice-mean(indice)) bx<-as.vector(bx/sum(bx)) me<-(awlsbind1+bx%*%t(indice)

[R] Sweave, white space and code blocks

2011-03-21 Thread David.Epstein
Sweave is very useful, and I'm gradually getting used to it. I've just been battling Sweave over the re-use of code chunks. As I am pretty ignorant in the byways of both Sweave and R, this took a chunk of time to sort out. Here is what I learned: If one re-uses a code chunk, then Sweave (but not

[R] Correlation for no of variables

2011-03-21 Thread Vincy Pyne
Dear R helpers, Suppose I have stock returns data of say 1500 companies each for say last 4 years. Thus I have a matrix of dimension say 1000 * 1500 i.e. 1500 columns representing companies and 1000 rows of their returns. I need to find the correlation matrix of these 1500 companies. So I can

Re: [R] Curry with `[.function` ?

2011-03-21 Thread Gabor Grothendieck
On Mon, Mar 21, 2011 at 8:46 AM, Kenn Konstabel wrote: > Dear all, > > I sometimes use the following function: > > Curry <- function(FUN,...) { >   # by Byron Ellis, > https://stat.ethz.ch/pipermail/r-devel/2007-November/047318.html >   .orig <- list(...) >   function(...) do.call(FUN,c(.orig,list

Re: [R] BFGS and Neldear-Mead

2011-03-21 Thread Ravi Varadhan
Yes, your "optimx" result tells me that Nelder-Mead did not converge. It was terminated because it exceeded the maximum number of iterations allowed. In "optimx" you can increase the `itnmax' argument from its default value to accomplish this. Ravi. --

Re: [R] strange PREDICTIONS from a PIECEWISE LINEAR (mixed) MODEL

2011-03-21 Thread Kevin Wright
1. Try using set.seed for better reproducibility. 2. Does this really work for you? I get mydf <- data.frame(x, y,id) mod2<-lme(y ~ x + x*(x>-1), random=~x|id, + data=mydf) Error in lme.formula(y ~ x + x * (x > -1), random = ~x | id, data = mydf) : nlminb problem, convergence error c

Re: [R] appending collums in for loop

2011-03-21 Thread stephen sefick
I don't think I understand. Can you work up a dummy example that will run independent of your actual data, and produce the problem? This will help everyone diagnose the problem. Naively this sounds like an indexing problem. Stephen On Mon, Mar 21, 2011 at 7:56 AM, Who Am I? wrote: > I forgot

Re: [R] appending collums in for loop

2011-03-21 Thread Who Am I?
I forgot to say I need it to work in a for loop because it will be used for over 35 files. I previously programmed it in the most unorthodox way possible: setwd("J:/Stage/Datasets2/Datasets/outData") data1<-read.table("AR1000900A_N_241110_(Mapping250K_Nsp)_2,Mapping250K_Nsp,CNprobes.tab _SNP_IDs.x

[R] appending collums in for loop

2011-03-21 Thread Who Am I?
Hoi All, I am trying to append collums to a data frame in a for loop. I read in tables, do some processing and then write the result to a data.frame. But, the thing I want is, that the results are appended to the data frame in stead of overwriting the results of the prevous table. It has to look s

Re: [R] BFGS and Neldear-Mead

2011-03-21 Thread LC-Bea
Sorry for posting too much! i found that in Nelder-Mead the result is "1" i run this algorith too many times with several data maybe the problem is that i have to give a bigger number of iterations Lucía -- View this message in context: http://r.789695.n4.nabble.com/BFGS-and-Neldear-Mead-tp3

[R] appending collums in for loop

2011-03-21 Thread Who Am I?
Hoi All, I am trying to append collums to a data frame in a for loop. I read in tables, do some processing and then write the result to a data.frame. But, the thing I want is, that the results are appended to the data frame in stead of overwriting the results of the prevous table. It has to look s

Re: [R] BFGS and Neldear-Mead

2011-03-21 Thread LC-Bea
i´ve tried with optimx these are the results pleae help me with this... i´m triying to understand what they mean... > lcmleQN

Re: [R] Package Installation

2011-03-21 Thread Joshua Ulrich
On Sun, Mar 20, 2011 at 2:42 PM, Bogaso Christofer wrote: > Dear all, can somebody guide me how to install the package RQuantLib, for > which windows binary is not available. I have tried installing it with R CMD > INSTALL in my windows vista machine (I have Rtools installed), however it > stopped

[R] Curry with `[.function` ?

2011-03-21 Thread Kenn Konstabel
Dear all, I sometimes use the following function: Curry <- function(FUN,...) { # by Byron Ellis, https://stat.ethz.ch/pipermail/r-devel/2007-November/047318.html .orig <- list(...) function(...) do.call(FUN,c(.orig,list(...))) } ... and have thought it might be convenient to have a m

Re: [R] Combination that adds a value

2011-03-21 Thread Petr Savicky
On Mon, Mar 21, 2011 at 04:08:50AM -0700, Julio Rojas wrote: > Dear all, I have three vectors "x<-1:n", "y<-1:m" and "z<-2:(n+m)". I need to > find all combinations of "x" and "y" that add up a given value of "z", e.g., > for "z==3" the combinations will be "list(c(1,2),c(2,1))". Dear Julio: T

Re: [R] linear regression in a ragged array

2011-03-21 Thread David Winsemius
On Mar 21, 2011, at 5:25 AM, Marcel Curlin wrote: Hello, I have a large dataset of the form subj var1 var2 001100200 001120226 001130238 001140245 001150300 002110205 002125209 003101233 003115254 I would like to perf

Re: [R] BFGS and Neldear-Mead

2011-03-21 Thread LC-Bea
Thank you for your answer! the message that gives as result is 0, successful completion so that point wouldnt be the problem sorry if my english its not good (i speak spanish!) thanks! -- View this message in context: http://r.789695.n4.nabble.com/BFGS-and-Neldear-Mead-tp3388017p3393173.

Re: [R] rqss help in Quantreg

2011-03-21 Thread Roger Koenker
On Mar 20, 2011, at 10:24 PM, Man Zhang wrote: > Dear All, > > I'm trying to construct confidence interval for an additive quantile > regression > model. > > In the quantreg package, vignettes section: Additive Models for Conditional > Quantiles > http://cran.r-project.org/web/packages/quant

[R] linear regression in a ragged array

2011-03-21 Thread Marcel Curlin
Hello, I have a large dataset of the form subj var1 var2 001100200 001120226 001130238 001140245 001150300 002110205 002125209 003101233 003115254 I would like to perform linear regression of var2 on var1 for each subj

Re: [R] BFGS and Neldear-Mead

2011-03-21 Thread LC-Bea
hello! this is one of the two functions i use pen.mle<-function(x){ ax<-x[32:40] indice<-x[1:31] bx<-x[41:49] amlebind1<-matrix(rep(ax,31),nrow=9,ncol=31) mv<-(-(defunciones*log((exp(amlebind1+bx%*%t(indice)))*poblacion)-((exp(amlebind1+bx%*%t(indice)))*poblacion))) result<-sum(mv)+10*su

Re: [R] exploring dist()

2011-03-21 Thread bra86
dear all, thanks it helped a lot, the problem was that I should treat my data as set of species, not samples, so as output I get 4087*4087 matrix, which afterwards will be applied for PCO, the thing was, that in cause of big number of values, programm do not show all computed distances and even

Re: [R] R as a non-functional language

2011-03-21 Thread ONKELINX, Thierry
Dear Russ, Why not use simply pH <- c(area1 = 4.5, area2 = 7, mud = 7.3, dam = 8.2, middle = 6.3) That notation is IMHO the most readable for students. Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur

[R] Combination that adds a value

2011-03-21 Thread Julio Rojas
Dear all, I have three vectors "x<-1:n", "y<-1:m" and "z<-2:(n+m)". I need to find all combinations of "x" and "y" that add up a given value of "z", e.g., for "z==3" the combinations will be "list(c(1,2),c(2,1))". Thanks in advance for your help.

[R] Mixed modelling course in Halifax

2011-03-21 Thread Highland Statistics
Apologies for cross-posting We would like to announce a mixed effects modelling course in Halifax, Canada. June 2011. For details, see: http://www.highstat.com/statscourse.htm Kind regards, Alain Zuur __ R-help@r-project.org mailing list https://

Re: [R] predicting values from multiple regression

2011-03-21 Thread Anna Lee
Dennis: thank you so much! I got it now and it works just perfectly. Thanks a lot to the others too! Anna 2011/3/21 Dennis Murphy : > Hi: > > To amplify Ista's and David's comments: > > (1) You should not be inputting separate vectors into lm(), especially if > you intend to do prediction. They sh

Re: [R] predicting values from multiple regression

2011-03-21 Thread Anna Lee
Dennis: Thank you so much! I got it now - it just works perfectly. Thanks a lot! Anna 2011/3/21 Dennis Murphy : > Hi: > > To amplify Ista's and David's comments: > > (1) You should not be inputting separate vectors into lm(), especially if > you intend to do prediction. They should be combined int

Re: [R] Feature request: rating/review system for R packages

2011-03-21 Thread Jim Lemon
On 03/21/2011 04:33 AM, Janko Thyson wrote: ... Hi Janko, As Dieter said, Crantastic is an opportunity for R users to give both quickie ratings and reviews of packages. I have to say that doing a review isn't trivial. I feel that I should use a package for a while before I can review it, and th

Re: [R] Number of edges in a graph

2011-03-21 Thread Peter Ehlers
?ecount Peter Ehlers On 2011-03-20 22:02, kparamas wrote: Hi, I have a igraph graph object. g<- watts.strogatz.game(1, 100, 5, 0.05) If I have the summary of g, it prints summary(g) Vertices: 100 Edges: 500 Directed: FALSE No graph attributes. No vertex attributes. No edge attributes. How

Re: [R] Replacing Period in String

2011-03-21 Thread Petr Savicky
On Sun, Mar 20, 2011 at 11:49:05PM -0500, Sparks, John James wrote: > Dear R Users, > > I am working with gsub for the first time. I am trying to remove some > characters from a string. I have hit the problem where the period is the > shorthand for 'everything' in the R language when what I want

Re: [R] Number of edges in a graph

2011-03-21 Thread Petr Savicky
On Sun, Mar 20, 2011 at 10:02:10PM -0700, kparamas wrote: > Hi, > > I have a igraph graph object. > g <- watts.strogatz.game(1, 100, 5, 0.05) > > If I have the summary of g, it prints > > summary(g) > Vertices: 100 > Edges: 500 > Directed: FALSE > No graph attributes. > No vertex attributes. >

Re: [R] help regarding RPostgreSQL and R 2.12.2

2011-03-21 Thread Shaunak Bangale
Prof Ripley, Thanks for the first reply. Yes, I am using windows xp. The problem that I am facing is: I want to use RPostgreSQL and xtable packages together. R 2.11.1 has RPostgreSQL but not xtable. R 2.12.2 has xtable but not RPostgreSQL. I suppose there should be some way to use RPostgreSQL wit

[R] R part of Google Summer of Code 2011

2011-03-21 Thread Prof. John C Nash
Last Friday we learned that R is accepted again for the Google Summer of Code. R's "ideas" are at http://rwiki.sciviews.org/doku.php?id=developers:projects:gsoc2011 On that page is a link to our google groups list for mentors and prospective students. See http://www.google-melange.com/ for the

Re: [R] Package Installation

2011-03-21 Thread Prof Brian Ripley
On Mon, 21 Mar 2011, Bogaso Christofer wrote: Dear all, can somebody guide me how to install the package RQuantLib, for which windows binary is not available. I have tried installing it with R CMD INSTALL in my windows vista machine (I have Rtools installed), however it stopped due to an error s

Re: [R] help regarding RPostgreSQL and R 2.12.2

2011-03-21 Thread Prof Brian Ripley
On Mon, 21 Mar 2011, Shaunak Bangale wrote: Prof Ripley, Thanks for the first reply. Yes, I am using windows xp. The problem that I am facing is: I want to use RPostgreSQL and xtable packages together. R 2.11.1 has RPostgreSQL but not xtable. R 2.12.2 has xtable but not RPostgreSQL. I suppose

[R] Sample size of longitudinal and skewed data

2011-03-21 Thread Lao Meng
Hi all: I have a question about the sample size calculation. It's a pilot study,which includes 2 groups(low,high),3 time point(3,6,9 monthes).Each person has 3 results which according to the 3 time points.So it's a longitudinal study. I want to calculate the minimum sample size from the pilot st

  1   2   >