Re: [R] puzzling RODBC error

2012-12-06 Thread ONKELINX, Thierry
Dear all, Thanks to Marc and Bart for looking in to this. It turns out to be due to a typo of me: I misspelled channel. Best regards, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest team Biometrie Kwaliteitszorg / team

[R] R --no-readline ?, was: history and readline, Mac OSX

2012-12-06 Thread Christian Hoffmann
Hi, By chance I came across an iESS buffer showing that R had been started with this option: R --no-readline This seems to prevent the use of history() which I noticed earlier. Why is this start option chosen, and where can I change this? ESS version 5.13, R: sessionInfo() R version

Re: [R] gamcheck doubts

2012-12-06 Thread Simon Wood
Thanks for the off list plot. I don't see anything untoward in the residual plots here - a good way of getting a feel for what residual plots should look like if the model is ok, is to simulate some data from your fitted model using rnbinom and the fitted values, refit the model to the

[R] Anomalous outputs from rbeta when using two different random number seeds

2012-12-06 Thread Jonathan Minton
Hi, in the code below, I am drawing 1000 samples from two beta distributions, each time using the same random number seed. Using set.seed(80) produces results I expect, in that the differences between the distributions are very small. Using set.seed(20) produces results I can't make sense of.

Re: [R] catching errors in RNetCDF

2012-12-06 Thread Jannis
Hi Pascal, Well, as i see it, this is no error, just a simple message printed to the screen claiming that it is an error. All the mechanisms in R to handle errors (e.g a stop of code execution etc) are, however, not initiated. Cheers Jannis On 06.12.2012 02:53, Pascal Oettli wrote: Hi,

Re: [R] bootstrap based confidence band

2012-12-06 Thread Rui Barradas
Hello, Inline. Em 06-12-2012 03:52, Rebecca escreveu: I'm trying to find a bootstrap based confidence band for a linear model. I have created a data set with X and Y X=runif(n,-1.25,1.25) e=rnorm(n,0,1) Y=exp(3*X)+5*sin((30*X)/(2*pi))+2*e fit=lm(Y~X) You cannot expect this model, a first

Re: [R] catching errors in RNetCDF

2012-12-06 Thread Pascal Oettli
Hi Jannis, The variable is not found. That is why there is an error. Every time I get an error message using 'RNetCDF', I am able to debug the code. Regards, Pascal Le 06/12/2012 20:41, Jannis a écrit : Hi Pascal, Well, as i see it, this is no error, just a simple message printed to the

Re: [R] catching errors in RNetCDF

2012-12-06 Thread Michael Sumner
Do you want to cause an error or catch one? Try removing the try() and see if that helps. This has nothing to do with RNetCDF you could as easily have caught another more basic error. On Thursday, December 6, 2012, Jannis wrote: Hi Pascal, Well, as i see it, this is no error, just a simple

Re: [R] Line numbers with errors and warnings?

2012-12-06 Thread Duncan Murdoch
On 12-12-06 12:01 AM, Worik R wrote: If you `source(test.R, keep.source=FALSE)`, you will see that the line number is not reported. Not always. I have code that uses sapply to call another function and all I get back is the line of the sapply. Useful but in the 21st century I do

Re: [R] Excluding all missing values with dcast (reshape2 package)

2012-12-06 Thread Michael . Laviolette
Thanks for the response. The drop option of dcast was the first thing I tried. Sorry for the lack of reproducibility, but my data set is large, I couldn't find anything in the package examples, and I had hoped the modification would be straightforward. Using dcast was my first choice because it

Re: [R] Excluding all missing values with dcast (reshape2 package)

2012-12-06 Thread Michael . Laviolette
Thanks for the response. It turns out this will work if the data include no other variables with missings; unfortunately, that was the case. I was successful using xtabs with the extra step of converting the returned table to a data frame. Thanks again! -M.L. Hi, ?na.omit() dat1-read.table(text=

[R] function to filter identical data.fames using less than () and greater than ()

2012-12-06 Thread Karl Brand
Esteemed UseRs, I've got many biggish data frames which need a lot subsetting, like in this example: # example eg - data.frame(A = rnorm(10), B = rnorm(10), C = rnorm(10), D = rnorm(10)) egsub - eg[eg$A 0 eg$B 1 eg$C 0, ] egsub egsub2 - eg[eg$A 1 eg$B 0, ] egsub2 # To make this

Re: [R] Line numbers with errors and warnings?

2012-12-06 Thread Richard M. Heiberger
Worik, Please look at the developer and debug packages that have been in ESS since summer 2012. They are designed to help you maneuver through complicated code. Among other things, it allows you to insert breakpoints at the source code level. I suggest you start with the detailed discussion

Re: [R] function to filter identical data.fames using less than () and greater than ()

2012-12-06 Thread Rui Barradas
Hello, Something like this? func - function(data, A, B, C){ f - function(a) function(x) eval(parse(text = paste(x, a))) iA - if(is.na(A)) TRUE else f(A)(data$A) iB - if(is.na(B)) TRUE else f(B)(data$B) iC - if(is.na(C)) TRUE else f(C)(data$C) data[iA iB iC, ] }

Re: [R] function to filter identical data.fames using less than () and greater than ()

2012-12-06 Thread Jeff Newmiller
You have not indicated why the subset function is insufficient for your needs... --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#.

Re: [R] Line numbers with errors and warnings?

2012-12-06 Thread Steve Lianoglou
On Thursday, December 6, 2012, Richard M. Heiberger wrote: Worik, Please look at the developer and debug packages that have been in ESS since summer 2012. They are designed to help you maneuver through complicated code. Among other things, it allows you to insert breakpoints at the source

Re: [R] Incorrect DST time changes in DateTimeClasses

2012-12-06 Thread Jeff Newmiller
What OS are you using? It makes a difference. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go...

Re: [R] What is print print print ?

2012-12-06 Thread Jeff Newmiller
You should be careful that you really want to convert the underlying numeric representation of a factor to your Rank variable ( see str(Vote) ). If you only have three levels as shown it will work, but if you have more than one digit you will probably need to use the as.is argument to the

Re: [R] R --no-readline ?, was: history and readline, Mac OSX

2012-12-06 Thread Jeff Newmiller
This is off topic here. You should post on the ESS help list. --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go...

Re: [R] Incorrect DST time changes in DateTimeClasses

2012-12-06 Thread Uwe Ligges
On 06.12.2012 15:54, Jeff Newmiller wrote: What OS are you using? It makes a difference. ... and R version. Uwe Ligges --- Jeff NewmillerThe . . Go Live...

[R] [R-pkgs] SamplingStrata version 1.0

2012-12-06 Thread Giulio Barcaroli
SamplingStrata (1.0) is now available on CRAN. Package SamplingStrata permits the determination of the best stratification of a sampling frame, the one that ensures the sample of minimum cost, under the condition to satisfy precision constraints in a multivariate and multidomain case. This

Re: [R] do.call

2012-12-06 Thread Dominic Roye
Hi, thanks for your answer, but in this way R delete all rows with NA. In all rows I have values but also NA. I don´t know why it delete all of them. I hope you can give me an idea. Thanks. Best regards, str(temp) 'data.frame': 112598 obs. of 35 variables: $

Re: [R] do.call

2012-12-06 Thread arun
HI Dominic, You are right. na.omit() will delete rows containing at least 1 NAs.  Suppose, a function deletes  only NAs separately for each column, then the length of each column will be different. According to ?data.frame() Objects passed to ‘data.frame’ should have the same number of

[R] Package party Error in model.matrix.default(as.formula(f), data = blocks) :allocMatrix: too many elements specified

2012-12-06 Thread Libo Li
Dear all: I¡¯m trying to get unbiased feature importance of my data via package ¡°party¡±, which contains 1-5 integer value, and a few numeric values attributes. The class label is 1-5 integer value as well. In total I have 20 features with 1100 observations. I checked the type my data

Re: [R] What is print print print ?

2012-12-06 Thread arun
Hi, May be this helps: Lines-Charge Strobe [1] Charge FC    [2] Charge SG    [3] Carcass FC  [1] Carcass Strobe [2] Carcass SG  [3] Chart    Strobe  [1] Chart    FC  [2] Chart    SG  [3] Boy  Strobe [1] Boy  FC  [2] Boy  SG  [3] Wires  Strobe  [1] Wires  SG  [2]

[R] Simplifying matrices ?

2012-12-06 Thread rajashekar
Hi again, the previous answers were great. I was able to do what was planned. Now, I would like to do the following to a matrix: || year | event | team | total || where I can have multiple event per team, but each team only has a year and a total. Thus, this table has multiple lines for

Re: [R] What is print print print ?

2012-12-06 Thread arun
Hi, In addition to ?ave(), You could also use ?tapply() or ?aggregate() if this is what you meant.  Lines-Charge Strobe [1] Charge FC    [2] Charge SG    [3] Carcass FC  [1] Carcass Strobe [2] Carcass SG  [3] Chart    Strobe  [1] Chart    FC  [2] Chart    SG  [3] Boy  Strobe

Re: [R] catching errors in RNetCDF

2012-12-06 Thread Jannis
Thanks Michael and Pascal for your replies, sorry if I did not formulate my post precisely enough. My example code was meant to produce an error to demonstrate the behaviour that I interpretet as not causing real R errors. Also without the try() funtion around it to me it seems that just

Re: [R] Large loops in R

2012-12-06 Thread Charles Novaes de Santana
Thank you all for your help! I used the function big.matrix, from a package named bigmemory, to allocate a large matrix 50k x 50k (http://www.inside-r.org/packages/cran/bigmemory/docs/bigmemory). And I followed the suggestions from Sarah to do the calculations fastly! Thank you very much!

[R] Colors according to value (Excel-Export)

2012-12-06 Thread Mat
Hello together, i have a list of numbers, like this one AB C 1.1 1.2 1.3 i export this list into an excel file and want now color these numbers according to her value. I want every color under 1,25 is red, and every color over 1,25 is green. How can i do this with RDCOMClient ? I know

[R] tool for cluster analysis

2012-12-06 Thread rajashekar
I have Windows XP Professional Version 2002 and the R-Version 2.1.1. I did cluster analysis with the cluster package and the agnes (method = “ward”). The results are satisfactory. But the dendrogram of agnes is confused to work with the results. Is there a tool, I can get a clear arrangement

Re: [R] Colors according to value (Excel-Export)

2012-12-06 Thread Mat
i tried it this way, but this won't help. O3R - sh$PT_IST(zellen_other) O3RF - O3R$Font() O3RF[[Bold]] - TRUE O3RF[[Size]] - 10 O3RF[[Color]] -5287936 perhabs you can help me, how i can differenz between the values of more and less than 1,25? Thanks. Mat -- View this message in context:

Re: [R] do.call

2012-12-06 Thread arun
Hi Dominic, In that case, this might help you. set.seed(15) datos-as.data.frame(matrix(sample(c(1:20,NA),30,replace=TRUE),ncol=6)) do.call(rbind,lapply(split(datos,1:nrow(datos)),function(x) paste(x[!is.na(x)],collapse=;)))  # [,1]  #1 13;3;18;17;14   #2 5;18;14;10;17;3 #3

[R] bigglm (but not glm) error with poisson distribution

2012-12-06 Thread Miki Bálint
Dear All, I am trying to fit a generalized linear model with bigglm() (v. 0.8) on a large dataset containing many zeros under a poisson distribution (in R 2.15.0, 64 bit Ubuntu 12.04). The bigglm() call gives an error message (NA/NaN/Inf in foreign function call (arg 3)). If I understand

Re: [R] nlme starting values are not the correct length

2012-12-06 Thread Lara Reichmann
Hi Petr, Thanks for the email, the number of parameters is not 3 because I am trying to fit a parameter for each treatment level, therefore the start vector changes depending on the fixed statement (see below). I finally got some of these to workbut for some reason I cannot run a complete

Re: [R] Speeding reading of a large file

2012-12-06 Thread Juliet Hannah
All, Can someone describe what x[] - lapply(x, as.numeric) I see that it is putting the list elements into a data frame. The results for lapply are a list, so how does this become a data frame. Thanks, Juliet On Mon, Dec 3, 2012 at 5:49 PM, Fisher Dennis fis...@plessthan.com

Re: [R] function to filter identical data.fames using less than () and greater than ()

2012-12-06 Thread Karl Brand
Rui, Indeed it does help. Also very happy to see eval() and parse() employed and demystified here. In Rdulation, Karl On 06/12/12 15:48, Rui Barradas wrote: Hello, Something like this? func - function(data, A, B, C){ f - function(a) function(x) eval(parse(text = paste(x,

[R] 2-15.2 Windows 32-bit version anywhere ?

2012-12-06 Thread Uzuner, Tolga I
Dear R Users, I am working in an environment in which I am not able to compile any code. Sad, but true. Is there a Windows 32-bit version of 2-15.2 anywhere ? I am currently unable to use packages Matrix and mgcv because they appear to have been compiled for 2-15.2 but only 2-15.1 is

[R] substitute in a list

2012-12-06 Thread Stéphane Dray
Hello, I would like to use substitute in a list to evaluate the formals arguments using the environment define by the arguments list. For instance : f1 - function(x, y = 1:x){ ans - as.list(match.call()) ##possible args: frmls - formals(as.character(ans[[1]])) ## eval formals locally

Re: [R] function to filter identical data.fames using less than () and greater than ()

2012-12-06 Thread Karl Brand
Hi Jeff, Subset is indeed what's reuqired here. But using it every time it's needed was generating excessive amounts of obtuse code. So for the sake of clarity and convenience i wanted a wrapper function to replace these repetitious subsets. Although Rui's example works just fine, love to

Re: [R] 2-15.2 Windows 32-bit version anywhere ?

2012-12-06 Thread Uwe Ligges
On 06.12.2012 17:30, Uzuner, Tolga I wrote: Dear R Users, I am working in an environment in which I am not able to compile any code. Sad, but true. Is there a Windows 32-bit version of 2-15.2 anywhere ? I am currently unable to use packages Matrix and mgcv because they appear to have been

[R] Fitting a multinomial model to a multi-way factorial design with repeated measures: help on package and syntax

2012-12-06 Thread Pierre THIRIET
Dear all, I studied in tank prey fish behavior. Using the design described below (and R code), I want to test the effects of both habitat and predator (and interaction) on prey fish's vertical distribution, which was recorded (with repeated measures) as a categorical variable. I found that

Re: [R] Matrix package will not loead

2012-12-06 Thread Uzuner, Tolga I
Thank you for all this, but it appears to be the case that while the packages have been compiled for 2-15.2, the version of R available for download at CRAN is 2-15.1 . I have submitted another email into the list asking for the 2-15.2 version (sadly, I am not able to compile code in my working

Re: [R] 2-15.2 Windows 32-bit version anywhere ?

2012-12-06 Thread Uzuner, Tolga I
Odd... I am seeing 2-15.1 This is the URL I am going to: http://cran.r-project.org/bin/windows/base/R-2.15.1-win.exe I have tried Imperial College London, and University of Bristol. -Original Message- From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de] Sent: 06 December 2012

[R] Design library

2012-12-06 Thread rajashekar
Dear friends Hello I'm a PhD student in Edinburgh University and interested in survival analysis. By chance, I found design library in Splus software. I have some questions about it and it's highly appreciated if you can help me. In its help (Design library help) I found the topics(not the

Re: [R] Speeding reading of a large file

2012-12-06 Thread Rui Barradas
Hello, Because x[] keeps the dimensions, unlike just x. Hope this helps, Rui Barradas Em 06-12-2012 16:24, Juliet Hannah escreveu: All, Can someone describe what x[] - lapply(x, as.numeric) I see that it is putting the list elements into a data frame. The results for lapply

Re: [R] do.call

2012-12-06 Thread arun
Hi Dominic, You could also do this: set.seed(15) datos-as.data.frame(matrix(sample(c(1:20,NA),30,replace=TRUE),ncol=6)) res1-unlist(lapply(split(datos,1:nrow(datos)),function(x) paste(x[!is.na(x)],collapse=;))) dat1-data.frame(scan(textConnection(res1),wh=a),stringsAsFactors=FALSE)  

Re: [R] 2-15.2 Windows 32-bit version anywhere ?

2012-12-06 Thread Sarah Goslee
Try a different CRAN mirror. My local mirror shows 2.15.2 for Windows as being available. Sarah On Thu, Dec 6, 2012 at 11:30 AM, Uzuner, Tolga I tolga.i.uzu...@jpmorgan.com wrote: Dear R Users, I am working in an environment in which I am not able to compile any code. Sad, but true. Is

Re: [R] tool for cluster analysis

2012-12-06 Thread David L Carlson
First, you are using a very old version of R. The current version is 2.15.2. The version you are using was released in summer 2005 so you should upgrade as soon as possible. Second, there are many tools available for cluster analysis. You should tell us exactly what you trying to do, not give

Re: [R] 2-15.2 Windows 32-bit version anywhere ?

2012-12-06 Thread Uwe Ligges
On 06.12.2012 17:46, Uzuner, Tolga I wrote: Odd... I am seeing 2-15.1 This is the URL I am going to: http://cran.r-project.org/bin/windows/base/R-2.15.1-win.exe Yes, that one is still there, but actually 2.15.2 is linked from http://cran.r-project.org/bin/windows/base/ Uwe Ligges I

Re: [R] function to filter identical data.fames using less than () and greater than ()

2012-12-06 Thread Jeff Newmiller
You ask me to provide code when you have only described your solution rather than your problem. That limits my options more than I care to allow for investing my time. When I think of problems that require repetitive subsetting I tend to look for solutions involving aggregation (?aggregate,

Re: [R] 2-15.2 Windows 32-bit version anywhere ?

2012-12-06 Thread Rui Barradas
Hello, I'm using Windows 7 and I've downloaded my version of R from a CRAN site: http://cran.ma.imperial.ac.uk/ sessionInfo() R version 2.15.2 (2012-10-26) Platform: i386-w64-mingw32/i386 (32-bit) locale: [1] LC_COLLATE=Portuguese_Portugal.1252 LC_CTYPE=Portuguese_Portugal.1252 [3]

Re: [R] tool for cluster analysis

2012-12-06 Thread sagnik ray choudhury
Rajashekar, Please look at as.dendrogram() method, which returns a data structure containing the whole dendogram. Also, you can use $merge on hclust object to understand how the merging works. From the merge matrix, you can recreate the dendogram by yourself. Sagnik On Thu, Dec 6, 2012 at 11:52

[R] Increased Spamming via Nabble

2012-12-06 Thread Martin Maechler
Dear R-help users, In the last couple of days there has been a greatly increased attempt to sneak spam through to the R-help mailing list. A few of these spam messages have made it into the list, but the majority have been discarded by the moderators. The spam messages have been posted to the

Re: [R] Design library

2012-12-06 Thread Uwe Ligges
On 06.12.2012 17:17, rajashekar wrote: Dear friends Hello I'm a PhD student in Edinburgh University and interested in survival analysis. By chance, I found design library in Splus software. I have some questions about it and it's highly appreciated if you can help me. In its help (Design

Re: [R] Matrix package will not loead

2012-12-06 Thread Martin Maechler
Uzuner, Tolga tolga.i.uzu...@jpmorgan.com on Thu, 6 Dec 2012 16:42:37 + writes: Thank you for all this, but it appears to be the case that while the packages have been compiled for 2-15.2, the version of R available for download at CRAN is 2-15.1 . I have submitted another email

Re: [R] Matrix package will not loead

2012-12-06 Thread Uzuner, Tolga I
Many thanks ! Tolga -Original Message- From: Martin Maechler [mailto:maech...@stat.math.ethz.ch] Sent: 06 December 2012 17:19 To: Uzuner, Tolga I Cc: r-help@r-project.org Subject: Re: [R] Matrix package will not loead Uzuner, Tolga tolga.i.uzu...@jpmorgan.com on Thu, 6 Dec 2012

Re: [R] Speeding reading of a large file

2012-12-06 Thread Juliet Hannah
Thanks, it does help. Is it possible to elaborate on how specifically why this syntax preserves dimensions. It this correct to just say that even though lapply returns a list, x[] forces x to have the same dimensions? On Thu, Dec 6, 2012 at 11:53 AM, Rui Barradas ruipbarra...@sapo.pt wrote:

Re: [R] Speeding reading of a large file

2012-12-06 Thread Rui Barradas
Hello, Yes, x[] forces x to keep it's dimensions. In your original post you've asked how does this become a data frame. It doesn't _become_, it already _is_ one. The same goes for vectors, matrices and arrays. The dimensions stay the same. Rui Barradas Em 06-12-2012 17:39, Juliet Hannah

Re: [R] Anomalous outputs from rbeta when using two different random number seeds

2012-12-06 Thread Prof Brian Ripley
On 06/12/2012 11:00, Jonathan Minton wrote: Hi, in the code below, I am drawing 1000 samples from two beta distributions, each time using the same random number seed. Using set.seed(80) produces results I expect, in that the differences between the distributions are very small. Using

Re: [R] function to filter identical data.fames using less than () and greater than ()

2012-12-06 Thread Karl Brand
My problem is that using [ every time i want to extract my data of interest is cumbersome and verbose for the next guy suffering through reading my code. Since my extractions are always on the same columns and depend on either , or neither, a wrapper function or perhaps different function

[R] Vectorizing integrate()

2012-12-06 Thread Doran, Harold
I have written a program to solve a particular logistic regression problem using IRLS. In one step, I need to integrate something out of the linear predictor. The way I'm doing it now is within a loop and it is as you would expect slow to process, especially inside an iterative algorithm. I'm

Re: [R] Vectorizing integrate()

2012-12-06 Thread David Winsemius
On Dec 6, 2012, at 10:10 AM, Doran, Harold wrote: I have written a program to solve a particular logistic regression problem using IRLS. In one step, I need to integrate something out of the linear predictor. The way I'm doing it now is within a loop and it is as you would expect slow to

Re: [R] Fitting a multinomial model to a multi-way factorial design with repeated measures: help on package and syntax

2012-12-06 Thread Stephen Politzer-Ahles
Hi Pierre, Another option to model categorical data with a multinomial outcome is MCMCglmm (see example at http://hlplab.wordpress.com/2009/05/07/multinomial-random-effects-models-in-r/) or glmmADMB (http://glmmadmb.r-forge.r-project.org/ -- this one doesn't seem to be on CRAN). But I haven't

Re: [R] Vectorizing integrate()

2012-12-06 Thread David L Carlson
You can't vectorize the loop because integrate() is not vectorized, but you really need to pass only one index variable if you redefine your function so that you are not re-creating it for each step in the loop. That would let you use sapply(). Here's a toy example that should generalize to your

[R] scope, lme, ns, nlme, splines

2012-12-06 Thread Jacob Wegelin
I want to fit a series of lme() regression models that differ only in the degrees of freedom of a ns() spline. I want to use a wrapper function to do this. The models will be of the form y ~ ns(x, df=splineDF) where splineDF is passed as an argument to a wrapper function. This works fine if

[R] Bootstrap estimates and variance

2012-12-06 Thread Nishil Chandaria
Hi Tim, I have a question and was wondering if you could help me solve it. I have a set of paired data, and have generated 50 bootstrap samples on this in R. However, I am struggling to find codes to find the corresponding estimates, and an estimate for the variance of theta-hat. Any help

Re: [R] Incorrect DST time changes in DateTimeClasses

2012-12-06 Thread Andrew Digby
Apologies - I intended to add that info at the end: OS X 10.8.2 and R 2.15.1. Many thanks. R.Version() $platform [1] x86_64-apple-darwin9.8.0 $arch [1] x86_64 $os [1] darwin9.8.0 $system [1] x86_64, darwin9.8.0 $status [1] $major [1] 2 $minor [1] 15.1 $year [1] 2012 $month [1] 06 $day [1] 22

[R] Analyze multiple data set simultaneoulsy

2012-12-06 Thread Min Dong
Hi, everyone: I have multiple dataset (say 100) in different subdirectory. They have same name and exactly same format. I want to get summary for some columns for each of these dataset (such as mean, SD etc), and list the summary in one output file. It is for sure not effective if I do this one

Re: [R] Simplifying matrices ?

2012-12-06 Thread arun
Hi, It is better to provide an example dataset. Try this: # example on data.frame dat1-data.frame(year=rep(c(1998,1999,2000),each=3),event=rep(LETTERS[1:3],times=3),team=rep(1:3,each=3),total=rep(c(300,320,140),each=3)) library(plyr) res-ddply(dat1,.(year,team),function(x) colMeans(x[4]))  res

[R] clustering of binary data

2012-12-06 Thread marco milella
Good morning, I am analyzing a dataset composed by 364 subjects and 13 binary variables (0,1 = absence,presence). I am testing possible association (co-presence) of my variables. To do this, I was trying with cluster analysis. My main interest is to check for the significance of the obtained

[R] Get an expected value for Order Statistics by applying double integrals

2012-12-06 Thread kyong park
Hi R users, I’d like to get an expected value for a minimum value from order statistics of sample size, say, 5 for standard normal distribution, and the formula would be 5* Integral (from -inf to Inf) x*f(x)* (1-F(x))^4,where f(x) and F(x) are a standard normal density and a cumulative

[R] lme4 glmer general help wanted - code included

2012-12-06 Thread Ben Gillespie
Hi guys, I'm very new to R and have been teaching myself over the past few months - it's a great tool and I'm hoping to use it to analyse my PhD data.As I'm a bit of a newb, I'd really appreciate any feedback and/or guidance with regards to the following questions that relate to generalized

Re: [R] Summary command: Two independent variables against dependent.

2012-12-06 Thread Daniel Martin
Brilliant, thanks very much!! Works fine. Dan On 6 Dec 2012, at 18:25, arun kirshna [via R] wrote: Hi, Your question is not very clear. I hope you are not looking for the subset option in summary(lm()). If you want just the summary(), then use '' or '|' For e.g.

[R] Can somebody help me with following data manipulation?

2012-12-06 Thread Christofer Bogaso
Dear all, let say I have following data: dat - structure(list(V1 = structure(c(1L, 4L, 5L, 3L, 3L, 5L, 6L, 6L, 4L, 3L, 5L, 6L, 5L, 5L, 4L, 4L, 6L, 2L, 3L, 4L, 3L, 3L, 2L, 5L, 3L, 6L, 3L, 3L, 6L, 3L, 6L, 1L, 6L, 5L, 2L, 2L), .Label = c(C, G, I, O, R, T), class = factor), V2 = c(0L, 0L, 0L, 1L,

Re: [R] Assignment of values with different indexes

2012-12-06 Thread arun
HI Brian, If ?names() work for you, then: x - rnorm(10)  myindex - seq(from = 1,to = 20, by = 2)  myindex1-seq(from=1,to=30,by=3) fun1-function(vec1,indx){  y-numeric()  y-na.omit(y[indx]-vec1)  names(y)-indx  y} fun1(x,myindex)  # 1    3    5    7   

[R] Use .Call interface

2012-12-06 Thread Shangru Li
Hi I've written the following program: #include R.h #include Rdefines.h #include Projector.h SEXP Projector2(SEXP L, SEXP G, SEXP W, SEXP xymod, SEXP modif){ int nprot=0; PROTECT(L=AS_NUMERIC(L));nprot++; PROTECT(G=AS_NUMERIC(G));nprot++; PROTECT(W=AS_NUMERIC(W));nprot++;

Re: [R] scope, lme, ns, nlme, splines

2012-12-06 Thread Duncan Murdoch
On 06/12/2012 2:28 PM, Jacob Wegelin wrote: I want to fit a series of lme() regression models that differ only in the degrees of freedom of a ns() spline. I want to use a wrapper function to do this. The models will be of the form y ~ ns(x, df=splineDF) where splineDF is passed as an argument

Re: [R] Can somebody help me with following data manipulation?

2012-12-06 Thread Sarah Goslee
If I understand what you want correctly, aggregate() should do it. aggregate(V3 ~ V1 + V2, mean, data=dat) V1 V2V3 1 C 0 0.500 2 G 0 1.000 3 I 0 0.333 4 O 0 1.000 5 R 0 0.000 6 T 0 0.833 7 I 1 0.4285714 8 O 1 0.000 9 R 1 0.667

[R] Fuction Error

2012-12-06 Thread Douglas Karabasz
I'm calling a list of symbols and then using a function to build a data frame from that symbol list. It works great until I introduce this index symbol from yahoo '^GSPC'. When and index symbol is introduced I get and error which is below. Data - symbolFrame(symbols) Error in get(S) :

Re: [R] Analyze multiple data set simultaneoulsy

2012-12-06 Thread Thomas Stewart
Mindy- If the sub-directories are named in a structured way --- say sd1, sd2, sd3, ..., sd100 --- then one option is a simple for-loop. Something like the code below. -tgs directory.path - '~/blahblah/' # or 'C:/blahblah/' for windows sd.names - paste(directory.path,'sd',1:100,sep=)

Re: [R] Use .Call interface

2012-12-06 Thread William Dunlap
You may have an unfinished statement in Projector.h, which you didn't show. (The error message says line 5, which is immediately after #include Projector.h.) Bill Dunlap Spotfire, TIBCO Software wdunlap tibco.com -Original Message- From: r-help-boun...@r-project.org

Re: [R] Can somebody help me with following data manipulation?

2012-12-06 Thread Thomas Stewart
You can directly use the tapply function. -tgs tapply(dat[,3],dat[,-3],mean) On Thu, Dec 6, 2012 at 3:03 PM, Sarah Goslee sarah.gos...@gmail.com wrote: If I understand what you want correctly, aggregate() should do it. aggregate(V3 ~ V1 + V2, mean, data=dat) V1 V2V3 1 C 0

Re: [R] lme4 glmer general help wanted - code included

2012-12-06 Thread Bert Gunter
You are more likely to get a helpful (or any) response on mixed models issues by posting to the r-sig-mixed-models list, not here. -- Bert On Thu, Dec 6, 2012 at 11:12 AM, Ben Gillespie nebs...@hotmail.com wrote: Hi guys, I'm very new to R and have been teaching myself over the past few

Re: [R] Get an expected value for Order Statistics by applying double integrals

2012-12-06 Thread Thomas Stewart
Kyong- It isn't clear to me why are you using a double integral. You have the pdf and your goal is to calculate the expected value of a univariate random variable (the first order statistic). Shouldn't the expected value be E[X_(1)] = int x * 5 * f(x) * (1-F(x))^4 dx? A single integral? Here

Re: [R] Can somebody help me with following data manipulation?

2012-12-06 Thread David L Carlson
Converting to factors does not get all combinations. v3mean - aggregate(V3~V1+V2, dat, mean) cats - with(dat, expand.grid(V1=unique(V1), V2=unique(V2))) merge(cats, v3mean, all=TRUE) V1 V2V3 1 C 0 0.500 2 C 1NA 3 G 0 1.000 4 G 1NA 5 I 0

Re: [R] clustering of binary data

2012-12-06 Thread David L Carlson
Do not use html in r-help emails. Look below at what happens to your data. The error message is telling you that t(data) is not numeric. str(data) That will tell you what kind of data you have. -- David L Carlson Associate Professor of Anthropology

Re: [R] Fuction Error

2012-12-06 Thread Jeff Newmiller
R doesn't form opinions about your data. If you are not paying attention to what the functions you call expect to receive, then you may find your experience with R is frustrating. In this case, we have no idea what the function symbolFrame is, or what it expects to receive (and it did not come

[R] Best way to coerce numerical data to a predetermined histogram bin?

2012-12-06 Thread Jonathan Greenberg
Folks: Say I have a set of histogram breaks: breaks=c(1:10,15) # With bin ids: bin_ids=1:(length(breaks)-1) # and some data (note that some of it falls outside the breaks: data=runif(min=1,max=20,n=100) *** What is the MOST EFFICIENT way to classify data into the histogram bins (return the

Re: [R] Incorrect DST time changes in DateTimeClasses

2012-12-06 Thread Jeff Newmiller
I see this discontinuity at '2010-04-04 02:26:05' on my Windows 7 x64 with R 2.15.2. I also see it for time zone America_Los_Angeles at '2010-11-07 01:23:09'. I am not entirely sure what the correct behavior should be, since the string does not specify whether it is in daylight or standard

Re: [R] Best way to coerce numerical data to a predetermined histogram bin?

2012-12-06 Thread Jeff Newmiller
?cut --- Jeff NewmillerThe . . Go Live... DCN:jdnew...@dcn.davis.ca.usBasics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#..

Re: [R] Best way to coerce numerical data to a predetermined histogram bin?

2012-12-06 Thread Greg Snow
?findInterval On Thu, Dec 6, 2012 at 3:00 PM, Jonathan Greenberg j...@illinois.eduwrote: Folks: Say I have a set of histogram breaks: breaks=c(1:10,15) # With bin ids: bin_ids=1:(length(breaks)-1) # and some data (note that some of it falls outside the breaks:

Re: [R] Design library

2012-12-06 Thread Frank Harrell
The R rms package is a major update to the Design library. See http://biostat.mc.vanderbilt.edu/Rrms rms is not available for S-Plus. As Uwe said if you are really using S-Plus this is not the right list to use. Frank rajashekar wrote Dear friends Hello I'm a PhD student in Edinburgh

[R] Digital terrain model

2012-12-06 Thread Chiara Odorisio
My purpose is to make a graphical representation using the command persp of a digital terrain model. I have to start form these points: -a digital terrain model (computed on 25 meters) -the same digital terrain model, this time computed on 5 meters These data are easily available as .txt files

Re: [R] lme4 glmer general help wanted - code included

2012-12-06 Thread Ben Gillespie
Thanks Bert - I was unaware of that list. I have since posted my questions there (in plain text). Date: Thu, 6 Dec 2012 12:50:05 -0800 Subject: Re: [R] lme4 glmer general help wanted - code included From: gunter.ber...@gene.com To: nebs...@hotmail.com

Re: [R] Can somebody help me with following data manipulation?

2012-12-06 Thread arun
Hi, You can also use library(plyr) ddply(dat,.(V1,V2),summarise,V3=mean(V3),.drop=FALSE) #   V1 V2    V3 #1   C  0 0.500 #2   C  1   NaN #3   G  0 1.000 #4   G  1   NaN #5   I  0 0.333 #6   I  1 0.4285714 #7   O  0 1.000 #8   O  1 0.000 #9   R  0 0.000 #10  R 

[R] Help with manipulation of matrix object

2012-12-06 Thread Jeremy Ng
Hi list, I have a problem which I was stuck on for a while, and after many days still cannot find a solution to. I have a matrix, measuring m X n. An example matrix will be this: dput(sample) structure(c(2315101, 2315102, 2315103, 2315104, 2315105, 2315107, 2315108, 2315110, 2315112, 2315114,

Re: [R] Help with manipulation of matrix object

2012-12-06 Thread Gerrit Eichner
Hi, Jeremy! ... I have a matrix, measuring m X n. An example matrix will be this: ... [snip] ... What I want to do is actually statistical manipulation of this matrix. To be more precise, I want to calculate the probability of each value, based on the assumption of a normal distribution,