Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Indrajit Sen Gupta
We recently benchmarked our R Server (Intel Xeon 2.2GHz, 128 GB RAM, Centos 6.2 running R 2.15.2 64bit) where we tested various read / write / data manipulation times. A 6 GB dataset took around 15 minutes to read without colClassses. The dataset had around 10 million rows and 14 columns. Wer

Re: [R] using metafor for meta-analysis of before-after studies

2013-04-26 Thread Qiang Yue
Hello, Dr. Viechtbauer. I am trying to perform a meta-analyis on a group of before-after studies using Metafor. I read your webpage including your correspondence with Dr. Dewey (https://stat.ethz.ch/pipermail/r-help/2012-April/308946.html), who also conducted a similar study. These information

Re: [R] C50 package in R

2013-04-26 Thread Indrajit Sen Gupta
Thanks Max, I have been able to figure out the following options so far: 1. The winnow = TRUE option in the control statement 2. CF = . I have no clue as to how this works 3. nGlobalPruning = TRUE 4. minCases = Only the 4th one is simple to understand. The rest are a bit vague as to how

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Kevin Hao
Thank you very much. More and more methods are coming. That sounds great! Thanks, kevin On Fri, Apr 26, 2013 at 7:51 PM, Duncan Murdoch wrote: > On 13-04-26 3:00 PM, Kevin Hao wrote: > >> Hi Ye, >> >> Thanks. >> >> That is a good method. have any other methods instead of using database? >>

Re: [R] csv file with two header rows

2013-04-26 Thread David Winsemius
On Apr 25, 2013, at 6:35 PM, analys...@hotmail.com wrote: > Is there a way to use read.csv() on such a file without deleting one > of the header rows? > What do you mean by "one of the header rows"? -- David Winsemius Alameda, CA, USA __ R-help@r-p

Re: [R] Fwd: converting character matrix to POSIXct matrix

2013-04-26 Thread David Winsemius
On Apr 26, 2013, at 3:12 PM, hh wt wrote: > I thought i copy the list for the few suggestions i received privately. > > Thanks to David Winsemius for pointing out that elements of a matrix must > be atomic. POSIX objects are list, so won't work. I did state the first point. I didn't actually sa

Re: [R] Regression coefficients

2013-04-26 Thread Jeff Newmiller
?coef There are many introductory texts on R... I recommend getting a few. --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go...

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Duncan Murdoch
On 13-04-26 3:00 PM, Kevin Hao wrote: Hi Ye, Thanks. That is a good method. have any other methods instead of using database? If you know the format of the file, you can probably write something in C (or other language) that is faster than R. Convert your .csv file to a nice binary format,

[R] prcomp( and cmdscale( not equivalent?

2013-04-26 Thread Bob Wiley
Hello, I have a dilemma that I'm hoping the R gurus will be able to help resolve. For background: My data is in the form of a (dis)similarity matrix created from taking the inverse of normalized reaction times. That is, each cell of the matrix represents how long it took to distinguish two stimuli

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Horace Tso
Long long time ago in a galaxy far far away, I've played with the LaF package for reading large CSV files. But it's been a while and I don't remember its performance and limitations. Give it a trial. Horace -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun..

[R] Fwd: converting character matrix to POSIXct matrix

2013-04-26 Thread hh wt
I thought i copy the list for the few suggestions i received privately. Thanks to David Winsemius for pointing out that elements of a matrix must be atomic. POSIX objects are list, so won't work. But data frame is an option, as suggested by arun below. res<-data.frame(lapply(seq_len(ncol(time.m

Re: [R] converting character matrix to POSIXct matrix

2013-04-26 Thread Rui Barradas
Hello, You should keep this on the list, the odds of getting more and better answers are greater. I don't know if the following is what you want. apply(time.m, 2, function(tt) as.POSIXct(tt, format = "%H:%M:%OS")) Hope this helps, Rui Barradas Em 26-04-2013 21:49, hh wt escreveu: sapply

Re: [R] Help with merge function

2013-04-26 Thread arun
Hi, Check whether this works. Lines1<-readLines("NS_update.txt") x1<-read.table(text=gsub('\"',"",Lines1),sep=",",header=TRUE,stringsAsFactors=FALSE)  x2<- read.table("data.txt",sep="",header=TRUE,stringsAsFactors=FALSE,fill=TRUE)  dim(x2) #[1] 34577   189 library(plyr)  res<- join(x1,x2,type="r

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Kevin Hao
Hi Ye, Thanks. That is a good method. have any other methods instead of using database? kevin On Fri, Apr 26, 2013 at 1:58 PM, Ye Lin wrote: > Have you think of build a database then then let R read it thru that db > instead of your desktop? > > > On Fri, Apr 26, 2013 at 8:09 AM, Kevin Hao

Re: [R] Help with merge function

2013-04-26 Thread arun
Hi, >From the output you wanted, it looks like: library(plyr) join(x1,x2,type="right") #Joining by: State_prov, Shape_name, bob2009, bob2010  #  State_prov Shape_name bob2009 bob2010 bob2011 FID coy2009 #1 Nova Scotia  Annapolis   0   0   1   0  10 #2 Nova Scotia Antigonish   0 

Re: [R] Vectorized code for generating the Kac (Clement) matrix

2013-04-26 Thread Ravi Varadhan
Thank you, Berend and Enrico, for looking into this. I did not think of Enrico's clever use of cbind() to form the subsetting indices. Best, Ravi From: Berend Hasselman [b...@xs4all.nl] Sent: Friday, April 26, 2013 10:08 AM To: Enrico Schumann Cc: Ravi V

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Kevin Hao
Thanks. I will try break into pieces to analysis. Kevin On Fri, Apr 26, 2013 at 4:38 PM, Ye Lin wrote: > I can not think of sth better. Maybe try read part of the data that you > want to analyze, basically break the large data set into pieces. > > > On Fri, Apr 26, 2013 at 10:58 AM, Ye Lin w

Re: [R] converting character matrix to POSIXct matrix

2013-04-26 Thread arun
time.m<- as.matrix(read.table(text=' "08:00:20.799" "08:00:20.799" "08:00:20.799" "08:00:20.799" "08:00:20.799" "08:00:21.996" "08:00:22.071" "08:00:23.821" "08:00:24.370" "08:00:25.573" "08:00:29.200" "08:00:29.200" "08:00:29.591" "08:00:30.368" "08:00:30.536" "08:00:31.073" "08:00:31.372" "08:0

Re: [R] Help with merge function

2013-04-26 Thread Rui Barradas
Hello, I don't understand the question, what range? I've just changed the 'all' argument to 'all.y', without doing anything special to the variables. Can you explain what you mean? Rui Barradas Em 26-04-2013 19:30, Catarina Ferreira escreveu: Hello, Thank you for your help. However the data

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Kevin Hao
Thanks lcn, I will try to read data from different chunks. Best, Kevin On Fri, Apr 26, 2013 at 3:05 PM, lcn wrote: > Do you really have the need loading all the data into memory? > > Mostly for large data set, people would just read a chunk of it for > developing analysis pipeline, and when

[R] example

2013-04-26 Thread Iut Tri Utami
Dear Sir, My name is Iut Tri Utami. i am beginning user. I have a problem about generate data in R. It consists of one disk generated by a Gaussian N(0, 0.167) and one ring generated by a Gaussian N(R, 0.1). The mean R was generated from its polar coordinates. The angle was drawn from a uniform di

Re: [R] Help with merge function

2013-04-26 Thread arun
Hi, The format is bit messed up.  So, not sure this is what you wanted. x1<- read.table(text="State_prov,Shape_name,bob2009,bob2010,bob2011 Nova Scotia,Annapolis,0,0,1 Nova Scotia,Antigonish,0,0,0 Nova Scotia,Gly,NA,NA,NA ",sep=",",header=TRUE,stringsAsFactors=FALSE) x2<- read.table(text=" FID,S

Re: [R] Help with merge function

2013-04-26 Thread Catarina Ferreira
Hello, Thank you for your help. However the dataframes I gave you were only examples, the actual dataframes are very big. Does this mean I have to write every range of data for each variable?? On Fri, Apr 26, 2013 at 2:25 PM, Rui Barradas wrote: > Hello, > > The following seems to do the trick.

Re: [R] speed of a vector operation question

2013-04-26 Thread William Dunlap
R's findInterval can also take advantage of a sorted x vector. E.g., in R-3.0.0 on the same 8-core Linux box: > x <- rexp(1e6, 2) > system.time(for(i in 1:100)tabulate(findInterval(x, c(-Inf, .3, .5, Inf)))[2]) user system elapsed 2.444 0.000 2.446 > xs <- sort(x) > system.time(for(i in

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Ye Lin
I can not think of sth better. Maybe try read part of the data that you want to analyze, basically break the large data set into pieces. On Fri, Apr 26, 2013 at 10:58 AM, Ye Lin wrote: > Have you think of build a database then then let R read it thru that db > instead of your desktop? > > > On

Re: [R] speed of a vector operation question

2013-04-26 Thread Martin Morgan
A very similar question was asked on StackOverflow (by Mikhail? and then I guess the answers there were somehow not satisfactory...) http://stackoverflow.com/questions/16213029/more-efficient-strategy-for-which-or-match where it turns out that a binary search (implemented in R) on the sorted v

Re: [R] speed of a vector operation question

2013-04-26 Thread William Dunlap
> I think the sum way is the best. On my Linux machine running R-3.0.0 the sum way is slightly faster: > x <- rexp(1e6, 2) > system.time(for(i in 1:100)sum(x>.3 & x<.5)) user system elapsed 4.664 0.340 5.018 > system.time(for(i in 1:100)length(which(x>.3 & x<.5))) user s

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Martin Morgan
On 04/26/2013 08:09 AM, Kevin Hao wrote: Hi all scientists, Recently, I am dealing with big data ( >3G txt or csv format ) in my desktop (windows 7 - 64 bit version), but I can not read them faster, thought I search from internet. [define colClasses for read.table, cobycol and limma packages I

Re: [R] NMDS in Vegan: problems in stressplot, best solution

2013-04-26 Thread Gavin Simpson
On Fri, 2013-04-26 at 12:42 -0500, Kumar Mainali wrote: > Hello, > > I can draw a basic stress plot for NMDS with the following code in package > Vegan. > > stressplot(parth.mds, parth.dis) > > When I try to specify the line and point types, it gives me error message. > > stressplot(parth.mds, pa

[R] Regression coefficients

2013-04-26 Thread Preetam Pal
Hi all, I have run a ridge regression as follows: reg=lm.ridge(final$l~final$lag1+final$lag2+final$g+final$g+final$u, lambda=seq(0,10,0.01)) Then I enter : select(reg) and it returns: modified HKB estimator is 19.3409 modified L-W estimator is 36.18617

Re: [R] speed of a vector operation question

2013-04-26 Thread lcn
I think the sum way is the best. On Fri, Apr 26, 2013 at 9:12 AM, Mikhail Umorin wrote: > Hello, > > I am dealing with numeric vectors 10^5 to 10^6 elements long. The values > are > sorted (with duplicates) in the vector (v). I am obtaining the length of > vectors such as (v < c) or (v > c1 & v

Re: [R] [newbie] how to find and combine geographic maps with particular features?

2013-04-26 Thread MacQueen, Don
If someone else hasn't suggested it already, you will probably get more/better help on the R-sig-geo mailing list. (if you decide to repost there, just mention up front that it's a repost and why) -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread lcn
Do you really have the need loading all the data into memory? Mostly for large data set, people would just read a chunk of it for developing analysis pipeline, and when that's done, the ready script would just iterate through the entire data set. For example, the read.table function has 'nrow' and

Re: [R] How to export graph value in R

2013-04-26 Thread Thomas Adams
Anup, You should have provided some additional information, such as that the function 'hypsometric' is found in the hydroTSM contributed package. Nevertheless, here's what I did (maybe not elegant, but it works) : (1) at the R command prompt simply type hypsometric -- the source code for the func

[R] Stratified Random Sampling Proportional to Size

2013-04-26 Thread Lopez, Dan
Hello R Experts, I kindly request your assistance on figuring out how to get a stratified random sampling proportional to 100. Below is my r code showing what I did and the error I'm getting with sampling::strata # FIRST I summarized count of records by the two variables I want to use as stra

Re: [R] converting character matrix to POSIXct matrix

2013-04-26 Thread Rui Barradas
Hello, Use sapply instead. Hope this helps, Rui Barradas Em 26-04-2013 18:51, hh wt escreveu: I thought this is a common question but rseek/google searches don't yield any relevant hit. I have a matrix of character strings, which are time stamps, time.m[1:5,1:5] [,1] [,2]

Re: [R] Help with merge function

2013-04-26 Thread Rui Barradas
Hello, The following seems to do the trick. x1 <- structure(list(State_prov = c("Nova Scotia", "Nova Scotia", "Nova Scotia" ), Shape_name = c("Annapolis", "Antigonish", "Gly"), bob2009 = c(0L, 0L, NA), bob2010 = c(0L, 0L, NA), bob2011 = c(1L, 0L, NA)), .Names = c("State_prov", "Shape_name", "

Re: [R] C50 package in R

2013-04-26 Thread Max Kuhn
There isn't much out there. Quinlan didn't open source the code until about a year ago. I've been through the code line by line and we have a fairly descriptive summary of the model in our book (that's almost out): http://appliedpredictivemodeling.com/ I will say that the pruning is mostly the

Re: [R] Read big data (>3G ) methods ?

2013-04-26 Thread Ye Lin
Have you think of build a database then then let R read it thru that db instead of your desktop? On Fri, Apr 26, 2013 at 8:09 AM, Kevin Hao wrote: > Hi all scientists, > > Recently, I am dealing with big data ( >3G txt or csv format ) in my > desktop (windows 7 - 64 bit version), but I can not

Re: [R] Error Installing packages

2013-04-26 Thread Pramod Anugu
I am trying to install the package boss but i am getting error below: Please advice install.packages("boss") --- Please select a CRAN mirror for use in this session --- CRAN mirror 1: 0-Cloud 2: Argentina (La Plata) 3: Argentina (Mendoza) 4: Australia (Canber

[R] Help with merge function

2013-04-26 Thread Catarina Ferreira
Dear all, I'm trying to merge 2 dataframes, but I'm not being entirely successful and I can't understand why. Dataframe x1 State_prov Shape_name bob2009 bob 2010 bob2011 Nova ScotiaAnnapolis 0 0 1 Nova ScotiaAntigonish0

[R] Questions about out-of-sample forecast using random walk

2013-04-26 Thread Wandi Zhou
Hi there, I'm a bit confused about which command should I use when performing an out-of-sample forecast using random walk. I have som time sereis data from 1957Q1 to 2011Q4, I want to use a fraction of data from 1960Q1 to 1984Q4 to forecast data from 1985Q1 onwards using random walk model and

[R] converting character matrix to POSIXct matrix

2013-04-26 Thread hh wt
I thought this is a common question but rseek/google searches don't yield any relevant hit. I have a matrix of character strings, which are time stamps, > time.m[1:5,1:5] [,1] [,2] [,3] [,4] [,5] [1,] "08:00:20.799" "08:00:20.799" "08:00:20.799" "08:0

[R] speed of a vector operation question

2013-04-26 Thread Mikhail Umorin
Hello, I am dealing with numeric vectors 10^5 to 10^6 elements long. The values are sorted (with duplicates) in the vector (v). I am obtaining the length of vectors such as (v < c) or (v > c1 & v < c2), where c, c1, c2 are some scalar variables. What is the most efficient way to do this? I am

Re: [R] Splitting data.frame and saving to csv files

2013-04-26 Thread arun
Hi, Just noticed a mistake: lst1 should be: lst1<-lapply(split(colnames(df)[-1],gsub("_.*","",colnames(df)[-1])),function(x) {x1<-cbind(date=df[,1],df[,x]); cbind(date=df[,1],df[x])})  lst1 #$ABC  #   date    ABC_f    ABC_e    ABC_d    ABC_m #1 2013-04-15 62.80740 11.36784 38.71090 40.28474

Re: [R] Splitting data.frame and saving to csv files

2013-04-26 Thread arun
Hi, You can do this:   lst1<-lapply(split(colnames(df)[-1],gsub("_.*","",colnames(df)[-1])),function(x) {x1<-cbind(date=df[,1],df[,x]);colnames(x1)[-1]<- x;x1})  lst1 #$ABC  #   date    ABC_f    ABC_e    ABC_d    ABC_m #1 2013-04-15 62.80740 11.36784 38.71090 40.28474 #2 2013-04-14 81.04526 6

[R] Read big data (>3G ) methods ?

2013-04-26 Thread Kevin Hao
Hi all scientists, Recently, I am dealing with big data ( >3G txt or csv format ) in my desktop (windows 7 - 64 bit version), but I can not read them faster, thought I search from internet. [define colClasses for read.table, cobycol and limma packages I have use them, but it is not so fast]. Cou

[R] NMDS in Vegan: problems in stressplot, best solution

2013-04-26 Thread Kumar Mainali
Hello, I can draw a basic stress plot for NMDS with the following code in package Vegan. > stressplot(parth.mds, parth.dis) When I try to specify the line and point types, it gives me error message. > stressplot(parth.mds, parth.dis, pch=1, p.col="gray", lwd=2, l.col="red") Error in plot.xy(xy, t

Re: [R] Stepwise regression for multivariate case in R?

2013-04-26 Thread Frank Harrell
Since stepwise methods do not work as advertised in the univariate case I'm wondering why they should work in the multivariate case. Frank Jonathan Jansson wrote > Hi! I am trying to make a stepwise regression in the multivariate case, > using Wilks' Lambda test. > I've tried this: >> greedy.wil

Re: [R] Decomposing a List

2013-04-26 Thread William Dunlap
You might add vapply() to you repertoire, as it is quicker than sapply but also does some error checking on the your input data. E.g., your f2 returns a matrix whose columns are the elements of the list l and you assume that there each element of l contains 2 character strings. f2 <- function(

Re: [R] the joy of spreadsheets (off-topic)

2013-04-26 Thread S Ellison
> From a quick read, the Excel error prior for incompetence > looks high but some of the other issues hint that the prior > for the overall findings was remarkably in favor of malice. That's p(malice|evidence), not p(malice); surely that must be the posterior? ;-) 'tain't a great advert fo

Re: [R] the joy of spreadsheets (off-topic)

2013-04-26 Thread John Kane
>From a quick read, the Excel error prior for incompetence looks high but >some of the other issues hint that the prior for the overall findings was >remarkably in favor of malice. John Kane Kingston ON Canada > -Original Message- > From: s.elli...@lgcgroup.com > Sent: Fri, 26 Apr 20

Re: [R] the joy of spreadsheets (off-topic)

2013-04-26 Thread William Dunlap
> The prior for the incompetence/malice question is usually best set pretty > heavily in > favour of incompetence ... The following comment on economic research is from a 2010 article in the Atlantic reviewing John Ioannidis' work. http://www.theatlantic.com/magazine/print/2010/11/lies-damned-li

Re: [R] the joy of spreadsheets (off-topic)

2013-04-26 Thread S Ellison
> One might wonder if the "Excel error" was indeed THAT or > perhaps a way to get the desired results, give the other > issues in their analysis? The prior for the incompetence/malice question is usually best set pretty heavily in favour of incompetence ... S *

Re: [R] time series plot: x-axis problem

2013-04-26 Thread Rui Barradas
Hello, Em 26-04-2013 14:30, arun escreveu: Hi, labs <- format(as.Date(time(rr)), "%b-%Y") #Error in as.Date.default(time(rr)) : # do not know how to convert 'time(rr)' to class “Date” #I guess this needs library(zoo) You're right, I forgot because it was already loaded prior to running

Re: [R] Print occurrence / positions of words

2013-04-26 Thread S Ellison
> >I have tried some different packages in order to build a R program > which will take as input a text file, produce a list of the > words inside that file. Each word should have a vector with > all the places that this word exist in the file. How about txt <- paste(rep("this is a nice text

Re: [R] nls: example code throws error

2013-04-26 Thread Duncan Murdoch
On 13-04-26 10:14 AM, Ben Bolker wrote: Keith Jewell campden.co.uk> writes: Others have pointed out that the error is probably from an unclean environment. Completely OT, but "an unclean environment" sounds sort of scary to me. Like it contains zombies or something. Isn't that accurate

Re: [R] Weighted Principle Components analysis

2013-04-26 Thread David Carlson
When you run an unweighted analysis on all three systems, do the scores agree? I would have expected that replicating the observations would give you similar results. You might be able to run the weighted analysis using princomp() instead of principal since you can supply data and a covariance mat

Re: [R] nls: example code throws error

2013-04-26 Thread Ben Bolker
Keith Jewell campden.co.uk> writes: > Others have pointed out that the error is probably from an unclean > environment. > Completely OT, but "an unclean environment" sounds sort of scary to me. Like it contains zombies or something. I don't know a better, short way to express the idea though

Re: [R] Vectorized code for generating the Kac (Clement) matrix

2013-04-26 Thread Berend Hasselman
On 26-04-2013, at 14:42, Enrico Schumann wrote: > On Thu, 25 Apr 2013, Ravi Varadhan writes: > >> Hi, I am generating large Kac matrices (also known as Clement matrix). >> This a tridiagonal matrix. I was wondering whether there is a >> vectorized solution that avoids the `for' loops to the f

Re: [R] time series plot: x-axis problem

2013-04-26 Thread arun
Hi, labs <- format(as.Date(time(rr)), "%b-%Y") #Error in as.Date.default(time(rr)) :  # do not know how to convert 'time(rr)' to class “Date” #I guess this needs library(zoo) library(zoo)  labs <- format(as.Date(time(rr)), "%b-%Y") sessionInfo() R version 3.0.0 (2013-04-03) Platform: x86_64-

Re: [R] Looping through names of both dataframes and column-names

2013-04-26 Thread Daniel Egan
Much thanks Blaser. That worked perfectly. This will improve my code considerably. Greatly appreciated. Regards, Dan On Fri, Apr 26, 2013 at 3:48 AM, Blaser Nello wrote: > Here are two possible ways to do it: > > This would simplify your code a bit. But it changes the names of x_cs to > cs.x.

Re: [R] Remove reciprocal data from a grouped animal social contact dataset

2013-04-26 Thread skywalker atl
Hi See https://github.com/hongqin/RCompBio/blob/master/48states/48states-permutation-igraph.r and http://www.youtube.com/watch?v=GE2l3LYDQG0 Hope they are useful, Hong Qin On Fri, Apr 26, 2013 at 5:08 AM, Cat Cowie wrote: > Hi r-help forum, > > I have been collecting contact data (with

[R] Stepwise regression for multivariate case in R?

2013-04-26 Thread Jonathan Jansson
Hi! I am trying to make a stepwise regression in the multivariate case, using Wilks' Lambda test. I've tried this: > greedy.wilks(cbind(Y1,Y2) ~ . , data=my.data ) But it only returns: Error in model.frame.default(formula = X[, j] ~ grouping, drop.unused.levels = TRUE) : variable lengths dif

Re: [R] Remove reciprocal data from a grouped animal social contact dataset

2013-04-26 Thread Adams, Jean
Cat, It seems risky to me to assume that one collar is always outperforming another one. I would think there would be some cases where one collar picked up on a contact that the other one missed AND that the other picked up on a contact that the one missed. If so, it may be best to keep all of t

Re: [R] Splitting data.frame and saving to csv files

2013-04-26 Thread Bert Gunter
Hint: nm <- substring(names(df). 1,3) gives the first 3 letters of the names, assuming this is the info needed for classifying the names -- you were not explicit about this. If some sort of pattern is used, ?grep may be what you need. You can then pick columns from df by e.g. loopingt through un

Re: [R] Can a column of a list be called?

2013-04-26 Thread Bert Gunter
Please read "An Introduction to R" or other basic R tutorial to learn basic R operations before posting. Please read the posting guide (link at bottom) or other similar online guides for how to post a coherent question that will elicit an accurate and helpful answer. -- Bert On Thu, Apr 25, 2013

Re: [R] Trouble Computing Type III SS in a Cox Regression

2013-04-26 Thread John Kane
Seconded John Kane Kingston ON Canada > -Original Message- > From: rolf.tur...@xtra.co.nz > Sent: Fri, 26 Apr 2013 10:13:52 +1200 > To: thern...@mayo.edu > Subject: Re: [R] Trouble Computing Type III SS in a Cox Regression > > On 26/04/13 03:40, Terry Therneau wrote: > > (In response t

Re: [R] Vectorized code for generating the Kac (Clement) matrix

2013-04-26 Thread Enrico Schumann
On Thu, 25 Apr 2013, Ravi Varadhan writes: > Hi, I am generating large Kac matrices (also known as Clement matrix). > This a tridiagonal matrix. I was wondering whether there is a > vectorized solution that avoids the `for' loops to the following code: > > n <- 1000 > > Kacmat <- matrix(0, n+1,

Re: [R] sample size in box plot labels

2013-04-26 Thread PIKAL Petr
Hi actually it shall be the same result as table(DATA$UnitName_1) Both approaches does not work if there are NAs in your data. tapply(DATA$K_Merge, DATA$UnitName_1, FUN = function(x) sum(!is.na(x))) consideres also NA values. Regards Petr ---Original Message- > From: r-help-boun...@r-pr

Re: [R] Help with dataEllipse function

2013-04-26 Thread Michael Friendly
On 4/25/2013 8:00 PM, Jana Makedonska wrote: Hi Everyone, I am working with the R function "dataEllipse". I plot the 95% confidence ellipses for several different samples in the same plot and I color-code the ellipse of each sample, but I do not know how to specify a different line pattern for e

[R] Splitting data.frame and saving to csv files

2013-04-26 Thread Katherine Gobin
Dear R Forum, I have a data.frame as df = data.frame(date = c("2013-04-15", "2013-04-14", "2013-04-13", "2013-04-12", "2013-04-11"), ABC_f = c(62.80739769,81.04525895,84.65712455,12.78237251,57.61345256), LMN_d = c(21.16794336,54.6580401,63.8923307,87.59880367,87.07693716), XYZ_p = c(55.8885464,

[R] How to export graph value in R

2013-04-26 Thread Anup khanal
Dear exports,I have created a hypsometric curve (area-elevation curve) for my watershed by using simple command hypsometric(X,main="Hypsometric Curve", xlab="Relative Area above Elevation, (a/A)",ylab="Relative Elevation, (h/H)", col="blue")It plots the hypsometric curve in "

Re: [R] Can a column of a list be called?

2013-04-26 Thread Charles Determan Jr
If you are using the list as simply a collection of data frames a simple example to accomplish what you are describing is this: data(iris) data(mtcars) y=list(iris, mtcars) #return Sepal.Length column from first data frame in list #list[[number of list component]][number of column] y[[1]][1] Chee

Re: [R] csv file with two header rows

2013-04-26 Thread John Kane
I don't think so. read.csv is a striped down version of read.table. You should be able to do this with the skip option there. John Kane Kingston ON Canada > -Original Message- > From: analys...@hotmail.com > Sent: Thu, 25 Apr 2013 18:35:42 -0700 (PDT) > To: r-help@r-project.org > Subje

Re: [R] labeling

2013-04-26 Thread Jim Lemon
On 04/26/2013 10:15 PM, Shane Carey wrote: Hi, I have a dataset as follows: Name N Visean limestone& calcareous shale 2 Visean sandstone, mudstone& evaporite 2 Westphalian shale, sandstone, siltstone& coal How do I combine them so that I can labe

Re: [R] Help with dataEllipse function

2013-04-26 Thread John Fox
Dear Jana, The lty argument to dataEllipse() (in the car package) isn't vectorized. It could be, and I'll add that as a feature request. Actually, lty isn't an explicit argument to dataEllipse(); it's simply passed through to the lines() function, which draws the ellipses. You should be able t

Re: [R] Trouble Computing Type III SS in a Cox Regression

2013-04-26 Thread Paul Miller
Sigh. Message: 50 Date: Fri, 26 Apr 2013 10:13:52 +1200 From: Rolf Turner To: Terry Therneau Cc: r-help@r-project.org, Achim Zeileis Subject: Re: [R] Trouble Computing Type III SS in a Cox Regression Message-ID: <5179aaa0.8060...@xtra.co.nz> Content-Type: text/plain; charset=ISO-8859-1; format=

Re: [R] Weighted Principle Components analysis

2013-04-26 Thread Dimitri Liakhovitski
The reason for my asking is because I have to replicate the same analysis done in SPSS and SAS. Again, to make it clear - it's respondent-weighted Factor Analysis with a desired number of factors. Method of extraction: Principal Components. Rotation: Varimax. The only solution I can think of is

[R] labeling

2013-04-26 Thread Shane Carey
Hi, I have a dataset as follows: Name N Visean limestone & calcareous shale 2 Visean sandstone, mudstone & evaporite 2 Westphalian shale, sandstone, siltstone & coal How do I combine them so that I can label a plot with Visean limestone & calcareous sha

Re: [R] nls: example code throws error

2013-04-26 Thread Keith Jewell
On 26/04/2013 00:16, Steven LeBlanc wrote: > Greets, > > I'm trying to learn to use nls and was running the example code for an exponential model: > > > > Perhaps also, a pointer to a comprehensive and correct document that details model formulae syntax if someone has one? > > Thanks& Best

Re: [R] Vectorized code for generating the Kac (Clement) matrix

2013-04-26 Thread Berend Hasselman
On 25-04-2013, at 17:18, Ravi Varadhan wrote: > Hi, > I am generating large Kac matrices (also known as Clement matrix). This a > tridiagonal matrix. I was wondering whether there is a vectorized solution > that avoids the `for' loops to the following code: > > n <- 1000 > > Kacmat <- matr

Re: [R] sample size in box plot labels

2013-04-26 Thread Shane Carey
This works, great. Cheers On Fri, Apr 26, 2013 at 12:02 PM, Rui Barradas wrote: > Hello, > > To count the sample sizes for each factor try > > tapply(DATA$K_Merge, DATA$UnitName_1, FUN = length) > > > Hope this helps, > > Rui Barradas > > Em 26-04-2013 10:48, Shane Carey escreveu: > > Hi, >> >

Re: [R] How to make a raster image in R from my own data set

2013-04-26 Thread Jon Olav Skoien
Hi Kristi, it takes a few extra steps to create a raster layer from your example data set, as it is not a gridded map in Lat lon (probably in some projection though). How exactly to do it depends on your data, but here are some hints: 1. If you actually need to read the data set from a link,

Re: [R] sample size in box plot labels

2013-04-26 Thread Rui Barradas
Hello, To count the sample sizes for each factor try tapply(DATA$K_Merge, DATA$UnitName_1, FUN = length) Hope this helps, Rui Barradas Em 26-04-2013 10:48, Shane Carey escreveu: Hi, I would like to put the sample number beside each lable in a boxplot. How do I do this? Essentially, I need

Re: [R] sample size in box plot labels

2013-04-26 Thread PIKAL Petr
Hi > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Shane Carey > Sent: Friday, April 26, 2013 11:49 AM > To: r-help@r-project.org > Subject: [R] sample size in box plot labels > > Hi, > > I would like to put the sample numbe

Re: [R] Error installing boss package

2013-04-26 Thread Jim Lemon
On 04/25/2013 11:42 PM, Pramod Anugu wrote: I am trying to install the package boss but i am getting error below: Please advice ... checking netcdf.h usability... no checking netcdf.h presence... no checking for netcdf.h... no configure: error: netcdf header netcdf.h not found ERROR: configu

[R] sample size in box plot labels

2013-04-26 Thread Shane Carey
Hi, I would like to put the sample number beside each lable in a boxplot. How do I do this? Essentially, I need to count the sample size for each factor, see below: Thanks boxplot(DATA$K_Merge~factor(DATA$UnitName_1),axes=FALSE,col=colours) title(main=list("Tukey Boxplot by Geology:\n K(%)",cex=c

Re: [R] time series plot: x-axis problem

2013-04-26 Thread Rui Barradas
Hello, Try the following. (rr=ts(rr,start=c(2012,5),frequency=12)) plot(rr, xlab="2012 - 2013", ylab="event freq", xaxt = "n", col="blue") labs <- format(as.Date(time(rr)), "%b-%Y") axis(1, time(rr), labs, cex.axis = .9, tcl = -.5, las = 2) Hope this helps, Rui Barradas Em 25-04-2013 19:1

[R] Remove reciprocal data from a grouped animal social contact dataset

2013-04-26 Thread Cat Cowie
Hi r-help forum, I have been collecting contact data (with proximity logger collars) between a few different species of animal. All animals wear the collars, and any contact between the animals should be detected and recorded by both collars. However, this isn't always the case and more contacts m

Re: [R] Sum up column values according to row id

2013-04-26 Thread Matteo Mura
Thank you very much Doct. Carlson!!! The function you suggest me wors perfectely!!! Thanks a lot again, Best whishes sincerely Mt M 2013/4/24 David Carlson > Something like this? > > mean6 <- function(x) { > if (length(x) < 6) { > mn <- mean(x) > } else { > mn

Re: [R] Transferring R to another computer, R_HOME_DIR

2013-04-26 Thread Prof Brian Ripley
This is really an R-devel topic: it is not about using R. R is usually (but not always) built so that everything except Rscript is relocatable by editing the 'R' script (and R_HOME and R_HOME_DIR are ignored in the environment, intentionally). So you could edit the script, but not having Rscr

Re: [R] Looping through names of both dataframes and column-names

2013-04-26 Thread Blaser Nello
Here are two possible ways to do it: This would simplify your code a bit. But it changes the names of x_cs to cs.x. for (df in nls) { assign(df, cbind(get(df), cs=apply(get(df), 2, cumsum))) } This is closer to what you have done. for (df in nls) { print(df) for (var in names(get(df)))

Re: [R] nls: example code throws error

2013-04-26 Thread Duncan Mackay
Hi Try x <- -(1:100)/10 set.seed(1) y <- 100 + 10 * exp(x / 2) + rnorm(x)/10 short cut to starting values lm(log(y) ~-log(x+10)) Call: lm(formula = log(y) ~ -log(x + 10)) Coefficients: (Intercept) 4.624 nlmod <- nls(y ~ A + B * exp(C * x), start=list(A=90, B=5,C=0.1)) Formula: y ~ A +

[R] Can a column of a list be called?

2013-04-26 Thread Jana Makedonska
Hello Everyone, I would like to know if I can call one of the columns of a list, to use it as a variable in a function. Thanks in advance for any advice! Jana -- Jana Makedonska, B.Sc. Biology, Universite Paul Sabatier Toulouse III M.Sc. Paleontology, Paleobiology and Phylogeny, Universite de

[R] time series plot: x-axis problem

2013-04-26 Thread Jerry
Hi, I'm trying to plot a simple time series. I'm running into an issue with x-axis The codes below will produce a plot with correct x-axis showing from Jan to Dec > rr=c(3,2,4,5,4,5,3,3,6,2,4,2) > (rr=ts(rr,start=c(2012,1),frequency=12)) > win.graph(width=6.5, height=2.5,pointsize=8) > plot(r

Re: [R] Make R 3.0 open .RData files

2013-04-26 Thread Indrajit Sen Gupta
Another thing that you can try is changing the Path. Make sure the PATH environment variable has the path to R 3.0 before R 2.15.3 in the string. Regards, Indrajit On Thu, 25 Apr 2013 22:10:52 +0530 wrote >a) See FAQ 2.17 b) Methods for configuring operating systems are off topic

[R] Vectorized code for generating the Kac (Clement) matrix

2013-04-26 Thread Ravi Varadhan
Hi, I am generating large Kac matrices (also known as Clement matrix). This a tridiagonal matrix. I was wondering whether there is a vectorized solution that avoids the `for' loops to the following code: n <- 1000 Kacmat <- matrix(0, n+1, n+1) for (i in 1:n) Kacmat[i, i+1] <- n - i + 1 for

Re: [R] connecting matrices

2013-04-26 Thread arun
HI Elisa, I guess there is a mistake. Check whether this is what you wanted. indx<-sort(el1,index.return=TRUE)$ix[1:3] list(el[,indx],indx) #[[1]]  #    [,1] [,2] [,3] #[1,]   41   21   11 #[2,]   42   22   12 #[3,]   43   23   13 #[4,]   44   24   14 #[5,]   45   25   15 # #[[2]] #[1] 9 5 3 A.K.

Re: [R] connecting matrices

2013-04-26 Thread arun
Dear Elisa, Try this: el<- matrix(1:100,ncol=20)  set.seed(25)  el1<- matrix(sample(1:100,20,replace=TRUE),ncol=1) In the example you showed, there were no column names.   list(el[,sort(el1)[1:3]],sort(el1,index.return=TRUE)$ix[1:3]) #[[1]]  #    [,1] [,2] [,3] #[1,]   31   61   71 #[2,]   32  

  1   2   >