Re: [R] Rearanging Data

2012-02-08 Thread Tal Galili
oops, I meant: sub <- Claims [ Claims$Year="Y1",] Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) | www.r-statistics.com (English) -

Re: [R] Rearanging Data

2012-02-08 Thread Tal Galili
Hi Kevin, Try using ?dput for putting your code on the list, so people could easily import and play with it. I think you probably need to do this: sub <- subset(Claims, Year="Y1") This also should work: sub <- Claims [ Year="Y1",] Contact Details:-

Re: [R] ROCR crashes for simple recall plot

2012-02-08 Thread Yang Zhang
On Wed, Feb 8, 2012 at 6:46 PM, David Winsemius wrote: > > On Feb 8, 2012, at 8:00 PM, Yang Zhang wrote: > >> I'm trying to use ROCR to create a simple cutoff vs recall plot >> (recall@p) on the example ROCR.simple dataset: >> >> library(ROCR) >> data(ROCR.simple) >> pred <- prediction(ROCR.simple

[R] Rearanging Data

2012-02-08 Thread kevin123
Hi, This is only a small portion of the Data i am working on I want to make a subset of this data set( Data Set=Claims) MemberID ProviderID Vendor PCPYear Specialty 1 422869788013252 172193 37796 Y1Surgery 2 979032483316066 726296 5300Y3

Re: [R] Troubles with stemming (tm + Snowball packages) under MacOS

2012-02-08 Thread Dom
Hi, I'm having the same problem, but the aforementioned solution didn't work for me. I keep getting an error message and the Stemmer is still reportedly unknown. See code below. Please let me know if I'm overlooking anything. Thanks. > Sys.setenv(NOAWT=TRUE) > library(tm) > library(Snowball) >

[R] google login via RCurl

2012-02-08 Thread Hiroyuki Kawakatsu
Hi, Can anyone manage to login to a google account via RCurl? All info on the web appears to be out of date. (1) both RGoogleDocs and RGoogleTrends on omegahat appears to be withdrawn: http://www.omegahat.org/RGoogleDocs/ http://www.omegahat.org/RGoogleTrends/ Does anyone know why? (2) The close

Re: [R] basic debugging

2012-02-08 Thread Bert Gunter
?options ## error = recover will allow you to browse state at the point of error ?traceback ## invoke immediately after an error to see exactly in which function the error occurred -- Bert On Wed, Feb 8, 2012 at 9:01 PM, ilai wrote: > ?debug will satisfy your curiosity regarding "debug mode"  

Re: [R] basic debugging

2012-02-08 Thread ilai
?debug will satisfy your curiosity regarding "debug mode" - strictly speaking it is not a "mode", just another function. On Wed, Feb 8, 2012 at 7:30 PM, R. Michael Weylandt wrote: > What is your question? More interestingly, what is "debug mode" in R? > > I'd suggest you look at traceback() --

Re: [R] ROCR crashes for simple recall plot

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 8:00 PM, Yang Zhang wrote: I'm trying to use ROCR to create a simple cutoff vs recall plot (recall@p) on the example ROCR.simple dataset: library(ROCR) data(ROCR.simple) pred <- prediction(ROCR.simple$predictions, ROCR.simple$labels) perf <- performance(pred, "rec") plot(per

Re: [R] basic debugging

2012-02-08 Thread R. Michael Weylandt
What is your question? More interestingly, what is "debug mode" in R? I'd suggest you look at traceback() -- there's also the powerful, but possibly advanced, options(error=recover) Kerninghan said "The most effective debugging tool is still careful thought, coupled with judiciously placed print

Re: [R] ROCR crashes for simple recall plot

2012-02-08 Thread R. Michael Weylandt
Works fine for me. sessionInfo()? Michael On Wed, Feb 8, 2012 at 8:00 PM, Yang Zhang wrote: > I'm trying to use ROCR to create a simple cutoff vs recall plot > (recall@p) on the example ROCR.simple dataset: > > library(ROCR) > data(ROCR.simple) > pred <- prediction(ROCR.simple$predictions, ROCR

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread R. Michael Weylandt
You can of course make your own function to do this all "in one step" split2env <- function(x, f, drop = FALSE, ...){ list2env(split(x, f, drop), ...) } But why do you need this for other tasks as a one-liner? M On Wed, Feb 8, 2012 at 6:29 PM, Johannes Radinger wrote: > > Am 08.02.2012 u

Re: [R] dropterm in MANOVA for MLM objects

2012-02-08 Thread John Fox
Dear Vickie, I'm afraid that the test problem that you've constructed makes no sense, and doesn't correspond to the problem that you initially described, in which a matrix of presumably 5 responses for presumably 140 observations is regressed on 6 predictors. You regressed your randomly generated

Re: [R] x-axis label for boxplot

2012-02-08 Thread John Sorkin
Thank you! John John David Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 (Phone) 410-605-7119 (Fax) 410-605-7913 (Please call pho

Re: [R] x-axis label for boxplot

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 7:48 PM, John Sorkin wrote: I am trying to produce three boxplots and label the x axis values: xvalues, yvalues, zvalues. My code is below. The labels are not below the three boxplots. If you could show me how to get the labels below the columns I would be appreciative. J

Re: [R] x-axis label for boxplot

2012-02-08 Thread Robert Baer
xlab = needs to be names = see ?boxplot boxplot(jdata[,"x"],jdata[,"y"],jdata[,"z"],names=c("x values","yvalues","zvalues")) -Original Message- From: John Sorkin Sent: Wednesday, February 08, 2012 6:48 PM Cc: r-help Subject: [R] x-axis label for boxplot I am trying to produce th

[R] ROCR crashes for simple recall plot

2012-02-08 Thread Yang Zhang
I'm trying to use ROCR to create a simple cutoff vs recall plot (recall@p) on the example ROCR.simple dataset: library(ROCR) data(ROCR.simple) pred <- prediction(ROCR.simple$predictions, ROCR.simple$labels) perf <- performance(pred, "rec") plot(perf) But R crashes on me on the last line. I'm usi

Re: [R] evaluate one variable in an expression with two variables

2012-02-08 Thread Gabor Grothendieck
On Wed, Feb 8, 2012 at 4:02 PM, moli wrote: > I want to evaluate f with the mean=7 > >  mean=7 >  f <-  expression(-(x-mean)^2/2) > then get a new expression: > >  -(x-7)^2/2 > How could I do it? Thanks. > You can leave out the initial as.expression if you don't mind having a call object instead:

[R] x-axis label for boxplot

2012-02-08 Thread John Sorkin
I am trying to produce three boxplots and label the x axis values: xvalues, yvalues, zvalues. My code is below. The labels are not below the three boxplots. If you could show me how to get the labels below the columns I would be appreciative. John jdata<-data.frame(x = rnorm(100),y=rnorm(100,1),

[R] basic debugging

2012-02-08 Thread ikuzar
Hi, I have to debug my program. When I execute my function (in debug mode), I have got an error but I do not know which line is concerned. I do not want to do an infinite "Browse[2]>n with each line in my function... THanks for your help, ikuzar -- View this message in context: http://r.7896

[R] evaluate one variable in an expression with two variables

2012-02-08 Thread moli
I want to evaluate f with the mean=7 mean=7 f <- expression(-(x-mean)^2/2) then get a new expression: -(x-7)^2/2 How could I do it? Thanks. -- View this message in context: http://r.789695.n4.nabble.com/evaluate-one-variable-in-an-expression-with-two-variables-tp4370877p4370877.html Sent fr

Re: [R] String position character replacement

2012-02-08 Thread Yang, Joy (NIH/NHGRI) [F]
Oh cool! I didn't realize you could assign a different value to a substring like that. Thanks! Joy From: Petr Savicky [savi...@cs.cas.cz] Sent: Wednesday, February 08, 2012 3:26 PM To: r-help@r-project.org Subject: Re: [R] String position character replace

Re: [R] Version control (git, mercurial) for R packages

2012-02-08 Thread baptiste auguie
On 9 February 2012 13:02, David Winsemius wrote: > > On Feb 8, 2012, at 6:33 PM, Tom Roche wrote: > >> >> Peter Langfelder Thu Feb 9 00:01:31 CET 2012 >>> >>> I'm exploring using a version control system >> >> >> +1! welcome to the new millenium :-) >> >>> to keep better track of changes to the [R

Re: [R] Version control (git, mercurial) for R packages

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 6:33 PM, Tom Roche wrote: Peter Langfelder Thu Feb 9 00:01:31 CET 2012 I'm exploring using a version control system +1! welcome to the new millenium :-) to keep better track of changes to the [R] packages I maintain. I'm leaning towards git I like 'git' too, but one t

Re: [R] String position character replacement

2012-02-08 Thread Henrique Dallazuanna
Try this: sapply(mapply(replace, x = strsplit(avec, NULL), list = alist, MoreArgs = list(values = "-")), paste, collapse = "") On Wed, Feb 8, 2012 at 3:33 PM, Yang, Joy (NIH/NHGRI) [F] wrote: > Hi, > > Is there a way to efficiently replace specified indices in a string with > another character?

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 6:29 PM, Johannes Radinger wrote: Am 08.02.2012 um 23:47 schrieb David Winsemius: On Feb 8, 2012, at 5:06 PM, Johannes Radinger wrote: Am 08.02.2012 um 22:19 schrieb David Winsemius: On Feb 8, 2012, at 4:11 PM, Johannes Radinger wrote: Hi, I want to split a dataf

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread Johannes Radinger
Am 08.02.2012 um 23:47 schrieb David Winsemius: > > On Feb 8, 2012, at 5:06 PM, Johannes Radinger wrote: > >> >> Am 08.02.2012 um 22:19 schrieb David Winsemius: >> >>> >>> On Feb 8, 2012, at 4:11 PM, Johannes Radinger wrote: >>> Hi, I want to split a dataframe based on a gro

Re: [R] Version control (git, mercurial) for R packages

2012-02-08 Thread Tom Roche
Peter Langfelder Thu Feb 9 00:01:31 CET 2012 > I'm exploring using a version control system +1! welcome to the new millenium :-) > to keep better track of changes to the [R] packages I maintain. I'm > leaning towards git I like 'git' too, but one thing to consider (though keep in mind that I'm

[R] Version control (git, mercurial) for R packages

2012-02-08 Thread Peter Langfelder
Hi all, in particular package developers, I'm exploring using a version control system to keep better track of changes to the packages I maintain. I'm leaning towards git (although mercurial also looks good) but am not sure what is the best way to set up the repository. It seems I can't set the re

Re: [R] dropterm in MANOVA for MLM objects

2012-02-08 Thread Vickie S
Dear Prof Fox, I tried anova but got the following error message: mat <- matrix(rnorm(700), ncol=5, dimnames=list( paste("f", c(1:140), sep="_"), c("A", "B", "C", "D", "E"))) summary(Anova(lm(cbind(A, B, C, D, E) ~ factor(rownames(mat)), data=as.data.frame(mat Error in summary(Anova(lm(cbi

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 5:06 PM, Johannes Radinger wrote: > > Am 08.02.2012 um 22:19 schrieb David Winsemius: > >> >> On Feb 8, 2012, at 4:11 PM, Johannes Radinger wrote: >> >>> Hi, >>> >>> I want to split a dataframe based on a grouping variable (in one >>> column). The resulting new >>> dataframes

Re: [R] Setting up infile for R CMD BATCH

2012-02-08 Thread ilai
I'm going to declare this SOLVED. Yes, if you don't want a separate script for batch, you will need to modify the original script so it either readline or skips it. Here is an example: # Save in file myTest.R # Add this local function to the beginning of your original "program

Re: [R] .Random.seed not found

2012-02-08 Thread Wilkerson, Sylvia (NIH/CIT) [E]
Thanks you Peter, It works perfectly. Sylvia -Original Message- From: Peter Langfelder [mailto:peter.langfel...@gmail.com] Sent: Tuesday, February 07, 2012 1:59 PM To: Wilkerson, Sylvia (NIH/CIT) [E] Cc: r-help@r-project.org Subject: Re: [R] .Random.seed not found You need to use set

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread Johannes Radinger
Am 08.02.2012 um 22:19 schrieb David Winsemius: > > On Feb 8, 2012, at 4:11 PM, Johannes Radinger wrote: > >> Hi, >> >> I want to split a dataframe based on a grouping variable (in one column). >> The resulting new >> dataframes should be stored in a new variable. I tried to split the >> dat

Re: [R] dropterm in MANOVA for MLM objects

2012-02-08 Thread John Fox
Dear Vicki, I think that the Anova() function in the car package will do what you want (and will also properly handle models with more structure, such as interactions). Best, John John Fox Senator William McMaster Professor of Social Statistics Department of S

Re: [R] "unsparse" a vector

2012-02-08 Thread Sam Steingold
loop is too slow. it appears that sparseMatrix does what I want: ll <- lapply(l,length) i <- rep(1:4, ll) vv <- unlist(l) j1 <- as.factor(substring(vv,1,1)) t <- table(j1) j <- position of elements of j1 in names(t) sparseMatrix(i,j,x=as.numeric(substring(vv,2,2)), dimnames = names(t)) so, the qu

Re: [R] "unsparse" a vector

2012-02-08 Thread William Dunlap
When compute time is important it often helps to loop over columns instead of over rows (assuming there are fewer columns than rows, the usual case). E.g., putting your code into a function f0 and the column-looping version into f1: f0 <- function(v) { n <- length(v) d <- data.frame(A=vector(

[R] [newbie] modules.sourceforge.net and system(...) calls

2012-02-08 Thread Tom Roche
summary: how to write an R script that requires certain 'modules' (in the modules.sourceforge.net sense, not the generic sense)? details: I'm writing an R script (beginning #!/usr/bin/env Rscript ) that uses a system call to one of the fine NCO tools http://nco.sourceforge.net/ to run on a

Re: [R] How to store the p value and number of events into a matrix

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 4:24 PM, Rolf Turner wrote: On 09/02/12 10:00, David Winsemius wrote: On Feb 8, 2012, at 3:50 PM, summer wrote: Hi, there is p value and number of events from coxph results. How can I keep record of every p value and number of events automatically if I run 100 times?

Re: [R] "unsparse" a vector

2012-02-08 Thread Petr Savicky
On Wed, Feb 08, 2012 at 03:56:12PM -0500, Sam Steingold wrote: > To be clear, I can do that with nested for loops: > > v <- c("A1B2","A3C4","B5","C6A7B8") > l <- strsplit(gsub("(.{2})","\\1,",v),",") > d <- data.frame(A=vector(length=4,mode="integer"), > B=vector(length=4,mode="int

Re: [R] "unsparse" a vector

2012-02-08 Thread Bert Gunter
Sorry, it's in package compiler, now part of the standard distro. My bad. -- Bert On Wed, Feb 8, 2012 at 1:23 PM, Sam Steingold wrote: >> * Bert Gunter [2012-02-08 13:02:00 -0800]: >> >> A few extra minutes of computing time to save many more minutes of >> programming time seems a reasonable tr

Re: [R] How to store the p value and number of events into a matrix

2012-02-08 Thread Rolf Turner
On 09/02/12 10:00, David Winsemius wrote: On Feb 8, 2012, at 3:50 PM, summer wrote: Hi, there is p value and number of events from coxph results. How can I keep record of every p value and number of events automatically if I run 100 times? ?replicate Another question is how can I change th

Re: [R] "unsparse" a vector

2012-02-08 Thread Sam Steingold
> * Bert Gunter [2012-02-08 13:02:00 -0800]: > > A few extra minutes of computing time to save many more minutes of > programming time seems a reasonable tradeoff. in this case, many hours of computing time. > see ?compile to compile your Error: object 'compile' not found -- Sam Steingold (

Re: [R] Split dataframe into new dataframes

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 4:11 PM, Johannes Radinger wrote: Hi, I want to split a dataframe based on a grouping variable (in one column). The resulting new dataframes should be stored in a new variable. I tried to split the dataframe using split() and to store it using a FOR loop, but thats not

[R] Split dataframe into new dataframes

2012-02-08 Thread Johannes Radinger
Hi, I want to split a dataframe based on a grouping variable (in one column). The resulting new dataframes should be stored in a new variable. I tried to split the dataframe using split() and to store it using a FOR loop, but thats not working so far: df <- data.frame(A=c("A1","A1","A2","A2"),B

Re: [R] Error in Rd[[which]] : subscript out of bounds

2012-02-08 Thread Martin Morgan
On 02/08/2012 12:13 PM, Ben Ganzfried wrote: Hi Uwe, Thanks for the help. R version 2.14.0 (2011-10-31). The file in question looks like this (w/ a few minor edits for privacy): There are two 'description' entries; the second might be combined with the existing 'details'. Martin \name{c

Re: [R] "unsparse" a vector

2012-02-08 Thread Bert Gunter
Sam: On Wed, Feb 8, 2012 at 12:56 PM, Sam Steingold wrote: > To be clear, I can do that with nested for loops: > > v <- c("A1B2","A3C4","B5","C6A7B8") > l <- strsplit(gsub("(.{2})","\\1,",v),",") > d <- data.frame(A=vector(length=4,mode="integer"), >                B=vector(length=4,mode="integer

Re: [R] How to store the p value and number of events into a matrix

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 3:50 PM, summer wrote: Hi, there is p value and number of events from coxph results. How can I keep record of every p value and number of events automatically if I run 100 times? ?replicate Another question is how can I change the true or faulse statment to 1 and 0.

[R] dropterm in MANOVA for MLM objects

2012-02-08 Thread Vickie S
Dear R fans, I have got a difficult sounding problem. For fitting a linear model using continuous response and then for re-fitting the model after excluding every single variable, the following functions can be used. library(MASS) model = lm(perf ~ syct + mmin + mmax + cach + chmin + chmax, dat

Re: [R] "unsparse" a vector

2012-02-08 Thread Bert Gunter
I suspect there are cleverer ways to do it, especially using packages like stringr and gsubfn, but using base tools, you can hack it without too much effort: ?gregexpr is the key. To get started (x is your example vector of character strings): > gregexpr("[[:alpha:]]+[[:digit:]]+",x) [[1]] [1] 1

Re: [R] units for mapproject() function result

2012-02-08 Thread William Stockhausen
Hi Ray (& all), Many apologies to Ray--apparently my intuition stinks!! The projection is based on the unit sphere (R=1), so the projected coordinates really are dimensionless--as you said! So to scale up to the earth, just multiply the projected coordinate values from mapproject by your favorite

Re: [R] Wriritng to a CSV file

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 2:29 PM, Ron Michael wrote: Okay, so I understood that appending can only happen row-wise. Therefore I tried with following code: write.csv(matrix(1:5, 1), "dat.csv") write.csv(matrix(1:5, 1), "dat.csv", append = TRUE) Warning message: In write.csv(matrix(1:5, 1), "dat.c

Re: [R] "unsparse" a vector

2012-02-08 Thread Sam Steingold
To be clear, I can do that with nested for loops: v <- c("A1B2","A3C4","B5","C6A7B8") l <- strsplit(gsub("(.{2})","\\1,",v),",") d <- data.frame(A=vector(length=4,mode="integer"), B=vector(length=4,mode="integer"), C=vector(length=4,mode="integer")) for (i in 1:len

[R] How to store the p value and number of events into a matrix

2012-02-08 Thread summer
Hi, there is p value and number of events from coxph results. How can I keep record of every p value and number of events automatically if I run 100 times? Another question is how can I change the true or faulse statment to 1 and 0. such as w=1<2, I want the value of w to be 1 not true. Thank you.

[R] How indices calculated in package "boot"

2012-02-08 Thread Deng Nina
Hi,there, I am using R package "boot" to bootstrap. I have one question here: does anybody possibly know how the boot package generates the "indices" which is used in the statistic function? I thought "indices = sample(data, replace=TRUE)", but when I replaced "indices" with this command and used

Re: [R] Wriritng to a CSV file

2012-02-08 Thread Ron Michael
Okay, so I understood that appending can only happen row-wise. Therefore I tried with following code:   > write.csv(matrix(1:5, 1), "dat.csv") > write.csv(matrix(1:5, 1), "dat.csv", append = TRUE) Warning message: In write.csv(matrix(1:5, 1), "dat.csv", append = TRUE) :   attempt to set 'append' i

[R] "unsparse" a vector

2012-02-08 Thread Sam Steingold
Suppose I have a vector of strings: c("A1B2","A3C4","B5","C6A7B8") [1] "A1B2" "A3C4" "B5" "C6A7B8" where each string is a sequence of pairs (fixed width, in this example both value and name are 1 character, in reality the column name is 6 chars and value is 2 digits). I need to convert it

Re: [R] String position character replacement

2012-02-08 Thread Petr Savicky
On Wed, Feb 08, 2012 at 01:30:55PM -0500, Sarah Goslee wrote: > And here's an alternative solution: > > subchar <- function(string, pos, char="-") { > for(i in pos) { > string <- gsub(paste("^(.{", i-1, "}).", sep=""), "\\1-", string) > } > string > } Hi. Try the followin

Re: [R] Error in Rd[[which]] : subscript out of bounds

2012-02-08 Thread Ben Ganzfried
Hi Uwe, Thanks for the help. R version 2.14.0 (2011-10-31). The file in question looks like this (w/ a few minor edits for privacy): \name{curatedData-package} \alias{curatedData-package} \alias{curatedData} \docType{package} \title{Cancer Gene Expression Analysis} \description{The curatedData

[R] standard error for lda()

2012-02-08 Thread array chip
Hi, I am wondering if it is possible to get an estimate of standard error of the predicted posterior probability from LDA using lda() from MASS? Logistic regression using glm() would generate a standard error for predicted probability with se.fit=T argument in predict(), so would it make sense t

Re: [R] library(forecast): Error in SD.test(x, m) : Insufficient data

2012-02-08 Thread Rainer Hurling
On 08.02.2012 17:19 (UTC+1), Jean Jacques Dureau wrote: Hi rainer, how can I control dependend packages? You did not tell us very much about your installation and versions of packages you are using. On my system sessionInfo() gives me the following after loading your example: sessionInfo

Re: [R] How to stop a loop for?

2012-02-08 Thread R. Michael Weylandt
A somewhat common idiom is to use readline() with "Please press to continue:" as the prompt and not to store the value anywhere. Michael On Wed, Feb 8, 2012 at 2:45 PM, Juan Andres Hernandez wrote: > Hi all, I have some time trying to find a way to stop a loop for( ) until the > user presses th

Re: [R] Hinton Diagram for a matrix of weights

2012-02-08 Thread Stephen Eglen
>> On 12/08/2011 03:45 AM, Xavier Fernández i Marín wrote: >> > Hello, >> > >> > Although I have used a general search engine, r-seek, and browsed >> > CRAN for contributed packages and R Gallery, I have not been able >> > to find an implementation of Hinton Diagrams for representing >> > weightin

[R] How to stop a loop for?

2012-02-08 Thread Juan Andres Hernandez
Hi all, I have some time trying to find a way to stop a loop for( ) until the user presses the enter key or any other one and the loop can continue. This could be an example: library(MASS) data <- data.frame(mvrnorm(1000,rep(0,5),Sigma=diag(1,5))) for(i in 1:dim(data)[2]){ plot(density(data[,

Re: [R] Problem with plotting a square 1 x 3 plot and placement of outer margin text

2012-02-08 Thread Uwe Ligges
On 07.02.2012 16:03, Mark Na wrote: Dear R-helpers, Please see the attached plot. The problem is that I have too much space between the x-axis label (which is mtext in an outer margin) and the plots. My par settings for this plot are: par(mfrow=c(1,3),oma=c(2,2,2,2),mar=c(5.1,4.1,4.1,2.1),

Re: [R] using file in hdfs for data mining algorithms in r

2012-02-08 Thread Uwe Ligges
On 06.02.2012 12:29, Karthi KN wrote: hi all, i am new to r It is called R - well, everything lower case, shift key is broken? , i am trying to run data mining algorithms using map reduce framework.. * *i have few basic doubts* *1. can i give file in hdfs to kmeans( ) ? ?I tried as file

Re: [R] Setting up infile for R CMD BATCH

2012-02-08 Thread Gang Chen
Sorry Elai for the confusions. Let me try to reframe my predicament. The main program "myTest.R" has been written in interactive mode with many readline() lines embedded. Suppose a user has already run the program once before in interactive mode with all the answers saved in a text file called ans

Re: [R] Wriritng to a CSV file

2012-02-08 Thread Uwe Ligges
I (and you as well) should have seen that before: use write.table in order to append. The reason for that is given in ?write.table / ?write.csv: ‘write.csv’ and ‘write.csv2’ provide convenience wrappers for writing CSV files. They set ‘sep’ and ‘dec’ (see below), ‘qmethod = "doub

Re: [R] Force printing of excluded axis annotations

2012-02-08 Thread Uwe Ligges
On 08.02.2012 17:43, Justin Fincher wrote: Howdy, This should be simple, but I am finding that I can't find a simple solution. I have a plot to which I am manually adding the annotations to the y-axis with this command: axis(2, c(-4,-3,-2,-1,0,1,2,3,4,5,6,7),labels=c(-4,-3,-2,-1,0,1,2,3,

Re: [R] syntax problem with formula / nls

2012-02-08 Thread Uwe Ligges
On 08.02.2012 19:32, Journals wrote: I run into a slight syntax proble while using nls that seems to require some advice from the R community I have a nonlinear regression problem where I observe the sum of the responses (y) of many individuals (X1 Xn). The properties (x1..xn) of these in

Re: [R] Error in Rd[[which]] : subscript out of bounds

2012-02-08 Thread Uwe Ligges
On 08.02.2012 18:44, Ben Ganzfried wrote: Hi-- I googled the above error and found previous postings about this error on the list. I was having a little difficulty implementing the advice though. The suggestions were to use: traceback() and checkRd(). I'm using R in the directory in which

Re: [R] Wriritng to a CSV file

2012-02-08 Thread Uwe Ligges
On 08.02.2012 20:14, Ron Michael wrote: Dear all, let say I want to write a vector to a CSV file. So I can have following syntax: write.csv(rnorm(10), "dat.csv") Now I want to add one more column into that existing file. If I use the same code then existing file will be destroyed. Is there

Re: [R] na.action in stats::factanal() must be using formula interface and dataframe input to specify na.action?

2012-02-08 Thread Uwe Ligges
On 06.02.2012 18:42, Timothy Bates wrote: hi, Does factanal() force the user to use the formula interface if they wish to specify an na.action? Yes, as the help page says: "na.action: The ‘na.action’ to be used if ‘x’ is used as a formula." Uwe Ligges v1<- c(1,1,1,1,1,1,1,1,NA,1,3,3,3,

[R] syntax problem with formula / nls

2012-02-08 Thread Journals
I run into a slight syntax proble while using nls that seems to require some advice from the R community I have a nonlinear regression problem where I observe the sum of the responses (y) of many individuals (X1 Xn). The properties (x1..xn) of these individuals have been measured but sin

Re: [R] R2WinBUGS error message

2012-02-08 Thread Uwe Ligges
On 07.02.2012 15:23, anaraster wrote: Hi! I am new to BUGS and running BUGS from R. I am trying to run a regression model from R, however I have this error message: Error in file(con, "wb") : cannot open the connection In addition: Warning messages: 1: In file.create(to[okay]) : cannot cre

Re: [R] String position character replacement

2012-02-08 Thread Yang, Joy (NIH/NHGRI) [F]
Thank you both! I was working along the lines of Jorge's method, but was taking longer than it should. Sarah's is actually a lot faster. Thanks again, Joy From: Sarah Goslee [sarah.gos...@gmail.com] Sent: Wednesday, February 08, 2012 1:30 PM To: Yang, Joy

[R] Wriritng to a CSV file

2012-02-08 Thread Ron Michael
Dear all, let say I want to write a vector to a CSV file. So I can have following syntax:   write.csv(rnorm(10), "dat.csv")   Now I want to add one more column into that existing file. If I use the same code then existing file will be destroyed. Is there any functionality to add without destroyi

Re: [R] Setting up infile for R CMD BATCH

2012-02-08 Thread ilai
Gang, Maybe someone here has a different take on things. I'm afraid I have no more insights on this unless you explain exactly what you are trying to achieve, or more importantly why? That may help understand what the problem really is. Do you want to save an interactive session for future runs? t

Re: [R] String position character replacement

2012-02-08 Thread Gabor Grothendieck
On Wed, Feb 8, 2012 at 12:33 PM, Yang, Joy (NIH/NHGRI) [F] wrote: > Hi, > > Is there a way to efficiently replace specified indices in a string with > another character? For example, if I had a vector of strings such as > > [1] "hellohowareyoudoing" > [2] "imgoodhowareyou" > [3] "goodandyou" > [4

Re: [R] String position character replacement

2012-02-08 Thread Sarah Goslee
And here's an alternative solution: subchar <- function(string, pos, char="-") { for(i in pos) { string <- gsub(paste("^(.{", i-1, "}).", sep=""), "\\1-", string) } string } > subchar("hellohowareyoudoing", 3) [1] "he-lohowareyoudoing" > subchar("hellohowareyoudo

Re: [R] String position character replacement

2012-02-08 Thread Jorge I Velez
Hi Joy, Perhaps not the easiest way, but the following seems to work: x <- c("hellohowareyoudoing", "imgoodhowareyou", "goodandyou", "yesimgoodijusttoldyou", "ohyesthatsright") pos <- list(c(3, 9), c(3,4), c(4,7), 5:9, c(2, 5, 7, 12)) sapply(1:length(pos), function(i){ xx <- strsplit(x, "")[

Re: [R] R: Memory increase

2012-02-08 Thread Uwe Ligges
On 08.02.2012 17:14, oluwole oyebamiji wrote: Hi all, I want to do a linear regression with lm package in MASS, my data is 59199 rows by 29 column. I got this error message can not allocate a vector of size 1.5Gb. I have read some of the previous related posting on this but I couldnt sti

[R] String position character replacement

2012-02-08 Thread Yang, Joy (NIH/NHGRI) [F]
Hi, Is there a way to efficiently replace specified indices in a string with another character? For example, if I had a vector of strings such as [1] "hellohowareyoudoing" [2] "imgoodhowareyou" [3] "goodandyou" [4] "yesimgoodijusttoldyou" [5] "ohyesthatsright" and had a list of positions that I

Re: [R] get information on .C code

2012-02-08 Thread R. Michael Weylandt
It's compiled code so you can't view it in R. Download the source from CRAN (in your browser, not through R), decompress it, and look through the src/ directory with your favorite text editor. Michael On Feb 8, 2012, at 8:51 AM, "J. Augusiak" wrote: > Dear R list, > > I have a package downl

[R] fixed effects with clustered standard errors

2012-02-08 Thread Millo Giovanni
Dear John, interesting. There must be a bottleneck somewhere, which possibly went unnoticed because econometricians seldom use so many data points. In fact 'plm' wasn't designed to handle "only" 700 Megs of data at a time; but we're happy to investigate in this direction too. E.g., I was aware of

[R] Error in Rd[[which]] : subscript out of bounds

2012-02-08 Thread Ben Ganzfried
Hi-- I googled the above error and found previous postings about this error on the list. I was having a little difficulty implementing the advice though. The suggestions were to use: traceback() and checkRd(). I'm using R in the directory in which the .Rd file with the problem is located, but I

Re: [R] Random sample from truncated distributions

2012-02-08 Thread Petr Savicky
On Wed, Feb 08, 2012 at 06:17:40AM -0800, n wrote: > Hi, > > How can I draw a random sample from a truncated distribution (especially > lognormal)? > > I found the functions for truncated normal but not for many other > distributions. Hi. A variable Y with a log-normal distribution may be obtain

[R] Force printing of excluded axis annotations

2012-02-08 Thread Justin Fincher
Howdy, This should be simple, but I am finding that I can't find a simple solution. I have a plot to which I am manually adding the annotations to the y-axis with this command: axis(2, c(-4,-3,-2,-1,0,1,2,3,4,5,6,7),labels=c(-4,-3,-2,-1,0,1,2,3,4,5,6,7),cex.axis=8) The issue is that, apparen

Re: [R] find a row identical to another

2012-02-08 Thread Petr Savicky
On Wed, Feb 08, 2012 at 03:36:45PM +0100, Francisco wrote: > Hello, > I have a dataset with many rows, starting from a row that I choose I > would like to find the other rows in the dataset which are identical to > this row (with the same values per each column) and assign them to a > variable.

Re: [R] library(forecast): Error in SD.test(x, m) : Insufficient data

2012-02-08 Thread Jean Jacques Dureau
Hi rainer, how can I control dependend packages? thanks jj Il 08 febbraio 2012 17:10, Rainer Hurling ha scritto: > On 08.02.2012 15:35 (UTC+1), Jean Jacques Dureau wrote: >> >> I have these R code: >> >> >> ### >> time.tes

[R] search tutorial for function "tt" in cox.zph

2012-02-08 Thread johann . delcourt
Hye, I am writing to request your help. I am working on survival curve analysis with Cox model (cox.zph). After to test the proportionality condition for each covariant (independence to the time), the time effect is very significant and I must adapt my model, by the addition of a function dep

[R] R: Memory increase

2012-02-08 Thread oluwole oyebamiji
Hi all,      I want to do a linear regression with lm package in MASS, my data is 59199 rows by 29 column. I got this error message can not allocate a vector of size 1.5Gb. I have read some of the previous related posting on this but I couldnt still got it right. I have an Ubuntu machine of 64bi

Re: [R] Memory allocation problem (again!)

2012-02-08 Thread Ernest Adrogué
8-02-2012, 22:22 (+0545); Christofer Bogaso escriu: > And the Session info is here: > > > sessionInfo() > R version 2.14.0 (2011-10-31) > Platform: i386-pc-mingw32/i386 (32-bit) Not an expert, but I think that 32-bit applications can only address up to 2GB on Windows. -- Bye, Ernest _

Re: [R] Memory allocation problem (again!)

2012-02-08 Thread Justin Haynes
32 bit windows has a memory limit of 2GB. Upgrading to a computer thats less than 10 years old is the best path. But short of that, if you're just generating random data, why not do it in two or more pieces and combine them later? mat.1 <- matrix(rnorm(5*2000),nrow=5) mat.2 <- matrix(rno

Re: [R] Problems reading tab-delim files using read.table and read.delim

2012-02-08 Thread Gabor Grothendieck
On Wed, Feb 8, 2012 at 7:09 AM, mails wrote: > Hello, > > I used read.xlsx to read in Excel files but for large files it turned out to > be not very efficient. > For that reason I use a programme which writes each sheet in an Excel file > into tab-delim txt files. Note that that is how read.xls i

[R] Memory allocation problem (again!)

2012-02-08 Thread Christofer Bogaso
Dear all, I know this problem was discussed many times in forum, however unfortunately I could not find any way out for my own problem. Here I am having Memory allocation problem while generating a lot of random number. Here is my description: > rnorm(5*6000) Error: cannot allocate vector of s

Re: [R] Problems reading tab-delim files using read.table and read.delim

2012-02-08 Thread Jan van der Laan
I don't know if this completely solves your problem, but here are some arguments to read.table/read.delim you might try: row.names=FALSE fill=TRUE The details section also suggests using the colClasses argument as the number of columns is determined from the first 5 rows which may not be

Re: [R] wilderSum

2012-02-08 Thread Joshua Ulrich
Yuanwei, You are correct. The initial seed value is the raw sum, starting with TTR_0.21-0. As it says in the TTR/CHANGES file (among other things): - Changed wilderSum to seed initial value with raw sum. This matches Wilder's original calculations. Thanks to Mahesh Bp for the report. HTH, -- Jo

Re: [R] units for mapproject() function result

2012-02-08 Thread William Stockhausen
Hi Ray, Thanks for responding! However, it would certainly be very non-intuitive if you're correct about the units for the projected coordinates. As I'm sure you know, in a GIS geographic coordinates are usually in degrees--although it's quite possible for these to be in radians instead, I guess

Re: [R] How to have columns lined up?

2012-02-08 Thread David Winsemius
On Feb 8, 2012, at 7:32 AM, hithit168 wrote: Thanks a lot, David. Uh...this is not really an R question, but I couldn't find answer nowhere... Questions that relate to how to use editors (and this is especially so for Microsoft products) simply do NOT belong on R-help. There must be lit

  1   2   >