Re: [R] Constraint on one of parameters.

2012-02-09 Thread Rubén Roa
Read optimx's help. There are 'method', 'upper', 'lower' arguments that'll let you put bounds on pars. HTH Rubén -Mensaje original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] En nombre de FU-WEN LIANG Enviado el: jueves, 09 de febrero de 2012 23:56 Para: r-hel

Re: [R] Getting codebook data into R

2012-02-09 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of barny > Sent: Thursday, February 09, 2012 12:52 PM > To: r-help@r-project.org > Subject: [R] Getting codebook data into R > > I've been trying to get some data from the National S

Re: [R] Subset a datafram according to time

2012-02-09 Thread Jim Holtman
In the first line of dataframe 3, I don't see where the value of 2.456 for ObsrG came from. Can you give us a hint of how that was computed? Sent from my iPad On Feb 9, 2012, at 21:05, NickNz125 wrote: > I want the combine and align by time DATAFRAME1 with DATAFRAME2. DF1 is > second observa

Re: [R] Importing a CSV file

2012-02-09 Thread Jorge I Velez
Hi Sezgin, An alternative option If you do not know the path to your file, is to use file.choose() within read.table() to locate it in your machine: a <- read.table(file.choose(), sep = "\t", rownames = 1, header = TRUE) # a window will pop up! head(a) However, in my experience, it is always be

Re: [R] Finding all the coefficients for a logit model

2012-02-09 Thread R. Michael Weylandt
Add -1 to your glm to remove the intercept term -- that will force Friday to have its own coefficient. E.g., dg <- data.frame(value = rnorm(28), day = letters[1:7]) lm(value ~ day, data = dg) lm(value ~ day - 1, data = dg) Michael On Thu, Feb 9, 2012 at 6:58 PM, Abraham Mathew wrote: > Let's s

Re: [R] Importing a CSV file

2012-02-09 Thread R. Michael Weylandt
There's not usually a colon in Mac file paths. I would have expected "/Users/sezginozcan/Downloads.beer.data.csv" instead. Did you check that? More generally, type dir(PATHWHEREYOUTHINKFILEIS) and see if it really is there. Michael On Thu, Feb 9, 2012 at 10:20 PM, sezgin ozcan wrote: > I have b

Re: [R] Subset a datafram according to time

2012-02-09 Thread NickNz125
I want the combine and align by time DATAFRAME1 with DATAFRAME2. DF1 is second observations and DF2 6 minutes observations want to extract the ObsrG data from DF1 to match the times in DF2. Therefore getting DF3 with Observations (Obsrg) extracted from DF1 to match the times in DF2. DATAFRAME1 Da

[R] Importing a CSV file

2012-02-09 Thread sezgin ozcan
I have been trying to import a csv file to r. but I get the same message everytime. the message is Error in file(file, "rt") : cannot open the connection In addition: Warning message: In file(file, "rt") : cannot open file 'Users:/sezginozcan/Downloads/beer.data.csv': No such file or directory

[R] Finding all the coefficients for a logit model

2012-02-09 Thread Abraham Mathew
Let's say I have a variable, day, which is saved as a factor with 7 levels, and I use it in a logistic regression model. I ran the model using the car package in R and printed out the results. mod1 = glm(factor(status1) ~ factor(day), data=mydat, family=binomial(link="logit")) print(summary(mod1))

Re: [R] dcc in 'bootRes' package

2012-02-09 Thread R-assist
I've been having the same issues as the ones outlined in this thread. I've included dummy samples of my data and the code at the bottom, with error message. Anyone able to help me out? it keeps asking for a start time and I'm not sure how to input that. thanks! > chrono year logdens 1 2000

[R] Constraint on one of parameters.

2012-02-09 Thread FU-WEN LIANG
Dear all, I have a function to optimize for a set of parameters and want to set a constraint on only one parameter. Here is my function. What I want to do is estimate the parameters of a bivariate normal distribution where the correlation has to be between -1 and 1. Would you please advise how to

Re: [R] how to change x-axis ?

2012-02-09 Thread ilai
plot(1:10, xaxt='n') # Don't plot the x-axis axis(1,at=c(2,5,10)) # Construct your own See ?par ?axis On Thu, Feb 9, 2012 at 2:48 PM, summer wrote: > Hi, > I want to define the x-axis in plot as 2,4,6.100 instead of the default > one. How to do that? Many thanks. > > > -- >

Re: [R] Apply pmax to dataframe with different args based on dataframe factor

2012-02-09 Thread ilai
Your attempt was just overly complicated. All you needed was threshold <- c( .2 , .4 , .5 )[ df$track ] df$value <- pmax(threshold, df$value) df # desired outcome Cheers On Thu, Feb 9, 2012 at 3:56 PM, Idris Raja wrote: > # I have a dataframe in the following form: > > track <- c(rep('A', 3), r

[R] making multiple lines using qqplot

2012-02-09 Thread Melrose2012
Hi Everyone, I want to make 3 lines on the same graph (not as subplots, all in the same window, one on top of each other) and I want them to be quantile-quantile plots (qqplot). Essentially, I am looking for the equivalent of Matlab's "hold on" command to use with qqplot. I know I can use 'point

[R] colnames documentation

2012-02-09 Thread R. Michael Weylandt
Consider the following in R 2.14.1 (seems to still be the case in Rdevel): x <- matrix(1:9, 3) colnames(x) # NULL as expected colnames(x, do.NULL = TRUE) # NULL -- since we didn't change the default colnames(x, do.NULL = FALSE) # "col1" "col2" "col3" This doesn't really seem to square with the do

Re: [R] Package ICSNP

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 9:44 PM, David Winsemius wrote: On Feb 9, 2012, at 5:37 PM, Miho Morimoto wrote: install.packages("ICSNP") --- Please select a CRAN mirror for use in this session --- Warning: unable to access index for repository http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.

Re: [R] Choosing glmnet lambda values via caret

2012-02-09 Thread Max Kuhn
You can adjust the candidate set of tuning parameters via the tuneGrid argument in trian() and the process by which the optimal choice is made (via the 'selectionFunction' argument in trainControl()). Check out the package vignettes. The latest version also has an update.train() function that lets

Re: [R] Tukey HSD

2012-02-09 Thread ilai
Also you want " for(i in 2:ncol(mydf)) { ..." Your current setup of 1:ncol(mydf)-1 picks columns 0,1,2,...,ncol-1 (missing the last), which is not what you want... Setting i<-2 in the first line was overridden by the call to loop. Cheers On Thu, Feb 9, 2012 at 2:33 PM, peter dalgaard wrote: > >

Re: [R] calculations combining values from different rows

2012-02-09 Thread William Dunlap
Is the following give the answer you want? It is a pretty literal transliteration of your idiom: > a <- c(4,3,5,5,6,7,3,2,1,4) > b <- c(2,4,1,2,5,3,1,8,7,5) > i <- seq(2, length(a)-1, by=1) > x <- rep(NA, length(a)) > x[i] <- -b[i-1]/24 * a[i-1] + b[i]/2 * a[i] + b[i+1]/24 * a[i+1]

Re: [R] the value of the last expression

2012-02-09 Thread R. Michael Weylandt
The "right answer" is .Last.value but I find that far too much to type so I have the following in my .Rprofile makeActiveBinding("ans", function().Last.value, .GlobalEnv) which sets the variable "ans" to be the last value. Michael On Thu, Feb 9, 2012 at 9:44 PM, Sam Steingold wrote: > Is there

Re: [R] the value of the last expression

2012-02-09 Thread Richard M. Heiberger
.Last.value On Thu, Feb 9, 2012 at 9:44 PM, Sam Steingold wrote: > Is there an analogue of common lisp "*" variable which contains the > value of the last expression? > E.g., in lisp: > > (+ 1 2) > 3 > > * > 3 > > I wish I could recover the value of the last expression without > re-evaluating it

Re: [R] Package ICSNP

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 5:37 PM, Miho Morimoto wrote: I want to install package ICSNP but I got the following message. An instructor of my class even colud not figure out what's going on. Does anybody know about this error? install.packages("ICSNP") --- Please select a CRAN mirror for use in this

[R] the value of the last expression

2012-02-09 Thread Sam Steingold
Is there an analogue of common lisp "*" variable which contains the value of the last expression? E.g., in lisp: > (+ 1 2) 3 > * 3 I wish I could recover the value of the last expression without re-evaluating it. thanks -- Sam Steingold (http://sds.podval.org/) on Ubuntu 11.10 (oneiric) X 11.0.

[R] naiveBayes: slow predict, weird results

2012-02-09 Thread Sam Steingold
I did this: nb <- naiveBayes(users, platform) pl <- predict(nb,users) nrow(users) ==> 314781 ncol(users) ==> 109 1. naiveBayes() was quite fast (~20 seconds), while predict() was slow (tens of minutes). why? 2. the predict results were completely off the mark (quite the opposite of the expected

Re: [R] standard error for lda()

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 6:30 PM, array chip wrote: David, thanks for your response, hope this stirs more... Ok, a simple code: y<-as.factor(rnorm(100)>0.5) x1<-rnorm(100) x2<-rnorm(100) obj<-glm(y~x1+x2,family=binomial) predict(obj,type='response',se.fit=T) predict(obj,...) will give predicted pr

Re: [R] memory management

2012-02-09 Thread Sam Steingold
> * Florent D. [2012-02-09 19:26:59 -0500]: > >> m0 <- memory.size() >> Mb.size <- function(x)print(object.size(x), units="Mb") indeed, these are very useful, thanks. ls reports these objects larger than 100k: behavior : 390.1 Mb mydf : 115.3 Mb nb : 0.2 Mb pl : 1.2 Mb however, top reports th

[R] calculations combining values from different rows

2012-02-09 Thread Sebastián Daza
Hi everyone, I looking for functions or systematic ways to do calculations between different columns and rows in R, as one can do easily in Excel. For example, I have two variables, a and b, where a1 represents an a value in row 1, and b2 represents a b value in row 2, etc. a <- c(4,3,5,5,6,7,3,2

[R] Bug with memory allocation when loading Rdata files iteratively?

2012-02-09 Thread Janko Thyson
Dear list, when iterating over a set of Rdata files that are loaded, analyzed and then removed from memory again, I experience a *significant* increase in an R process' memory consumption (killing the process eventually). It just seems like removing the object via |rm()| and firing |gc()| do n

Re: [R] Custom caret metric based on prob-predictions/rankings

2012-02-09 Thread Yang Zhang
Oops, found trainControl's classProbs right after I sent! On Thu, Feb 9, 2012 at 4:30 PM, Yang Zhang wrote: > I'm dealing with classification problems, and I'm trying to specify a > custom scoring metric (recall@p, ROC, etc.) that depends on not just > the class output but the probability estimat

[R] Custom caret metric based on prob-predictions/rankings

2012-02-09 Thread Yang Zhang
I'm dealing with classification problems, and I'm trying to specify a custom scoring metric (recall@p, ROC, etc.) that depends on not just the class output but the probability estimates, so that caret::train can choose the optimal tuning parameters based on this metric. However, when I supply a tr

Re: [R] memory management

2012-02-09 Thread Florent D.
This should help: > invisible(gc()) > > m0 <- memory.size() > mem.usage <- function(){invisible(gc()); memory.size() - m0} > Mb.size <- function(x)print(object.size(x), units="Mb") > > zz <- data.frame(a=runif(100), b=runif(100)) > mem.usage() [1] 15.26 > Mb.size(zz) 15.3 Mb > a <- zz$a >

Re: [R] Subset a datafram according to time

2012-02-09 Thread MacQueen, Don
(apologies in advance for the stupid line-wrapping that I expect my email software to force upon us) If I understand correctly what you want, I would (1) in both data frames, combine date and time into a single column (variable) that is class POSIXct (2) use the merge() function This assumes th

Re: [R] sample points - sp package

2012-02-09 Thread MacQueen, Don
I suggest you ask this question on r-sig-geo. And it would be best if you could create a small self-contained example. For example, what class of object is dataset2? Is there any reason to expect that the coordinates of the sample will be exactly the same as any of the coordinates in dataset2? P

Re: [R] Getting codebook data into R

2012-02-09 Thread rmailbox
Or, you can do it the lazy way... Download spss errr... pspp at http://www.gnu.org/software/pspp/ and run the spss code in which somebody else already figured all that out, to create an spss file. Then use one of the spss importing libraries. Lately I've become partial to memisc, but there are s

[R] Choosing glmnet lambda values via caret

2012-02-09 Thread Yang Zhang
Usually when using raw glmnet I let the implementation choose the lambdas. However when training via caret::train the lambda values are predetermined. Is there any way to have caret defer the lambda choices to caret::train and thus choose the optimal lambda dynamically? -- Yang Zhang http://yz.

Re: [R] standard error for lda()

2012-02-09 Thread array chip
David, thanks for your response, hope this stirs more... Ok, a simple code: y<-as.factor(rnorm(100)>0.5) x1<-rnorm(100) x2<-rnorm(100) obj<-glm(y~x1+x2,family=binomial) predict(obj,type='response',se.fit=T) predict(obj,...) will give predicted probabilities in the "fit" element; and the associ

Re: [R] passing an extra argument to an S3 generic

2012-02-09 Thread ilai
You do not provide mlm.influence() so your code can't be reproduced. Or did you mean to put lm.influence() in the formals to your hatvalues.mlm ? If yes, then 1) you have a typo 2) lm.influence doesn't allow you to pass on arguments, maybe try influence.lm instead. Elai On Thu, Feb 9, 2012 at 1

Re: [R] get the first character element from a list

2012-02-09 Thread Changbin Du
Thanks so much, David! I will try. On Thu, Feb 9, 2012 at 3:04 PM, David Winsemius wrote: > > On Feb 9, 2012, at 5:01 PM, Changbin Du wrote: > > test<-c("20120111_181515_001_**CCL54D_A01_S02_APL932_PL11_DL_** >> 20120111.CEL", >> "20120111_181516_002_CCL54D_**A02_S08_APL932_PL11_DL_**20120111.

Re: [R] get the first character element from a list

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 5:01 PM, Changbin Du wrote: test<- c("20120111_181515_001_CCL54D_A01_S02_APL932_PL11_DL_20120111.CEL", "20120111_181516_002_CCL54D_A02_S08_APL932_PL11_DL_20120111.CEL") test [1] "20120111_181515_001_CCL54D_A01_S02_APL932_PL11_DL_20120111.CEL" [2] "20120111_181516_002_CCL5

Re: [R] standard error for lda()

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 4:45 PM, array chip wrote: Hi, didn't hear any response yet. want to give it another try.. appreciate any suggestions. My problem after reading this the first time was that I didn't agree with the premise that logistic regression would provide a standard error for a

[R] Apply pmax to dataframe with different args based on dataframe factor

2012-02-09 Thread Idris Raja
# I have a dataframe in the following form: track <- c(rep('A', 3), rep('B', 4), rep('C', 4)) value <- c(0.15, 0.25, 0.35, 0.05, 0.99, 0.32, 0.13, 0.80, 0.75, 0.60, 0.44) df <- data.frame(track=factor(track), value=value) #> print(df) #track value #1 A 0.15 #2 A 0.25 #3 A 0.3

[R] Package ICSNP

2012-02-09 Thread Miho Morimoto
I want to install package ICSNP but I got the following message. An instructor of my class even colud not figure out what's going on. Does anybody know about this error? > install.packages("ICSNP") --- Please select a CRAN mirror for use in this session --- Warning: unable to access index for repo

[R] how to change x-axis ?

2012-02-09 Thread summer
Hi, I want to define the x-axis in plot as 2,4,6.100 instead of the default one. How to do that? Many thanks. -- View this message in context: http://r.789695.n4.nabble.com/how-to-change-x-axis-tp4374503p4374503.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Getting codebook data into R

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 3:51 PM, barny wrote: I've been trying to get some data from the National Survey for Family Growth into R - however, the data is in a .dat file and the data I need doesn't have any spaces or commas separating fields - rather you have to look into the codebook and what nu

Re: [R] Getting codebook data into R

2012-02-09 Thread peter dalgaard
On Feb 9, 2012, at 22:47 , Douglas Bates wrote: > > It's amazing how these old habits of storing data like this persist. > The reason for fixed-format records was that you couldn't read free > format in a Fortran program in a standard way before Fortran-77. And > 35 years afterwards we are still

[R] memory management

2012-02-09 Thread Sam Steingold
> zz <- data.frame(a=c(1,2,3),b=c(4,5,6)) > zz a b 1 1 4 2 2 5 3 3 6 > a <- zz$a > a [1] 1 2 3 > a[2] <- 100 > a [1] 1 100 3 > zz a b 1 1 4 2 2 5 3 3 6 > clearly a is a _copy_ of its namesake column in zz. when was the copy made? when a was modified? at assignment? is there a way to find

[R] Coherence of two matrices

2012-02-09 Thread Alaios
Dear all I would like to ask you if there is in R a fuction that based on two/one input matrices to calculate the coherence or incoherence between those two or the mutual coherence of itself. http://en.wikipedia.org/wiki/Mutual_coherence_(linear_algebra) I would like to thank you in advance for y

Re: [R] Fitting polynomial (power greater than 2)

2012-02-09 Thread 538280
This looks like homework, which is generally discouraged here. You should at the least admit that it is homework and tell what resources your teacher has OK'd you to use. Since you did show what you have done so far and are not just asking for a handout, here is a hint: ?poly On Tue, Feb 7, 201

[R] get the first character element from a list

2012-02-09 Thread Changbin Du
test<-c("20120111_181515_001_CCL54D_A01_S02_APL932_PL11_DL_20120111.CEL", "20120111_181516_002_CCL54D_A02_S08_APL932_PL11_DL_20120111.CEL") > test [1] "20120111_181515_001_CCL54D_A01_S02_APL932_PL11_DL_20120111.CEL" [2] "20120111_181516_002_CCL54D_A02_S08_APL932_PL11_DL_20120111.CEL" fields1<-str

Re: [R] subset select="variable with a list of names"

2012-02-09 Thread peter dalgaard
On Feb 9, 2012, at 18:17 , Nordlund, Dan (DSHS/RDA) wrote: >> -Original Message- >> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- >> project.org] On Behalf Of Francisco >> Sent: Thursday, February 09, 2012 4:52 AM >> To: r-help@r-project.org >> Subject: [R] subset select="v

Re: [R] Getting codebook data into R

2012-02-09 Thread Douglas Bates
On Thu, Feb 9, 2012 at 2:51 PM, barny wrote: > I've been trying to get some data from the National Survey for Family Growth > into R - however, the data is in a .dat file and the data I need doesn't > have any spaces or commas separating fields - rather you have to look into > the codebook and wha

[R] standard error for lda()

2012-02-09 Thread array chip
Hi, didn't hear any response yet. want to give it another try.. appreciate any suggestions. John To: "r-help@r-project.org" Sent: Wednesday, February 8, 2012 12:11 PM Subject: [R] standard error for lda() Hi, I am wondering if it is possible to get an estima

[R] How to properly build model matrices

2012-02-09 Thread Yang Zhang
I always bump into a few (very minor) problems when building model matrices with e.g.: train = model.matrix(label~., read.csv('train.csv')) target = model.matrix(label~., read.csv('target.csv')) (1) The two may have different factor levels, yielding different matrices. I usually first rbind the

Re: [R] Getting codebook data into R

2012-02-09 Thread Peter Alspach
Tena koe ?read.fwf HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of barny Sent: Friday, 10 February 2012 9:52 a.m. To: r-help@r-project.org Subject: [R] Getting codebook data into R I've been trying to get

Re: [R] Tukey HSD

2012-02-09 Thread peter dalgaard
On Feb 9, 2012, at 20:28 , jlpugh wrote: > Hey Folks: > > New to R and learning as I go, but really, I know just enough to get myself > into trouble. I've waded through everything up till now, and don't see > anything in the search that is directly helpful for the POS that I've > created. > >

Re: [R] Getting codebook data into R

2012-02-09 Thread Richard M. Heiberger
?read.fwf Read Fixed Width Format Files Please, one copy of your request to the list is sufficient. Rich On Thu, Feb 9, 2012 at 3:51 PM, barny wrote: > I've been trying to get some data from the National Survey for Family > Growth > into R - however, the data is in a .dat file and the data

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

2012-02-09 Thread peter dalgaard
Could I gently remind you guys about the R-help litmus test: If an ordinary R _user_ has no clue what you are on about, you are on the wrong list. R-devel would be right. -pd On Feb 9, 2012, at 19:28 , Hadley Wickham wrote: >>> I'm exploring using a version control system to keep better track

[R] Getting codebook data into R

2012-02-09 Thread barny
I've been trying to get some data from the National Survey for Family Growth into R - however, the data is in a .dat file and the data I need doesn't have any spaces or commas separating fields - rather you have to look into the codebook and what number of digits along the line the data you need is

[R] Getting codebook data into R

2012-02-09 Thread barny
I've been trying to get some data from the National Survey for Family Growth into R - however, the data is in a .dat file and the data I need doesn't have any spaces or commas separating fields - rather you have to look into the codebook and what number of digits along the line the data you need is

[R] Getting codebook data into R

2012-02-09 Thread barny
I've been trying to get some data from the National Survey for Family Growth into R - however, the data is in a .dat file and the data I need doesn't have any spaces or commas separating fields - rather you have to look into the codebook and what number of digits along the line the data you need is

[R] passing an extra argument to an S3 generic

2012-02-09 Thread Michael Friendly
I'm trying to write some functions extending influence measures to multivariate linear models and also allow subsets of size m>=1 to be considered for deletion diagnostics. I'd like these to work roughly parallel to those functions for the univariate lm where only single case deletion (m=1) dia

[R] Tukey HSD

2012-02-09 Thread jlpugh
Hey Folks: New to R and learning as I go, but really, I know just enough to get myself into trouble. I've waded through everything up till now, and don't see anything in the search that is directly helpful for the POS that I've created. The GOAL: All I want in the world is a program that perform

Re: [R] Lattice 3d coordinate transformation

2012-02-09 Thread ilai
Oops. Obviously I mean "> A working example: > require(lattice) > ..." On Thu, Feb 9, 2012 at 12:13 PM, ilai wrote: > Hello List! > I asked this before (with no solution), but maybe this time... I'm > trying to project a surface to the XY under a 3d cloud using lattice. > I can project contour li

Re: [R] loading packages in a function

2012-02-09 Thread Arnaud Gaboury
Ah, I feel stupid! OK, it works for me. TY for your help Arnaud Gaboury   A2CT2 Ltd. -Original Message- From: Sarah Goslee [mailto:sarah.gos...@gmail.com] Sent: jeudi 9 février 2012 20:02 To: Arnaud Gaboury Cc: r-help@r-project.org Subject: Re: [R] loading packages in a function That

[R] Lattice 3d coordinate transformation

2012-02-09 Thread ilai
Hello List! I asked this before (with no solution), but maybe this time... I'm trying to project a surface to the XY under a 3d cloud using lattice. I can project contour lines following the code for fig 13.7 in Deepayan Sarkar's "Lattice, Multivariate Data Visualization with R", but it fails when

Re: [R] loading packages in a function

2012-02-09 Thread Sarah Goslee
That's because you're loading the packages twice, once suppressing the messages and once not. You only need the first pair of lines. On Thu, Feb 9, 2012 at 1:55 PM, Arnaud Gaboury wrote: > TY for your answer, but here what i did : > > #load needed lybrary > suppressPackageStartupMessages(library

Re: [R] Arial font in eps figures in R

2012-02-09 Thread David L Carlson
So close. The first version should work if you switch the order of the postscript() and par() functions: Arial <- Type1Font(family="Arial", metrics=c("ArialMT.afm", "arial-BoldMT.afm", "Arial-ItalicMT.afm", "Arial-BoldItalicMT.afm")) postscriptFonts(Arial=Arial) par(family="Arial") postscrip

Re: [R] loading packages in a function

2012-02-09 Thread Arnaud Gaboury
TY for your answer, but here what i did : #load needed lybrary suppressPackageStartupMessages(library(plyr)) suppressPackageStartupMessages(library(car)) library(plyr) library(car) But I still get : Loading required package: MASS Loading required package: nnet Arnaud Gaboury   A2CT2 Ltd. --

Re: [R] AUC, C-index and p-value of Wilcoxon

2012-02-09 Thread Petr Savicky
On Thu, Feb 09, 2012 at 06:33:09PM +0100, Petr Savicky wrote: > On Thu, Feb 09, 2012 at 02:05:08PM +, linda Porz wrote: > > Dear all, > > > > I am using the ROCR library to compute the AUC and also the Hmisc library > > to compute the C-index of a predictor and a group variable. The results of

Re: [R] Rearanging Data

2012-02-09 Thread Phil Spector
Try sub <- subset(Claims, Year==Y1) In R, the equality test is performed by two equal signs, not one. - Phil Spector Statistical Computing Facility Department of Statistic

Re: [R] Grouping together a time variable

2012-02-09 Thread R. Michael Weylandt
Perhaps cut.POSIXt (which is a generic so you can just call cut) depending on the unstated form of your time object. Michael On Thu, Feb 9, 2012 at 12:15 PM, Abraham Mathew wrote: > I have the following variable, time, which is a character variable and it's > structured as follows. > >> head(as.

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

2012-02-09 Thread Hadley Wickham
>> 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 >> repository directly within the

Re: [R] complex subscript/superscript on axis labels

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 1:20 PM, David Winsemius wrote: On Feb 9, 2012, at 12:53 PM, Eileen Meyer wrote: Hi All, I am having trouble getting a complex subscript to work. I'm sure it's possible. Here is what I have: ylab=expression(paste("log ",L[peak]," [erg ",s^{-1},"]")), I would like

Re: [R] loading packages in a function

2012-02-09 Thread R. Michael Weylandt
Perhaps the longest function in base R I know of: suppressPackageStartupMessages e.g., suppressPackageStartupMessages(library(zoo)) Michael On Thu, Feb 9, 2012 at 12:44 PM, Arnaud Gaboury wrote: > Hello, > > I sourced successfully my function(). > > I need to load libraries, so I wrote this i

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

2012-02-09 Thread Hadley Wickham
> Same warning here. Which made me think that R CMD build will probably > tar up the git repository along with the package, which is not > something I would like to do, and which CRAN people most likely won't > tolerate in a package on CRAN. It doesn't. And you can always use .Rbuildignore to ign

Re: [R] complex subscript/superscript on axis labels

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 12:53 PM, Eileen Meyer wrote: Hi All, I am having trouble getting a complex subscript to work. I'm sure it's possible. Here is what I have: ylab=expression(paste("log ",L[peak]," [erg ",s^{-1},"]")), I would like to have the subscript read "peak,gamma" where the gam

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

2012-02-09 Thread Peter Langfelder
On Thu, Feb 9, 2012 at 1:46 AM, Gregory Jefferis wrote: > Dear Peter, > > Trying to respond to your original question Thanks for staying on thread :) > > > I have a git repositiory in the root of my packages: > > ie > > package-foo/.git > package-foo/R > package-foo/inst > > Running make check

[R] complex subscript/superscript on axis labels

2012-02-09 Thread Eileen Meyer
Hi All, I am having trouble getting a complex subscript to work. I'm sure it's possible. Here is what I have: ylab=expression(paste("log ",L[peak]," [erg ",s^{-1},"]")), I would like to have the subscript read "peak,gamma" where the gamma would be the greek symbol. I do want the comma

Re: [R] fill an array by rows

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 12:47 PM, Jim Maas wrote: I've dug around but not been able to find anything, am probably missing something obvious. How can I fill a three-dimensional (or higher dimension) array by rows instead of columns. eg new1 <- array(c(1:125), c(5,5,5)) works fine for me but

Re: [R] fill an array by rows

2012-02-09 Thread William Dunlap
Use aperm on the output of array: > aperm(array(1:8, dim=c(2,2,2)), perm=c(2,1,3)) , , 1 [,1] [,2] [1,]12 [2,]34 , , 2 [,1] [,2] [1,]56 [2,]78 Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com > -Original Message- > Fr

Re: [R] generate matrices

2012-02-09 Thread Bert Gunter
Inline below. -- Bert On Thu, Feb 9, 2012 at 8:59 AM, David Winsemius wrote: > > On Feb 9, 2012, at 8:38 AM, Blaz Simcic wrote: > >> Dear all, >> I would like to generate 500 matrices of 20 numbers from >> standard normal distribution with names x1,x2,x3,….x500. >> I tried with loop for, but I d

[R] fill an array by rows

2012-02-09 Thread Jim Maas
I've dug around but not been able to find anything, am probably missing something obvious. How can I fill a three-dimensional (or higher dimension) array by rows instead of columns. eg new1 <- array(c(1:125), c(5,5,5)) works fine for me but fills it by columns and new2 <- array(c(1:125), c

Re: [R] Outlier removal techniques

2012-02-09 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Frank Harrell > Sent: Thursday, February 09, 2012 9:19 AM > To: r-help@r-project.org > Subject: Re: [R] Outlier removal techniques > > I wonder why it is still standard practice

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

2012-02-09 Thread Gang Chen
Hi Elai, yes, the approach works out pretty well. Thanks a lot for spending time on this and for the great help! Gang On Wed, Feb 8, 2012 at 5:43 PM, ilai wrote: > 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

[R] loading packages in a function

2012-02-09 Thread Arnaud Gaboury
Hello, I sourced successfully my function(). I need to load libraries, so I wrote this inside my function(): function() { #load needed library library(plyr) library(car) /... } It is OK, but I have this on my invite command when running the function: > function() Loading required packa

Re: [R] GLM - guess the distribution of the response variable

2012-02-09 Thread Bert Gunter
Below. -- Bert On Thu, Feb 9, 2012 at 9:06 AM, David Winsemius wrote: > > On Feb 9, 2012, at 7:32 AM, wo...@posteo.de wrote: > >> Dear all, >> >> I have question regarding GLMs: >> I have a discrete response variable and a continuous explaining variable. >> Like this: >> http://www.myimg.de/?img=

Re: [R] Row-wise kronecker product with Matrix package

2012-02-09 Thread ilai
Maybe one of these will improve: >help.search('kronecker') ... spam::kronecker Kronecker Products on Sparse Matrices spam::spam.classClass "spam" base::kronecker Kronecker Products on Arrays Matrix::kronecker-methods Methods for Function 'kronecker()'

Re: [R] Rearanging Data

2012-02-09 Thread Kevin Corry
Hi, This worked great: sub <- subset(Claims, Year=="Y1") Thanks for your help Kevin On Thu, Feb 9, 2012 at 6:12 AM, David Winsemius wrote: > > On Feb 8, 2012, at 9:48 PM, kevin123 wrote: > > Hi, >> >> This is only a small portion of the Data i am working on >> I want to make a subset of this

[R] To write a function for getting the node numbers in "rpart" analysis..

2012-02-09 Thread Yashwanth M.R
## To read .csv file(data) and performing "rpart" ## # library(Hmisc) library(rpart) read.csv("D:/Training/RRE/Revolution(My Projects)/Project1/RProject(pmml from SPSS)/telco_churn.csv", header = TRUE, sep = ",", quote="\"", dec=".") # help(read.csv) Telco<- read.table(file = "D:/Training/RRE/Revo

[R] Grouping together a time variable

2012-02-09 Thread Abraham Mathew
I have the following variable, time, which is a character variable and it's structured as follows. > head(as.character(dat$time), 30) [1] "00:00:01" "00:00:16" "00:00:24" > "00:00:25" "00:00:25" "00:00:40" "00:01:50" "00:01:54" "00:02:33" "00:02:43" > "00:03:22" [12] "00:03:31" "00:03:41" "00:03

[R] object size versus saved size?

2012-02-09 Thread luckjiff
Posting under new subject. I’ve a question on saving a earth object to disk. Say m is the model then print(object.size(m), units=”Mb”) 163.8 Mb and save it off save(m, “tmp.rda”) and “tmp.rda” is roughly 171Mb file. I would like this to be much smaller. So I try m$bx<-NULL then print(object.size(

Re: [R] AUC, C-index and p-value of Wilcoxon

2012-02-09 Thread Petr Savicky
On Thu, Feb 09, 2012 at 02:05:08PM +, linda Porz wrote: > Dear all, > > I am using the ROCR library to compute the AUC and also the Hmisc library > to compute the C-index of a predictor and a group variable. The results of > AUC and C-index are similar and give a value of about 0.57. The Wilco

Re: [R] Outlier removal techniques

2012-02-09 Thread Frank Harrell
I wonder why it is still standard practice in some circles to search for "outliers" as opposed to using robust/resistent methods. Here is a great paper with a scientific approach to "outliers": @Article{fin06cal, author = {Finney, David J.}, title ={Calibration

Re: [R] subset select="variable with a list of names"

2012-02-09 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of Francisco > Sent: Thursday, February 09, 2012 4:52 AM > To: r-help@r-project.org > Subject: [R] subset select="variable with a list of names" > > Hello, > I would like to make a

Re: [R] Wriritng to a CSV file

2012-02-09 Thread peter dalgaard
On Feb 8, 2012, at 21:56 , David Winsemius wrote: > > 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

Re: [R] GLM - guess the distribution of the response variable

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 7:32 AM, wo...@posteo.de wrote: Dear all, I have question regarding GLMs: I have a discrete response variable and a continuous explaining variable. Like this: http://www.myimg.de/?img=example1db0f.jpg I want to use a GLM to investigate. I have to specify the "familiy o

Re: [R] how to specify the Oy axis length

2012-02-09 Thread R. Michael Weylandt
Perhaps the ylim argument to plot() Michael On Thu, Feb 9, 2012 at 9:04 AM, ikuzar wrote: > Hi, > > I'd like to plot a point: plot(1,2) > I use RStudio. > I'd like to know how to specify the length of Oy axis. I 'd like to put 20 > as length of Oy but , by default, I 've got 2.5. > > Thanks for

Re: [R] generate matrices

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 8:38 AM, Blaz Simcic wrote: Dear all, I would like to generate 500 matrices of 20 numbers from standard normal distribution with names x1,x2,x3,….x500. I tried with loop for, but I don’t know how to name matices : for (i in 1:500) { x[[i]] <- matrix(rnorm(20), 4) } An

Re: [R] Outlier removal techniques

2012-02-09 Thread Rich Shepard
On Thu, 9 Feb 2012, mails wrote: I need to analyse a data matrix with dimensions of 30x100. Before analysing the data there is, however, a need to remove outliers from the data. I read quite a lot about outlier removal already and I think the most common technique for that seems to be Principal

Re: [R] ifelse

2012-02-09 Thread David Winsemius
On Feb 9, 2012, at 11:37 AM, Arnaud Gaboury wrote: Hello, I need to print a screen message after a test. list<-c("10","1","100","10") ifelse(all(list %in% c(1,10,100)==TRUE),cat("YES\n"),cat("NO\n")) YES Error in ifelse(all(l %in% c(1, 10, 100) == TRUE), cat("YES\n"), cat("NO\n")) : rep

  1   2   >