[R] Help in using unique count by match function

2012-04-19 Thread arunkumar1111
Hi My code looks like this I have two parameters x and par1. X contains values and par1 contains the function which i required to use if par1 is max then output should be max(x). FUN - match.fun(par1) result=FUN(x) Is it possible to incorporate the unique

Re: [R] call object from character?

2012-04-19 Thread chuck.01
I figured as much. Thank you greatly. plangfelder wrote On Wed, Apr 18, 2012 at 7:25 PM, chuck.01 lt;CharlieTheBrown77@gt; wrote: Let say I have an object (I hope my terminology is correct) a a - 12 a [1] 12 And a has been assigned the number 12, or whatever And lets say I have a

[R] Gaussian quadrature for bivariate normal distribution

2012-04-19 Thread Niroshan
Dear R Users I am maximizing a likelihood function it has two two correlated random effects which follows bivariate normal distribution. To get the marginal distribution I want to integrate out with respect to these two correlated random effects. Does any body know how can I implement gaussian

Re: [R] Help in using unique count by match function

2012-04-19 Thread Petr PIKAL
Hi Your question is rather cryptic. Why the output shall be 3? What has unique count to do with match function? Maybe you want something what is described in switch help. See ?switch Regards Petr Hi My code looks like this I have two parameters x and par1. X contains values and

[R] non-numeric argument in mle2

2012-04-19 Thread Joachim Audenaert
Hi all, I have some problems with the mle2 function RogersIIbinom - function(N0,attackR3_B,Th3_B) {N0-lambertW(attackR3_B*Th3_B*N0*exp(-attackR3_B*(24-Th3_B*N0)))/(attackR3_B*Th3_B)} RogersII_B -

Re: [R] Add covariate in nlme?

2012-04-19 Thread hwouters
Dear Ben, Thanks for your useful information. Now I know at least what I do not want ;-) The sas-code that corresponds to what I want is: proc nlmixed data=stab.BatchdataParameter ; parms Ea=92 A0=93 A1=34.5 e=10 s2=10 A11=1 A12=1; k=

[R] $ operator is invalid for atomic vectors

2012-04-19 Thread Ana-Maria Dobre
I have got the following statement: * overview.domains$sample.var - aggregate(migr$amigo.migr, by=list(siruta=amigo$siruta), var)[,-1]/overview.domains$n.i.* *Error in migr$amigo.migr : $ operator is invalid for atomic vectors* What should i do to solve this error? Thank you. Kind regards,

[R] Print warning messages and save them automatically in a file

2012-04-19 Thread Alexander
Hello, I am working under R2.11.0 Windows and I would like to ask you if you know a way to save all warning messages obtained by the R function warning in a file and keeping the functionalities of the base-function warning. For example if I use external code, I don't want to replace all lines

[R] User defined panel functions in lattice

2012-04-19 Thread Duncan Mackay
Hi I have a problem with passing line and symbol parameters to user defined panel functions I had a look at the archives and created a panel function on what was shown and on panel.loess. I could not to get panel.locfit to work for what I intend it for. There is another layer to work with

[R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread Alexander
Hello, I am working under R2.11 Windows and currently I work on a big R progjet which executes different R script in a row. Every R script represents a module. As every module depends of the variables created in the modules previously executed, I want to be shure, that I don't create or change a

[R] User defined panel functions in lattice

2012-04-19 Thread Duncan Mackay
Hi I have a problem with passing line and symbol parameters to user defined panel functions I had a look at the archives and created a panel function on what was shown and on panel.loess. I could not to get panel.locfit to work for what I intend it for. There is another layer to work with

Re: [R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread Tal Galili
Hi Alexander, Saving full environments is possible, but it is very easy to start loosing track on where each variable came from. You might want to use this process: http://www.r-bloggers.com/a-better-way-of-saving-and-loading-objects-in-r/ It depends on how many variables you work with, but it

[R] Hong Kong R user group

2012-04-19 Thread C.H.
Dear R users in Hong Kong, Please join the HKRUG and we are organizing our 1st meeting. https://groups.google.com/d/forum/hkrug Thank you. CH __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the

Re: [R] $ operator is invalid for atomic vectors

2012-04-19 Thread Milan Bouchet-Valat
Le jeudi 19 avril 2012 à 09:34 +0300, Ana-Maria Dobre a écrit : I have got the following statement: * overview.domains$sample.var - aggregate(migr$amigo.migr, by=list(siruta=amigo$siruta), var)[,-1]/overview.domains$n.i.* *Error in migr$amigo.migr : $ operator is invalid for atomic vectors*

Re: [R] Can I use random Forest package?

2012-04-19 Thread Sarah Goslee
Hi Graeme, We need more information, at the very least str(train) and better would be enough of train included in your email using dput() that we could try your code. It's likely that you do have missing data, or that your data are in the wrong format. Sarah On Apr 18, 2012, at 7:46 PM,

Re: [R] Add covariate in nlme?

2012-04-19 Thread hwouters
Hi all, I solved my problem: The reason for the error was that my initial values were not correctly chosen. In the previous code: nlme.model001epr - nlme(result ~ A0 * exp(- ( exp(A1) * exp(-Ea / (0.0083144*TEMP.K)) * exp(eps)) * time), data = Parameterg,

[R] Find position of asymptote

2012-04-19 Thread Katrina Bennett
Hi all, I would like to find the x position of an two asymptotes. Here is a sample of what I would like to do: x - seq(1, 153,, 153) a - 85 m - 65 s =-1.5 fn - function (x, a, m, s) { a * (exp((m - x)/s) * (1/s))/((1 + exp((m - x)/s)))^2 } plot.deriv1 - fn(1:153, a, m, s) I can find the

Re: [R] Displaying data in Trellis

2012-04-19 Thread ce41188
Thank you for the reply. The more I look at this, the more confused I become. I was wondering if you could walk me through this a little more in detail, in particular the panel method function of doing things. It may be obvious to many, but I haven't really used Trellis before, so I'm still at

Re: [R] non-numeric argument in mle2

2012-04-19 Thread peter dalgaard
On Apr 19, 2012, at 09:52 , Joachim Audenaert wrote: Hi all, I have some problems with the mle2 function RogersIIbinom - function(N0,attackR3_B,Th3_B) {N0-lambertW(attackR3_B*Th3_B*N0*exp(-attackR3_B*(24-Th3_B*N0)))/(attackR3_B*Th3_B)} RogersII_B -

Re: [R] ggplot2: scale_shape_manual

2012-04-19 Thread Brian Smith
Thanks Brian. That worked. I also wanted to increase the size of the 'points' on the graph. Is there any way I can get rid of the 'legend' (in this case '3') appearing on the plot? === code library(ggplot2) leaves - letters[1:8] mat - matrix(sample(1:1000,32),nrow=16,ncol=2)

Re: [R] Reading SPSS: underlying numerical codes

2012-04-19 Thread Marion Wenty
Dear Michael and Ista, thank you very much for your answers! Sorry, I think I wasn't clear about what I need. I will use an example to explain it again: I have imported the following data.frame with the following command using the foreign package: mz1-read.spss(myfile.sav,to.data.frame=T)

Re: [R] Find position of asymptote

2012-04-19 Thread David Winsemius
On Apr 19, 2012, at 4:41 AM, Katrina Bennett wrote: Hi all, I would like to find the x position of an two asymptotes. Here is a sample of what I would like to do: x - seq(1, 153,, 153) a - 85 m - 65 s =-1.5 fn - function (x, a, m, s) { a * (exp((m - x)/s) * (1/s))/((1 + exp((m - x)/s)))^2 }

Re: [R] Reading SPSS: underlying numerical codes

2012-04-19 Thread Paul Bivand
You didn't say that your workflow involved going backwards and forwards between SPSS and R. Importing from legacy formats like SPSS .sav is well developed, with additional resources from packages Hmisc (spss.get) and memisc (spss.system.file) with, in the latter case, support for reading subsets

[R] Don't collapse degenerate array indices

2012-04-19 Thread Sebastian Schubert
Hi, I want to prohibit the automatic collapsing of degenerate array indices: str( array(1,dim=c(3,4,5,1,1)) ) num [1:3, 1:4, 1:5, 1, 1] 1 1 1 1 1 1 1 1 1 1 ... str( array(1,dim=c(3,4,5,1,1))[2:3,1:3,4:5,,] ) num [1:2, 1:3, 1:2] 1 1 1 1 1 1 1 1 1 1 ... The last command removed the degenerate

Re: [R] Don't collapse degenerate array indices

2012-04-19 Thread Duncan Murdoch
On 19/04/2012 9:14 AM, Sebastian Schubert wrote: Hi, I want to prohibit the automatic collapsing of degenerate array indices: str( array(1,dim=c(3,4,5,1,1)) ) num [1:3, 1:4, 1:5, 1, 1] 1 1 1 1 1 1 1 1 1 1 ... str( array(1,dim=c(3,4,5,1,1))[2:3,1:3,4:5,,] ) num [1:2, 1:3, 1:2] 1 1 1 1 1

Re: [R] Don't collapse degenerate array indices

2012-04-19 Thread David Winsemius
On Apr 19, 2012, at 9:14 AM, Sebastian Schubert wrote: Compare str( array(1,dim=c(3,4,5,1,1))[2:3,1:3,4:5,,] str( array(1,dim=c(3,4,5,1,1))[2:3,1:3,4:5,,,drop=FALSE] ) num [1:2, 1:3, 1:2, 1, 1] 1 1 1 1 1 1 1 1 1 1 ... -- David Winsemius, MD West Hartford, CT

Re: [R] Don't collapse degenerate array indices

2012-04-19 Thread Sebastian Schubert
On 19/04/12 15:25, Duncan Murdoch wrote: On 19/04/2012 9:14 AM, Sebastian Schubert wrote: Hi, I want to prohibit the automatic collapsing of degenerate array indices: str( array(1,dim=c(3,4,5,1,1)) ) num [1:3, 1:4, 1:5, 1, 1] 1 1 1 1 1 1 1 1 1 1 ... str(

Re: [R] Displaying data in Trellis

2012-04-19 Thread ilai
On Thu, Apr 19, 2012 at 2:55 AM, ce41188 stevelavr...@hotmail.com wrote: Thank you for the reply. The more I look at this, the more confused I become. I was wondering if you could walk me through this a little more in detail, in particular the panel method function of doing things. It may be

Re: [R] normal distribution assumption for multi-level modelling

2012-04-19 Thread Cecile De Cat
Thanks.   I appreciate this isn't strictly an R question and will pursue on another list. The procedure I followed was inspired from @article{    Author = {Baayen, R. Harald and Milin, Petar},    Title = {Analysing Reaction Times},    Journal = {International Journal of Psychological Research},  

Re: [R] Don't collapse degenerate array indices

2012-04-19 Thread David Winsemius
On Apr 19, 2012, at 9:38 AM, Sebastian Schubert wrote: On 19/04/12 15:25, Duncan Murdoch wrote: On 19/04/2012 9:14 AM, Sebastian Schubert wrote: Hi, I want to prohibit the automatic collapsing of degenerate array indices: str( array(1,dim=c(3,4,5,1,1)) ) num [1:3, 1:4, 1:5, 1, 1] 1 1

[R] How to find a root for a polynomial between [-inf, -3]?

2012-04-19 Thread Michael
Hi all, I have a polynomial (a big one) and I would like to find a root of it between [-inf, -3] (it's known there is one root in this interval)... How to find that root? In using uniroot I need to supply the bounds In using polyroot I need to write it in the strict sens polynomial

Re: [R] Help in using unique count by match function

2012-04-19 Thread R. Michael Weylandt michael.weyla...@gmail.com
I think the OP is looking for the construct length(unique(x)) but not really sure what the rest of the question is. Michael On Apr 19, 2012, at 2:12 AM, Petr PIKAL petr.pi...@precheza.cz wrote: Hi Your question is rather cryptic. Why the output shall be 3? What has unique count to do

Re: [R] introducing R to high school students

2012-04-19 Thread Kjetil Halvorsen
see below. On Wed, Apr 18, 2012 at 2:39 PM, Hadley Wickham had...@rice.edu wrote: If the students are in a science research class, does that mean they have data from their own research that they would want to understand better?  I think that would be much more motivating than anything else.

[R] Bivariate normal integral

2012-04-19 Thread juliane0212
hello, I'm trying to improve the speed of my calculation but didn't get to a satisfying result. It's about the numerical Integration of a bivariate normal distribution. The code I'm currently using x - qnorm(seq(.Machine$double.xmin,c(1-2*.Machine$double.eps),by=0.01), mean=0,sd=1)

[R] Compare String Similarity

2012-04-19 Thread Alekseiy Beloshitskiy
Dear All, I need to estimate the level of similarity of two strings. For example: string1 - c(depending,audience,research, school); string2 - c(audience,push,drama,button,depending); The words in string may occur in different order though. What function would you recommend to use to estimate

Re: [R] Cluster Analysis

2012-04-19 Thread Alekseiy Beloshitskiy
Hi, Taisa, It depends on many paramfactors, e.g. nature of your data, volume of data set etc. The analog of SAS fastclus in R - kmeans (for practical example check slide #35 here: http://www.slideshare.net/whitish/textmining-with-r) Check also kmedoids (pam) and hclust. Good luck, -Alex

Re: [R] Print warning messages and save them automatically in a file

2012-04-19 Thread Alexander
My temporary solution to the problem is trace: trace(warning,tracer=quote({ tmp-try(cat(paste(...),warning.log,append=TRUE,fill=TRUE)) if(is(tmp,try-error)){ print(sys.call()) print(unlist(...)) } })) with best regards Alexander wrote

[R] Study design question; MLB; pay and performance.

2012-04-19 Thread N. S. Miceli, Ph.D.
Dear List Members, I am in the process of designing a study examining pay and performance in Major League Baseball across several seasons, and before I get too deeply into it, I'd like to ask whether the group members think that performance across seasons is independent, or if it needs to be

Re: [R] Study design question; MLB; pay and performance.

2012-04-19 Thread David Winsemius
On Apr 19, 2012, at 11:05 AM, N. S. Miceli, Ph.D. wrote: Dear List Members, I am in the process of designing a study examining pay and performance in Major League Baseball across several seasons, and before I get too deeply into it, I'd like to ask whether the group members think that

Re: [R] Compare String Similarity

2012-04-19 Thread Bert Gunter
Wrong list.This is R, not statistics (or linguistics?).Please post elsewhere. -- Bert On Thu, Apr 19, 2012 at 8:05 AM, Alekseiy Beloshitskiy abeloshits...@velti.com wrote: Dear All, I need to estimate the level of similarity of two strings. For example: string1 -

Re: [R] Bivariate normal integral

2012-04-19 Thread juliane0212
I also tried: m1 - length(x)-1 X1- cbind(x[1:m1],x1[2:length(x)]) X2- cbind(x[1:m1],x1[2:length(x)]) integral - function(rho){ m1 - length(x1)-1 integral - apply(X2,1,function(y) apply(X1,1,function(x)

Re: [R] Compare String Similarity

2012-04-19 Thread R. Michael Weylandt
Though if you do decide to use Levenstein, it's implemented here in R: http://finzi.psych.upenn.edu/R/library/RecordLinkage/html/strcmp.html I'm pretty sure this is in C code so it should be mighty fast. Michael On Thu, Apr 19, 2012 at 11:40 AM, Bert Gunter gunter.ber...@gene.com wrote: Wrong

[R] Fwd: User defined panel functions in lattice

2012-04-19 Thread ilai
On Thu, Apr 19, 2012 at 2:30 AM, Duncan Mackay mac...@northnet.com.au wrote: Hi  xyplot(y ~x|Farm,xx,         groups = Padd,         panel = panel.superpose,         panel.groups=function(x,y, ...){                        panel.Locfit(x,y,...)                        panel.xyplot(x,y,...)  

Re: [R] Compare String Similarity

2012-04-19 Thread Alekseiy Beloshitskiy
Thank you, Michael, Right, I m looking for R implementation of Leventstein or or any other similar approaches. Will try it. Thank you again! -Alex From: R. Michael Weylandt [michael.weyla...@gmail.com] Sent: 19 April 2012 19:01 Cc: Alekseiy Beloshitskiy;

Re: [R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread cberry
Alexander, If Tal's suggestion to use caching in Sweave doesn't appeal to you, you might look at 'R.cache' and other packages mentioned in http://cran.r-project.org/web/views/ReproducibleResearch.html under 'Caching of R Objects'. However, an advantage of the Sweave-like approaches is that

[R] Multiple equation models in time-series cross-section (panel) data

2012-04-19 Thread David A. Kim
Hello, Could anyone recommend a package for multiple (i.e., structurally linked) equation models for time-series cross-section data? I've been using the plm package for single-equation, fixed effects models, but have not been able to find a package with similar functionality for models with

Re: [R] Find position of asymptote

2012-04-19 Thread Katrina Bennett
Hi David, thanks for the reply. This is not a homework problem, although it may sound like one :) I was trying to provide a reproducible example of what I am trying to do. The problem is something I am trying to work on for my PhD program. I've been using the nls() function to derive a

Re: [R] Study design question; MLB; pay and performance.

2012-04-19 Thread Albyn Jones
There is an ASA section on statistics in sports, you might start looking there... http://www.amstat.org/sections/sis/ albyn On Thu, Apr 19, 2012 at 10:05:39AM -0500, N. S. Miceli, Ph.D. wrote: Dear List Members, I am in the process of designing a study examining pay and performance in

Re: [R] How to find a root for a polynomial between [-inf, -3]?

2012-04-19 Thread Petr Savicky
On Thu, Apr 19, 2012 at 08:59:34AM -0500, Michael wrote: Hi all, I have a polynomial (a big one) and I would like to find a root of it between [-inf, -3] (it's known there is one root in this interval)... How to find that root? In using uniroot I need to supply the bounds Hi. Is

Re: [R] problem extracting data from a set of list vectors

2012-04-19 Thread Vining, Kelly
Thanks for the help, Don. Lots of good suggestions there. Unfortunately, I'm still not able to access the data object. Still looking for a solution. Here's the error I'm getting when I try your suggestion: [1] res.Callus.Explant res.Callus.Regen res.Explant.Regen all.comps -

Re: [R] problem extracting data from a set of list vectors

2012-04-19 Thread jim holtman
I think that instead of: obj = all.comps[[i]]; you should have obj - get(all.comps[i]) Test out your programs step by step manually. Use the 'all.comps' object and see what happens with the various indexing modes. This is debugging 101. On Thu, Apr 19, 2012 at 1:01 PM, Vining, Kelly

Re: [R] Compare String Similarity

2012-04-19 Thread Prof. Dr. Matthias Kohl
you should also look at Bioconductor Package Biostrings hth Matthias Am 19.04.2012 18:01, schrieb R. Michael Weylandt: Though if you do decide to use Levenstein, it's implemented here in R: http://finzi.psych.upenn.edu/R/library/RecordLinkage/html/strcmp.html I'm pretty sure this is in C code

[R] to know observations and groups used in a mixed model using gee package

2012-04-19 Thread david oseguera montiel
Does anyone know how to find the number of observations and groups used in a mixed model with gee package? The summary function in gee package does not provide this information. e.g. data(warpbreaks) summary(gee(breaks ~ tension, id=wool, data=warpbreaks, corstr=exchangeable)) I much

Re: [R] Bivariate normal integral

2012-04-19 Thread peter dalgaard
On Apr 19, 2012, at 16:08 , juliane0212 wrote: hello, I'm trying to improve the speed of my calculation but didn't get to a satisfying result. It's about the numerical Integration of a bivariate normal distribution. The code I'm currently using x -

Re: [R] problem extracting data from a set of list vectors

2012-04-19 Thread MacQueen, Don
This looks like a correct correction. Thanks -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 4/19/12 10:14 AM, jim holtman jholt...@gmail.com wrote: I think that instead of: obj = all.comps[[i]]; you should have obj

[R] Solve an ordinary or generalized eigenvalue problem in R?

2012-04-19 Thread Jonathan Greenberg
Folks: I'm trying to port some code from python over to R, and I'm running into a wall finding R code that can solve a generalized eigenvalue problem following this function model: http://docs.scipy.org/doc/scipy/reference/generated/scipy.linalg.eig.html Any ideas? I don't want to call python

[R] Dependency-aware scripting tools for R

2012-04-19 Thread Sean Davis
There are numerous tools like scons, make, ruffus, ant, rake, etc. that can be used to build complex pipelines based on task dependencies. These tools are written in a variety of languages, but I have not seen such a thing for R. Is anyone aware of a package available? The goal is to be able to

[R] SmoothTrend in OpenAir

2012-04-19 Thread David Doyle
I'm trying to plot smooth trend using smoothTrend in OpenAir but I'm having problems. I used the following code. - #Set my working dir to the dir with my files setwd(c:/R) #Load the openair library library(openair)

Re: [R] Dependency-aware scripting tools for R

2012-04-19 Thread Ben Bolker
Sean Davis sdavis2 at mail.nih.gov writes: There are numerous tools like scons, make, ruffus, ant, rake, etc. that can be used to build complex pipelines based on task dependencies. These tools are written in a variety of languages, but I have not seen such a thing for R. Is anyone aware

Re: [R] non-numeric argument in mle2

2012-04-19 Thread Ben Bolker
peter dalgaard pdalgd at gmail.com writes: On Apr 19, 2012, at 09:52 , Joachim Audenaert wrote: Hi all, I have some problems with the mle2 function RogersIIbinom - function(N0,attackR3_B,Th3_B) {N0-lambertW(attackR3_B*Th3_B*N0*exp(-attackR3_B*(24-Th3_B*N0)))/

Re: [R] Pierce's criterion

2012-04-19 Thread Greg Snow
Determining what is an outlier is complicated regardless of the tools used (this is a philosophical issue rather than an R issue). You need to make some assumptions and definitions based on the science that produces the data rather than the data itself before even approaching the question of

Re: [R] SmoothTrend in OpenAir

2012-04-19 Thread Clint Bowman
I was able to get the plot by converting the dates in the date column to dates, e.g., mytable-read.csv(MCNP-pH.csv) newdate-with(mytable,strptime(date,%m/%d/%Y)) mytable$date-newdate smoothTrend(mytable, pollutant = pH) Clint BowmanINTERNET: cl...@ecy.wa.gov Air

[R] Problem with integration on Heston model

2012-04-19 Thread Guaramy
Hi , I am writing some code to evaluate a price of an option with heston model. My problem is that i need one variable to be generic . Hestonf = function(phi,kappa,theta,sigma,rho,v0,r,T,s0,type) { if (type == 1) { u = 0.5; b = kappa-rho*sigma; } else { u = 0.5;

[R] mlogit learning error

2012-04-19 Thread geek girl
I am learning five mlogits as follows v1.model-mlogit(v1~1|v2+v3+v4+v5, data=mlogit.v1.data, reflevel=1) v2.model-mlogit(v2~1|v1+v3+v4+v5, data=mlogit.v2.data, reflevel=1) v3.model-mlogit(v3~1|v1+v2+v4+v5, data=mlogit.v3.data, reflevel=1) v4.model-mlogit(v4~1|v1+v2+v3+v5, data=mlogit.v4.data,

[R] suggested method to transform list to a matrix

2012-04-19 Thread Tim Stutt
I have data in the following list format: USER,VARIABLE,COUNT user1, var1, 3 user1, var2, 4 user2, var1, 7 userN, var12, 5 And would like to have it format as a matrix: var1var2var12 user1 3 4 user2 7 userN

[R] question about lists

2012-04-19 Thread harry mamaysky
I am new to R, and I have been running into the following situation when I mistype a variable name in some code: list1 - list( a=1, b=2 ) list2 - list( a=1 ) list2$b - list1$c list2 $a [1] 1 I would think at the point where I am trying to reference a field called c -- that does not exist --

[R] Performing t tests between matrices

2012-04-19 Thread John Smith
I need to perform 1 T tests #I have two populations with different means Popc1-rnorm(10,10,2) Popc2-rnorm(10,8,2) #I created two sets of samples - each set has 1 samples, and I made a matrix of 20 rows and 1 columns to fit the data sampc1-matrix(,20,1) for(j in

Re: [R] Performing repeated T tests in R

2012-04-19 Thread Rui Barradas
Hello, #I wrote a blank matrix with 1 row and 1 columns. Why not a vector? (It would be a column vector, which might not fit your needs.) And though not really a problem, the matrix is called 't', the name of R's transpose function. I can become confusing, maybe you could call it 'tstat'

[R] Performing t tests between matrices

2012-04-19 Thread Nirmal Nair
I need to perform 1 T tests #I have two populations with different means Popc1-rnorm(10,10,2) Popc2-rnorm(10,8,2) #I created two sets of samples - each set has 1 samples, and I made a matrix of 20 rows and 1 columns to fit the data sampc1-matrix(,20,1) for(j in

[R] Reading a file with random whitespace

2012-04-19 Thread John S
Dear R-users, I have a large data file that I am trying to read in R where the file has a white space at the begging and at random places. The whitespace is actually NA so I am trying to read the file using scan but with no success!! Please help Here are some example rows from the data file.

Re: [R] Help in using unique count by match function

2012-04-19 Thread Rui Barradas
Hello, arunkumar wrote Hi My code looks like this I have two parameters x and par1. X contains values and par1 contains the function which i required to use if par1 is max then output should be max(x). FUN - match.fun(par1) result=FUN(x) Is it

[R] mlogit learning error 2

2012-04-19 Thread geek girl
I forgot to say that the models for v2 and v5 worked fine on a smaller dataset, but gave me this error on a larger dataset. Thanks [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] Performing repeated T tests in R

2012-04-19 Thread John Smith
I need to perform 1 T tests #I have two populations with different means Popc1-rnorm(10,10,2) Popc2-rnorm(10,8,2) #I created two sets of samples - each set has 1 samples, and I made a matrix of 20 rows and 1 columns to fit the data sampc1-matrix(,20,1) for(j in

Re: [R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread Alexander
Hi thank you for your suggestions, but I am not sure if I explained my problem well enough. Lets asume, that I have 30 different script files and 1 script which calls these 30 scripts one after the other by source. Some of the 30 scripts only contain definitions of functions which are called in

Re: [R] suggested method to transform list to a matrix

2012-04-19 Thread R. Michael Weylandt
Use matrix subsetting like this: x - matrix(1:9,3) rownames(x) - letters[1:3] colnames(x) - LETTERS[1:3] print(x) usrs - c(a,b,a) vars - c(C,C,A) counts - c(10,11,12) x[cbind(usrs, vars)] - counts print(x) Hope this helps, Michael On Thu, Apr 19, 2012 at 1:48 PM, Tim Stutt

[R] ANOVA in quantreg - faulty test for 'nesting'?

2012-04-19 Thread galen
I am trying to implement an ANOVA on a pair of quantile regression models in R. The anova.rq() function performs a basic check to see whether the models are nested, but I think this check is failing in my case. I think my models are nested despite the anova.rqlist() function saying otherwise. Here

Re: [R] mlogit learning error

2012-04-19 Thread R. Michael Weylandt
There's something in your data that makes the model computationally singular when you take the various subsettings... Can you provide a small reproducible example so we can help narrow it down? It looks like you're using different data for each mlogit though so I'm not sure how the comparison that

Re: [R] Reading a file with random whitespace

2012-04-19 Thread R. Michael Weylandt
It looks like you might want to use read.fwf for fixed width files Michael On Thu, Apr 19, 2012 at 3:45 PM, John S john.smith...@gmail.com wrote: Dear R-users, I have a large data file that I am trying to read in R where the file has a white space at the begging and at random places. The

Re: [R] call object from character?

2012-04-19 Thread Greg Snow
Almost always when people ask this question (it and its answer are FAQ 7.21) it is because they want to do things the wrong way (just don't know there is a better way). The better way is to put the variables that you want to access in this way into a list, then you can easily access the objects

Re: [R] suggested method to transform list to a matrix

2012-04-19 Thread David Winsemius
On Apr 19, 2012, at 1:48 PM, Tim Stutt wrote: I have data in the following list format: USER,VARIABLE,COUNT user1, var1, 3 user1, var2, 4 user2, var1, 7 userN, var12, 5 And would like to have it format as a matrix: var1var2var12 user1 3

[R] How to flatten a multidimensional array into a dataframe?

2012-04-19 Thread Emmanuel Levy
Hi, I have a three dimensional array, e.g., my.array = array(0, dim=c(2,3,4), dimnames=list( d1=c(A1,A2), d2=c(B1,B2,B3), d3=c(C1,C2,C3,C4)) ) what I would like to get is then a dataframe: d1 d2 d3 value A1 B1 C1 0 A2 B1 C1 0 . . . A2 B3 C4 0 I'm sure there is one function to do this

Re: [R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread Alexander
Thank you for the idea with caching... Alexander Alexander wrote Hi thank you for your suggestions, but I am not sure if I explained my problem well enough. Lets asume, that I have 30 different script files and 1 script which calls these 30 scripts one after the other by source. Some

Re: [R] How to flatten a multidimensional array into a dataframe?

2012-04-19 Thread Marc Schwartz
On Apr 19, 2012, at 3:46 PM, Emmanuel Levy wrote: Hi, I have a three dimensional array, e.g., my.array = array(0, dim=c(2,3,4), dimnames=list( d1=c(A1,A2), d2=c(B1,B2,B3), d3=c(C1,C2,C3,C4)) ) what I would like to get is then a dataframe: d1 d2 d3 value A1 B1 C1 0 A2 B1 C1 0 .

Re: [R] working with environments to ensure code quality for long R scripts

2012-04-19 Thread Bert Gunter
Comment (caveat emptor): If I understand correctly, your difficulties all stem from your use of the word script, which betrays a fundamental misunderstanding of the nature of R as a programming language. R is based (mostly) on the concepts of functional programming. So instead of doing what as

Re: [R] How to flatten a multidimensional array into a dataframe?

2012-04-19 Thread Emmanuel Levy
OK, it seems that the array2df function from arrayhelpers package does the job :) On 19 April 2012 16:46, Emmanuel Levy emmanuel.l...@gmail.com wrote: Hi, I have a three dimensional array, e.g., my.array = array(0, dim=c(2,3,4), dimnames=list( d1=c(A1,A2), d2=c(B1,B2,B3),

Re: [R] How to flatten a multidimensional array into a dataframe?

2012-04-19 Thread baptiste auguie
library(plyr) adply(my.array,1:3) HTH, baptiste On 20 April 2012 08:46, Emmanuel Levy emmanuel.l...@gmail.com wrote: Hi, I have a three dimensional array, e.g., my.array = array(0, dim=c(2,3,4), dimnames=list( d1=c(A1,A2), d2=c(B1,B2,B3), d3=c(C1,C2,C3,C4)) ) what I would like to get is

[R] Thanks-solved:RE: problem extracting data from a set of list vectors

2012-04-19 Thread Vining, Kelly
Thanks Don and Jim, Get did the trick! That command is new to me, and is exactly what this problem needed. The syntax that worked is actually slightly simpler than what was suggested. This is what worked: all.comps - ls(pattern=^res) for(i in all.comps){ obj = get(i); ... Thanks again.

[R] Trouble with [sv]apply

2012-04-19 Thread Worik R
Friends I clearly donot understand how sapply and vapply work. What I have is a function that returns a matrix with an indeterminate number of rows (some times zero) but a constant number of columns. I cannot reliably use an apply function to assemble the matrices into a matrix. I am not sure

Re: [R] mlogit learning error

2012-04-19 Thread geek girl
Thank you for your response. Each v can take a a value from 1 to 100. Input data subset: v1.data v1 v2 v3 v4 v5 1 1591 5152 2 1591783 3 1591 4611 4 1991 8411 5 1591 31 4 6

Re: [R] mlogit learning error

2012-04-19 Thread geek girl
I found out that this error means there is an underflow that is not handled by the default solve. The suggested solution is to use qr.solve() or svd instead of default.solve(). How can I modify mlogit to use qr.solve() instead of solve.default()? Thanks On Thu, Apr 19, 2012 at 2:10 PM, geek

Re: [R] Fwd: User defined panel functions in lattice

2012-04-19 Thread Duncan Mackay
Hi ilai Thank you for your suggestions. I do not know what happened yesterday I must have omitted a few changes out in going from R to email and apologies for the double posting - I had troubles sending it as my ISP gave a message of not being connected for email but was for the web I was

Re: [R] question about lists

2012-04-19 Thread Duncan Murdoch
On 12-04-19 3:11 PM, harry mamaysky wrote: I am new to R, and I have been running into the following situation when I mistype a variable name in some code: list1- list( a=1, b=2 ) list2- list( a=1 ) list2$b- list1$c list2 $a [1] 1 I would think at the point where I am trying to reference a

Re: [R] Dependency-aware scripting tools for R

2012-04-19 Thread Aaron Mackey
shameless self-plug: we break out of R to do this, and after many painful years developing and maintaining idiosyncratic Makefiles, we are now using Taverna to (visually) glue together UNIX commands (including R scripts) -- the benefits of which (over make and brethren) is that you can actually

[R] depmixS4+transition

2012-04-19 Thread nglthu
Dear helpers, is there any possible that transition (in depmixS4) is in scale of two variable, e.g transition=~scale(x1,x2)? If it can be, how transition of two variable (covariate time) can be worked in depmixS4-hidden markov model for time series. Many thanks, nglthu -- View this message in

Re: [R] Find position of asymptote

2012-04-19 Thread Katrina Bennett
Dear R Help, Sorry I wasn't more clear before. Here is another crack at this. What I am still trying to do is estimate the point on a line when the slope changes or asymptotes. I have found some similar postings talking about this but no answers.

[R] PCA sensitive to outliers?

2012-04-19 Thread Michael
Hi all, I found that the PCA gave chaotic results when there are big changes in a few data points. Are there improved versions of PCA in R that can help with this problem? Please give me some pointers... Thank you! [[alternative HTML version deleted]]

Re: [R] Trouble with [sv]apply

2012-04-19 Thread Jeff Newmiller
If you read the help, it talks about compiling vectors into matrices, or scalars into vectors. It does not say anything about combining matrices. For the error about 14 elements, you should keep in mind that matrices are just vectors with dim attributes that indicate how the linear memory is to

[R] want to forecast AR model calculate R square (but which method is good)

2012-04-19 Thread sagarnikam123
i used itsmr package , want to forecast AR model calculate R square to judge my forecasting/prediction ,that is it good or not ? i take original model(i)make example/demo model(j) ( 20 numbers less from original model) #AR model forecasting i-read.table(file.choose(),skip=1) #taking times

[R] what is the maximum number of records that we can load using dbwrite

2012-04-19 Thread arunkumar1111
Hi I'm using the dbwrite to insert a large dataset. There are about 10 million rows. But i'm not able to load the records. Please can anyone tell me the way to load or maximum number of records that dbwrite does. so that i can load it in batches - Thanks in Advance Arun -- View this

Re: [R] what is the maximum number of records that we can load using dbwrite

2012-04-19 Thread Jeff Newmiller
This doesn't sound like a question we can answer for you, as it would likely depend on your RAM, virtual memory, OS, and other processes. I would be willing to bet you can load one record at a time. You already know that ten million won't work. Why don't you read

  1   2   >