[R] Querying a data frame or data.table

2010-12-03 Thread Santosh Srinivas
Hello Group, Is there an easy way to query a data.frame or data.table (this is fast!) for multiple conditions? I don't want to use a SQL kind of statement. I am looking for something like a subset with multiple conditions. Any tips of the like the binary search methodology used for data.table

[R] treatment effects with lme (repeated measurements)

2010-12-03 Thread Steffen Fleischer
Dear, I want to analyze an outcome in an RCT using lme but I am not sure that I have chosen the right way for the model. We measured the outcome three times repeatedly in the same patient. One time before intervention and two times after intervention. I wanted to adjust for the correlated data

Re: [R] Integral of PDF

2010-12-03 Thread Hans W Borchers
That does not remedy the situation in any case, take the following function fun - function(x) dnorm(x, -500, 50) + dnorm(x, 500, 50) that has a 'mode' of 0 again. Interestingly, if I transform it by 1/x, to integrate I again have to reduce the error tolerance to at least 1e-10:

[R] Linear separation

2010-12-03 Thread soeren . vogel
In https://stat.ethz.ch/pipermail/r-help/2008-March/156868.html I found what linear separability means. But what can I do if I find such a situation in my data? Field (2005) suggest to reduce the number of predictors or increase the number of cases. But I am not sure whether I can, as an

Re: [R] Hmisc label function applied to data frame

2010-12-03 Thread Dieter Menne
KT_rfan wrote: I'm attempting to create a data frame with correlations between every pair of variables in a data frame, so that I can then sort by the value of the correlation coefficient and see which pairs of variables are most strongly correlated. The sm2vec function in the corpcor

Re: [R] Querying a data frame or data.table

2010-12-03 Thread Michael Bedward
Sounds just like the subset function (?) x - as.data.frame(matrix(sample(5, 100, rep=TRUE), ncol=10)) subset(x, V1 3 V2 5) Michael On 3 December 2010 19:05, Santosh Srinivas santosh.srini...@gmail.com wrote: Hello Group, Is there an easy way to query a data.frame or data.table (this is

Re: [R] Integral of PDF

2010-12-03 Thread Samuel Le
. __ Information from ESET NOD32 Antivirus, version of virus signature database 5668 (20101202) __ The message was checked by ESET NOD32 Antivirus. http://www.eset.com __ Information from ESET NOD32 Antivirus, version of virus signature database 5669 (20101203) __ The message

Re: [R] colname refered by a variable

2010-12-03 Thread Ivan Calandra
Or simpler: df[, paste(A,C,sep=)] df[[paste(A,C,sep=)]] Or: x - paste(A,C,sep=) df[,x] df[[x]] Btw, you don't need to use cbind(), data.frame() does it already Ivan Le 12/3/2010 08:21, Santosh Srinivas a écrit : try this .. df[,colnames(df)==paste(A,C,sep=)] On Fri, Dec 3, 2010 at 12:05

Re: [R] treatment effects with lme (repeated measurements)

2010-12-03 Thread Dieter Menne
Steffen Fleischer wrote: .. We measured the outcome three times repeatedly in the same patient. One time before intervention and two times after intervention. I wanted to adjust for the correlated data in the repeated measurement and baseline differences in the variable in order to get

Re: [R] Linear separation

2010-12-03 Thread Ted Harding
On 03-Dec-10 08:34:25, soeren.vo...@eawag.ch wrote: In https://stat.ethz.ch/pipermail/r-help/2008-March/156868.html I found what linear separability means. But what can I do if I find such a situation in my data? Field (2005) suggest to reduce the number of predictors or increase the number of

Re: [R] colname refered by a variable

2010-12-03 Thread Keith Jewell
or even shorter df[,paste(A,C,sep=)] Santosh Srinivas santosh.srini...@gmail.com wrote in message news:aanlktikcjy7bvyfbwuwmrq4dhg4pbdau+qh_7+k+b...@mail.gmail.com... try this .. df[,colnames(df)==paste(A,C,sep=)] On Fri, Dec 3, 2010 at 12:05 PM, Yuan Jian jayuan2...@yahoo.com wrote: Hello,

Re: [R] using ``-'' in function argument

2010-12-03 Thread Ivan Calandra
See below Le 12/3/2010 06:54, Berwin A Turlach a écrit : On Thu, 2 Dec 2010 23:34:02 -0500 David Winsemiusdwinsem...@comcast.net wrote: [...] Erik is telling you that your use of ncol-4 got evaluated to 4 and that the name of the resulting object was ignored, howevert the value of the

Re: [R] latex tables for 3+ dimensional tables/arrays

2010-12-03 Thread Dieter Menne
David Winsemius wrote: On Dec 2, 2010, at 3:47 PM, Michael Friendly wrote: I'm looking for an R method to produce latex versions of tables for table/array objects of 3 or more dimensions, Some time ago, I did a quick hack. Don't know if it helps, it was good enough for my purpose.

Re: [R] StructTS with 2 seasons

2010-12-03 Thread Birgit Erni
Thanks! Following Prof. Ripley's reply I inserted the following lines into StructTS (makeBSM) if (nf 3) { ind - 2L } else { ind - 3:nf T[cbind(ind + 1L, ind)] - 1 } This worked and gave me the same variance estimates as the dlm package.

Re: [R] using ``-'' in function argument

2010-12-03 Thread Michael Bedward
It's only obvious when someone points it out :) fubar is not created because, in the test x 3 returned FALSE, which means the cat function doesn't get used, which means the y arg (fubar - 6) is never required and therefore not evaluated. Evil isn't it ? Michael On 3 December 2010 20:18, Ivan

Re: [R] Please help......barplot2

2010-12-03 Thread Petr PIKAL
Hi r-help-boun...@r-project.org napsal dne 02.12.2010 17:26:20: On Dec 2, 2010, at 11:10 AM, David Lyon wrote: Thanks David Do you have the url link that details the worked solution to my problem: that we have an extensive collection of documentation suitable for beginners

Re: [R] using ``-'' in function argument

2010-12-03 Thread Ivan Calandra
Arf, yes it makes sense now! So the idea here is: never use - in function argument... Thanks for the explanation! Regards, Ivan Le 12/3/2010 10:48, Michael Bedward a écrit : It's only obvious when someone points it out :) fubar is not created because, in the test x 3 returned FALSE, which

Re: [R] procrustes results affected by order of sites in input file

2010-12-03 Thread Gavin Simpson
On Thu, 2010-12-02 at 11:19 -0600, Christine Dolph wrote: Hi, Thanks very much for your response. Thanks Christy, Apologies if I sounded off-hand or dismissive yesterday. It was a busy day, and as your mail lacked a reproducible example nor the code you ran, I wanted to deal with the

Re: [R] Filter data

2010-12-03 Thread Petr PIKAL
Hi Hm. Does str(poli) revealed said explicitly that poli is data frame? I presume that it told you that it is list. In that case you need to use appropriate indexing, which suits structure of your list. Regards r-help-boun...@r-project.org napsal dne 02.12.2010 22:06:15: Simplified

Re: [R] using ``-'' in function argument

2010-12-03 Thread Berwin A Turlach
G'day Ivan, On Fri, 03 Dec 2010 10:54:58 +0100 Ivan Calandra ivan.calan...@uni-hamburg.de wrote: Arf, yes it makes sense now! Well, my original post said: R has lazy evaluation and the assignment takes place when the function evaluates the argument :) So the idea here is: never use - in

Re: [R] Tinn-R 2.3.7.0 released

2010-12-03 Thread Jose Claudio Faria
Hello, All you need are explained at Help/Main/User guide/HTML from Tinn-R menu. Basically: 1. Close R; 2. Menu R/Configure/ Pemanent (Rprofile.site): Tinn-R will generate a small script inside of the file Rprofile.site (located on the folder 'etc' where R is installed); 3. If there are some

Re: [R] using ``-'' in function argument

2010-12-03 Thread Ivan Calandra
Le 12/3/2010 11:35, Berwin A Turlach a écrit : G'day Ivan, On Fri, 03 Dec 2010 10:54:58 +0100 Ivan Calandraivan.calan...@uni-hamburg.de wrote: Arf, yes it makes sense now! Well, my original post said: R has lazy evaluation and the assignment takes place when the function evaluates the

Re: [R] Querying a data frame or data.table

2010-12-03 Thread Dieter Menne
mbedward wrote: Sounds just like the subset function (?) .. Or try sqldf if you feel at home in the SQL empire. Dieter -- View this message in context: http://r.789695.n4.nabble.com/Querying-a-data-frame-or-data-table-tp3070750p3070926.html Sent from the R help mailing list archive

Re: [R] using ``-'' in function argument

2010-12-03 Thread Claudia Beleites
On 12/03/2010 06:54 AM, Berwin A Turlach wrote: On Thu, 2 Dec 2010 23:34:02 -0500 David Winsemiusdwinsem...@comcast.net wrote: [...] Erik is telling you that your use of ncol-4 got evaluated to 4 and that the name of the resulting object was ignored, howevert the value of the operation was

Re: [R] procrustes results affected by order of sites in input file

2010-12-03 Thread Gavin Simpson
On Fri, 2010-12-03 at 09:58 +, Gavin Simpson wrote: On Thu, 2010-12-02 at 11:19 -0600, Christine Dolph wrote: Hi, Thanks very much for your response. Thanks Christy, Apologies if I sounded off-hand or dismissive yesterday. It was a busy day, and as your mail lacked a reproducible

Re: [R] The behaviour of read.csv().

2010-12-03 Thread Duncan Murdoch
On 02/12/2010 9:59 PM, Rolf Turner wrote: On 3/12/2010, at 3:48 PM, David Scott wrote: On 03/12/10 14:33, Duncan Murdoch wrote: SNIP I think the fill=TRUE option arrived about 10 years ago, in R 1.2.0. The comment in the NEWS file suggests it was in response to some strange csv

[R] intraday zoo

2010-12-03 Thread Santosh Srinivas
I'm trying to read intraday zoo but running into issues (again) ... what am I missing here? (the date doesn't seem to read in correctly) head(dat) TrdDate TrdTime impliedVol 1 20090102 09:55:03 0.3610715 2 20090102 09:55:04 0.3637943 3 20090102 09:55:05 0.3752375 4 20090102 09:55:05

[R] Checking for orthogonal contrasts

2010-12-03 Thread S Ellison
A common point made in discussion of contrasts, type I, II, III SS etc is that for sensible comparisons one should use contrasts that are 'orthogonal in the row-basis of the model matrix' (to quote from http://finzi.psych.upenn.edu/R/Rhelp02/archive/111550.html) Question: How would one check,

Re: [R] Querying a data frame or data.table

2010-12-03 Thread David Winsemius
On Dec 3, 2010, at 3:44 AM, Michael Bedward wrote: Sounds just like the subset function (?) x - as.data.frame(matrix(sample(5, 100, rep=TRUE), ncol=10)) subset(x, ) With data,table: require(data.table) xd - as.data.table(x) xd[ V1 3 V2 5 , ] V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 [1,] 4

Re: [R] Strange problems with compiling dll

2010-12-03 Thread Mike Marchywka
Date: Fri, 3 Dec 2010 08:07:15 +0100 From: rom...@r-enthusiasts.com To: r-help@r-project.org CC: diklev...@gmail.com Subject: Re: [R] Strange problems with compiling dll Hello, Your question is more appropriate on the R-devel mailing list.

[R] model values for alpha and beta in a glm gamma inverse distribution

2010-12-03 Thread Rosario Garcia Gil
Hello How could I include in the model a value for lambda in a glm family=poisson model? Or alpha and beta in a glm family=gamma(link=inverse) model? Thanks Rosario __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] colname refered by a variable

2010-12-03 Thread David Winsemius
On Dec 3, 2010, at 4:14 AM, Keith Jewell wrote: or even shorter df[,paste(A,C,sep=)] Other grepping methods that generalize better to partial matches: df[ , grep(^AC$, colnames(df))] df[ grep(^AC$, colnames(df)) ] -- David. Santosh Srinivas santosh.srini...@gmail.com wrote in message

Re: [R] intraday zoo

2010-12-03 Thread Gabor Grothendieck
On Fri, Dec 3, 2010 at 7:37 AM, Santosh Srinivas santosh.srini...@gmail.com wrote: I'm trying to read intraday zoo but running into issues (again) ... what am I missing here? (the date doesn't seem to read in correctly) head(dat)   TrdDate  TrdTime impliedVol 1 20090102 09:55:03  0.3610715

Re: [R] Integral of PDF

2010-12-03 Thread Ravi Varadhan
Your function does NOT have a mode at zero. It is bimodal with 2 modes: -500 and 500. So, my approach still works. Zero is a stationary point where the gradient is zero, but it is not a mode (the second derivative at zero is not negative but it is zero). Ravi.

[R] mgcv package plot superimposing smoothers

2010-12-03 Thread Jef Vlegels
Dear R help list, I'm fitting a 'variable coefficient model' in the MGCV package and I want to plot the different smoothers I get for each factor level in one graph. So, I do something like this to fit the gam: Mtest - gam(outcome ~ s(age, by=as.numeric(gender==0)) +

Re: [R] latex tables for 3+ dimensional tables/arrays

2010-12-03 Thread Michael Friendly
On 12/3/2010 4:19 AM, Dieter Menne wrote: Some time ago, I did a quick hack. Don't know if it helps, it was good enough for my purpose. ## RNW file [snip] Yes, thanks -- that's a good start. Ideally, I'd like to have something that could also take a file= argument and write to a file

Re: [R] Checking for orthogonal contrasts

2010-12-03 Thread Ista Zahn
Hi Steve, The short answer is that there is typically no reason to check (beyond looking to see what contrasts have been defined for the factors in the model; see ?contrasts) because the rules are pretty simple. 1) the design matrix is orthogonal on the row-basis (i.e., the columns sum to zero)

Re: [R] Checking for orthogonal contrasts

2010-12-03 Thread Mike Rennie
There's a pretty good section in the R book by Crawley on contrast statements in R, including some discussion of the contrasts being orthogonal. I would say you should just make your own table and sort it out there- if you have equal sample sizes, then the contrast coefficients along the row

[R] recode letters to numbers

2010-12-03 Thread Katharina Noussi
Hello, I have a dataframe assigning various scores on around 20 variables to a list of countries. The scores are rated on a scale of (D, C, B, A) and there are also some not rated ones (NR) and others are left blank (NA). I now wanted to transfer the scores into numeric values (such as NR=0,

[R] difference between linear model scatterplot matrix

2010-12-03 Thread Francesco Nutini
Dear R-users, I'm studing a DB, structured like this (just a little part of my dataset): _ Site Latitude Longitude Year Tot-Prod Total_Density dmp Dendoudi-1

[R] book about support vector machines

2010-12-03 Thread manuel.martin
Dear all, I am currently looking for a book about support vector machines for regression and classification and am a bit lost since they are plenty of books dealing with this subject. I am not totally new to the field and would like to get more information on that subject for later use with

Re: [R] book about

2010-12-03 Thread Neeti
think this might help you for start. http://www.kernel-machines.org/frequently-asked-questions :) -- View this message in context: http://r.789695.n4.nabble.com/book-about-support-vector-machines-tp3071210p3071218.html Sent from the R help mailing list archive at Nabble.com.

[R] Odp: recode letters to numbers

2010-12-03 Thread Petr PIKAL
Hi If you had your variables as factors you can change levels of each factor. levels(some.factor) - c(0,25,50,27,100) fac-factor(sample(LETTERS[1:5],20, replace=TRUE) ) fac [1] A A D A D A D A C B A A D D D B D E C B Levels: A B C D E levels(fac)-1:5 fac [1] 1 1 4 1 4 1 4 1 3 2 1 1 4 4 4 2

Re: [R] plot more plots from one matrix

2010-12-03 Thread alcesgabbo
I solved the 1° problem with this command: matrix2plot2[,sensor_data]-as.numeric(as.character((matrix2plot2[,sensor_data]))) In fact before the previous command I if write: str(matrix2plot2[,sensor_data]) I get: Factor w/ 10 levels 131.22,148.532,..: 4 6 4 6 9 8 9 8 3 1 ... And after the

Re: [R] recode letters to numbers

2010-12-03 Thread Phil Spector
Katharina - I think something like this may be helpful: z = data.frame(matrix(sample(c(LETTERS[1:4],'NR',NA),100,replace=TRUE),20,5)) codes = c(A=100,B=27,C=50,D=25,NR=0) newz = sapply(z,function(x)codes[x]) - Phil Spector

[R] [r] ANCOVA method

2010-12-03 Thread Francesco Nutini
Dear [R] Users, I have implemented a linear model with this syntax: model- lm (var_dependent ~ var_indipendent + factor + var_indipendent : factor, dataframe) anova (model) Response: var_dependent Df Sum Sq Mean Sq F valuePr(F)

Re: [R] kmeans() compared to PROC FASTCLUS

2010-12-03 Thread Georg Ruß
On 02/12/10 17:49:37, Andrew Agrimson wrote: I've been comparing results from kmeans() in R to PROC FASTCLUS in SAS and I'm getting drastically different results with a real life data set. [...] Has anybody looked into the differences in the implementations or have any thoughts on the matter?

Re: [R] Checking for orthogonal contrasts

2010-12-03 Thread S Ellison
David, Thanks for the comments. I think, though, that I have found the answer to my own post. Question: How would one check, in R, that [contrasts .. are 'orthogonal in the row-basis of the model matrix'] for a particular fitted linear model object? ?lm illustrates the use of crossprod() for

[R] Changing variables after multiple imputation

2010-12-03 Thread Joanna Geller
I am using the MICE package to do multiple imputation. Once I generated my imputed datasets, I wanted to make certain variables binary and certain variables factors. I figured out how to convert my mids file to a dataframe and edit it using the complete function, but evidently, the pool function

Re: [R] book about support vector machines

2010-12-03 Thread Georg Ruß
On 03/12/10 16:23:33, manuel.martin wrote: I am currently looking for a book about support vector machines for regression and classification and am a bit lost since they are plenty of books dealing with this subject. I am not totally new to the field and would like to get more information on

Re: [R] [r] ANCOVA method

2010-12-03 Thread Bert Gunter
Francesco: 1. You need to seek local statistical help. 2. The answer to your question is: it depends in how you define influence significantly. If you define it as the interaction term is significant then, by definition the answer is yes. If you want to understand what is going on and make

[R] subset of a dataframe

2010-12-03 Thread alcesgabbo
HI, I have a dataframe like this: nametype A t1 B t2 C t1 D t1 E t3 Ft2 how can I have a sub dataframe based with the column type like this: (for type = t1) nametype A t1 C t1 D t1 (for type = t2)

Re: [R] Rcode

2010-12-03 Thread Jim Silverton
Hello everyone, I am not too sure if any of you are familiar with simulating RNA-seq data. I am interested in simulating data to perform Fisher's Exact Test. Can you help? -- Thanks, Jim. [[alternative HTML version deleted]] __

Re: [R] subset of a dataframe

2010-12-03 Thread Steve Lianoglou
Hi, On Fri, Dec 3, 2010 at 11:26 AM, alcesgabbo alcesga...@hotmail.com wrote: HI, I have a dataframe like this: name    type A          t1 B           t2 C          t1 D           t1 E           t3 F            t2 how can I have a sub dataframe based with the column type like this:

Re: [R] subset of a dataframe

2010-12-03 Thread David Winsemius
On Dec 3, 2010, at 11:26 AM, alcesgabbo wrote: HI, I have a dataframe like this: nametype A t1 B t2 C t1 D t1 E t3 Ft2 how can I have a sub dataframe based with the column type like this: ?subset (for type = t1) name

[R] Date-time Conversion from Numeric Representations

2010-12-03 Thread Alexander Salim
Hi all, I have a dataset called ,dataSet1'. The time column is given in a numeric code beginning with the year and ending with the minutes. Frist I tried the strptime() function to solve the problem. It gave me just the date back (and not the date and time). There is also the ISOdatetime function

Re: [R] kmeans() compared to PROC FASTCLUS

2010-12-03 Thread Andrew Agrimson
Since I posted last night I've been exploring the possibilities of how the two implementations could be different. The underlying algorithm appears to be slightly but I think the main difference between the two is how the initial seeds are chosen. In FASTCLUS I believe it's some sort of random

Re: [R] Date-time Conversion from Numeric Representations

2010-12-03 Thread Uwe Ligges
On 03.12.2010 16:31, Alexander Salim wrote: Hi all, I have a dataset called ,dataSet1'. The time column is given in a numeric code beginning with the year and ending with the minutes. Frist I tried the strptime() function to solve the problem. It gave me just the date back (and not the date

Re: [R] Rcode

2010-12-03 Thread David Winsemius
On Dec 3, 2010, at 11:30 AM, Jim Silverton wrote: Hello everyone, I am not too sure if any of you are familiar with simulating RNA-seq data. I am interested in simulating data to perform Fisher's Exact Test. Can you help? You are likely to get an audience with a greater density of

[R] Passing par()-parameters to many plot()s in a function

2010-12-03 Thread Alexx Hardt
Hi, I am implementing a function which generates about 10 .pdf plots in the current directory. I need the graphic to fit into a LaTeX-Presentation-slide, so the outer margin should be removed (this is the way to do it, right?): I am having trouble finding out where to put the par command(s).

[R] summary() of a linear model

2010-12-03 Thread Francesco Nutini
Dear R-users, Why variables that appear correlated with dependent variable in a scatterplot, results not correlated in the summary of linear model, and vice versa? I mean, variable Longitude (see the example below) is correlated (***) with dependent variable in the linear model. But

[R] [R-pkgs] formatR update (0.1-5)

2010-12-03 Thread Yihui Xie
In formatR 0.1-5, the dependency on the gWidgets and animation packages are removed. The GUI by gWidgets is optional now. Meanwhile, the function tidy.source() has been moved from the animation package to this package. library(formatR) tidy.source(textConnection(' # rotation of the word

[R] How to get 'R' to talk BACK to other languages / scripts??

2010-12-03 Thread Mike Williamson
Hey everyone, I know that I can call 'R' from other scripts, and that I can make command calls from 'R' (e.g., using system() ). But how can I get 'R' to RETURN values to the script that called it. E.g., I would like to be able to do something like the following (as a simpler example) from

Re: [R] Integral of PDF

2010-12-03 Thread Ravi Varadhan
Yes, Albyn. I do not think that this is a dangerous behavior of the tool (`integrate'). It is certainly a dangerous use of the tool. One will be hard-pressed to find a numerical algorithm/software that is fool-proof in the sense that it always gives you either the correct results or warns you

[R] Calculating weekly/bi-monthly average for time series data

2010-12-03 Thread Ron Michael
Dear all, given a daily time series data, I am able to calculate monthly average, quarterly average like:   library(zoo) dat - zooreg(rnorm(500), start=as.Date(2000-01-01), frequency=1) mo.ave - aggregate(dat, as.yearmon(index(dat)), mean) head(dat) head(mo.ave) However is there any direct way

Re: [R] difference between linear model scatterplot matrix

2010-12-03 Thread Jonathan Christensen
Francesco, My guess would be collinearity of the predictors. The linear model gives you the best fit to all of the predictors at once; unless the predictors are orthogonal (which in a case like this is certainly not the case), there is no guarantee that the parameter estimates which give the best

Re: [R] Passing par()-parameters to many plot()s in a function

2010-12-03 Thread Duncan Murdoch
On 03/12/2010 12:22 PM, Alexx Hardt wrote: Hi, I am implementing a function which generates about 10 .pdf plots in the current directory. I need the graphic to fit into a LaTeX-Presentation-slide, so the outer margin should be removed (this is the way to do it, right?): I am having trouble

Re: [R] Tukey Test, lme, error: less than two groups

2010-12-03 Thread Lilith Epperlein
Dear Steven, I am so happy, that you answered me! I tried what you said to put all the variable in one dataframe. The Pretreatment is not really necessary, because it didn't show any significance. I didn't copy it into the help, because I tried to concentrate on the essential things. Here is

Re: [R] Tukey Test, lme, error: less than two groups

2010-12-03 Thread Lilith Epperlein
Data: __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

Re: [R] Passing par()-parameters to many plot()s in a function

2010-12-03 Thread Alexx Hardt
Am 03.12.2010 20:31, schrieb Duncan Murdoch: On 03/12/2010 12:22 PM, Alexx Hardt wrote: Hi, I am implementing a function which generates about 10 .pdf plots in the current directory. I need the graphic to fit into a LaTeX-Presentation-slide, so the outer margin should be removed (this is the

Re: [R] Tukey Test, lme, error: less than two groups

2010-12-03 Thread Mark Difford
Lilith, No the big mystery is the Tukey test. I just can't find the mistake, it keeps telling me, that there are less than two groups ... ### Tukey test ## summary(glht(PAM.lme, linfct = mcp(Provenancef = Tukey))) Error message: Fehler in glht.matrix(model = list(modelStruct =

[R] How to change a numeric vector to a character value

2010-12-03 Thread Soyeon Kim
Dear All, When I have a numeric vector, I want to change it to one character value. For example, When I have test - c(4, 5, 3, 2) I want to change it to 4 5 3 2(one character value) How can I get it? Thanks in advance, Soyeon __ R-help@r-project.org

Re: [R] How to change a numeric vector to a character value

2010-12-03 Thread Phil Spector
t - c(4, 5, 3, 2) paste(test,collapse=' ') [1] 4 5 3 2 - Phil Spector Statistical Computing Facility Department of Statistics UC

Re: [R] How to get 'R' to talk BACK to other languages / scripts??

2010-12-03 Thread Ista Zahn
Hi Mike, Is this what you want? #!/bin/bash myTest=$(Rscript testing.R.r) echo myTest contains echo $myTest Note that testing.R.r will have to cat() or print() myResult (e.g, my testing.R.r contains myResult - paste(Hello World) cat(myResult) Best, Ista On Fri, Dec 3, 2010 at 1:23 PM, Mike

Re: [R] creating a list of dataframes

2010-12-03 Thread David Katz
1) You have redefined the command list which creates lists - not a great idea. 2) See lapply; for example. Try something like: list.of.df - lapply(list.of.filenames,read.csv) list.of.results - lapply(list.of.df,your.application.function) Regards, David -- View this message in context:

[R] creating a list of dataframes

2010-12-03 Thread lord12
I am iterating through multiple files and storing dataframes in a list. I want to perform calculations on these dataframes. How would I go about doing this? I do: num_files- list.files() list = c() for(x in num_files) { frame = read.table(x) list = c(list, assign(paste(frame,x),frame)) } For

[R] Add columns of dataset

2010-12-03 Thread Lisa
Dear all, I have a dataset that looks like id var1 var2 var4 var7 var8 10.0 0.10.30.90.0 20.4 0.60.00.00.2 30.0 0.00.00.80.7 Some columns are missed, for example, here the fourth (var3), sixth(var5) and seventh (var6)

Re: [R] Add columns of dataset

2010-12-03 Thread Phil Spector
Lisa - I think something like this will do what you want: mydf = data.frame(id=1:3,var1=c(0,.4,0),var2=c(.1,.6,0),var4=c(.3,0,0),var7=c(.9,0,.8),var8=c(0,.2,.7)) allvars = c('id',paste('var',1:8,sep='')) mydf[,allvars[!allvars %in% names(mydf)]] = 0 mydf = mydf[,sort(names(mydf))] mydf

Re: [R] recode letters to numbers

2010-12-03 Thread Jim Lemon
On 12/04/2010 01:25 AM, Katharina Noussi wrote: Hello, I have a dataframe assigning various scores on around 20 variables to a list of countries. The scores are rated on a scale of (D, C, B, A) and there are also some not rated ones (NR) and others are left blank (NA). I now wanted to transfer

Re: [R] Passing par()-parameters to many plot()s in a function

2010-12-03 Thread Duncan Murdoch
On 03/12/2010 3:00 PM, Alexx Hardt wrote: Am 03.12.2010 20:31, schrieb Duncan Murdoch: On 03/12/2010 12:22 PM, Alexx Hardt wrote: Hi, I am implementing a function which generates about 10 .pdf plots in the current directory. I need the graphic to fit into a LaTeX-Presentation-slide, so

Re: [R] Tukey Test, lme, error: less than two groups

2010-12-03 Thread Steven McKinney
Just to close this thread, Lilith provided the data which was in a .csv text file and had multiple lines of blank data at the end species;code;treatment;pretreatment;provenance;greenhouse;individual;leaf;Date;DataPAM Ae;c-ae-1-1-3;C;C;1;1;3;1;25.05.10 14:00; 0.665 . . .

[R] What is the SAS equivalent of this R glm() code?

2010-12-03 Thread Paul Miller
    Hello Everyone,   I'm trying to use SAS to replicate some results obtained in R. I was wondering if anyone call tell me the SAS equivalent of the code that appears below.   fm.glm.x - glm(resp ~ . - 1, data = as.data.frame(mm.x),  na.action = na.exclude, family = binomial(link = probit))

Re: [R] What is the SAS equivalent of this R glm() code?

2010-12-03 Thread Bert Gunter
ummm... This is an R list. Shouldn't you be posting this query on a SAS list? -- Bert (and why would you want to do this anyway?! ... but we won't go there.) On Fri, Dec 3, 2010 at 1:42 PM, Paul Miller pjmiller...@yahoo.com wrote: Hello Everyone, I'm trying to use SAS to replicate some

Re: [R] How to get 'R' to talk BACK to other languages / scripts??

2010-12-03 Thread Kjetil Halvorsen
see below. On Fri, Dec 3, 2010 at 3:23 PM, Mike Williamson this.is@gmail.com wrote: Hey everyone,    I know that I can call 'R' from other scripts, and that I can make command calls from 'R' (e.g., using system() ).  But how can I get 'R' to RETURN values to the script that called it.  

Re: [R] What is the SAS equivalent of this R glm() code?

2010-12-03 Thread peter dalgaard
On Dec 3, 2010, at 22:42 , Paul Miller wrote: Hello Everyone, I'm trying to use SAS to replicate some results obtained in R. I was wondering if anyone call tell me the SAS equivalent of the code that appears below. fm.glm.x - glm(resp ~ . - 1, data = as.data.frame(mm.x),

Re: [R] What is the SAS equivalent of this R glm() code?

2010-12-03 Thread Paul Miller
Hi Bert and others,   I've also tried posting my question to a SAS list. I'm doing the analyses for my study in SAS and so would like to be able to keep everything in that program. Still not familiar enough with R to use it to complete the statistical analysis and reporting for a study. Working

[R] Nash Equilibrium

2010-12-03 Thread ivo welch
Dear R experts: I searched cran (and r-help) for nash equilibrium and game but nothing stuck out. has someone written a numerical nash optimizer for two players? player a has choices x1,x2,x3,... and cares about (maximizes) pa(x1,x2,x3,...,y1,y2,y3) player b has choices y1,y2,y3,..., and cares

Re: [R] Nash Equilibrium

2010-12-03 Thread Ravi Varadhan
I think Christophe Dutang is writing a package for generalized Nash Equilibria models called GNE. I am cc'ing him here. I don't know if there are other packages out there. Christophe would know. Ravi. --- Ravi Varadhan, Ph.D. Assistant

[R] data.table query

2010-12-03 Thread Santosh Srinivas
Hello Group, I need a modification in the data.table example to get my intended result shown below ... is there a more simple way! dt - data.table(A = rep(1:3, each=4), B = rep(1:4, each=3), C = rep(1:2, 6)) dt[, transform(.SD,D=mean(A)), by=B] The result I want is below ... which is probably

Re: [R] Nash Equilibrium

2010-12-03 Thread Spencer Graves
Might something like Nash-Sutcliffe Efficiency be relevant? I found this as follows: library(sos) (n - ???nash) # found 22 links in 11 packages Hope this helps. Spencer On 12/3/2010 3:25 PM, Ravi Varadhan wrote: I think Christophe Dutang is writing a package for generalized

[R] Maximum Number of Rows in a Dataframe

2010-12-03 Thread rushabhbm
Guys, I am new to R so please excuse if I am not very clear. My problem is: I have a 'for' loop in which I am defining a Dataframe df with a SQL query. First iteration gives a df with 31 rows(that's correct), however next iterations also gives me max rows as 31. It's kinda stuck at that value.

Re: [R] Nash Equilibrium

2010-12-03 Thread Ravi Varadhan
No, Spencer. Nash-Sutcliff efficiency is due to John E. Nash. It is unrelated to game theory. The well-known Nash equilibrium in game theory is due to John Forbes Nash, Jr. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, Division of

Re: [R] Maximum Number of Rows in a Dataframe

2010-12-03 Thread Michael Bedward
Hello, Please post a sample of your code so people here can understand what you are trying to do. Michael On 4 December 2010 11:00, rushabhbm rushab...@gmail.com wrote: Guys, I am new to R so please excuse if I am not very clear. My problem is: I have a 'for' loop in which I am defining a

Re: [R] Maximum Number of Rows in a Dataframe

2010-12-03 Thread Rushabh Mehta
for(i in 1:lengthBD) { bdid1 = basicdata[i,] bdid = as.character(bdid1) dq = paste(',bdid,',sep = ) dataquery = paste(select *,From Main_Data AS m JOIN Basic_Data AS b ON m.BD_ID = b.BD_ID JOIN Point_System_Name AS p ON b.psn_id = p.psn_id JOIN Trend_Location as tl ON b.tl_id = tl.tl_id, where

[R] testing and ploting t-distribution

2010-12-03 Thread 5qy
Hi there, I am doing a test to see the the residual is distributed in the form of t-distribution and trying to plot the residuals and the t-distribution to compare in the graph.  Cheers, Bill  - Original Message - From: r-help-requ...@r-project.org Date: Wednesday, December 1,

[R] knowing the code-number of factors in a vector

2010-12-03 Thread Eduardo Klein
Hi, I would like to know how R assigns the numeric code to a set of factors in a vector. For example, I have a vector of 5 different factors in a random order, and I want a color-coded plot by factors: rfactor=as.factor(sample(letters[1:5], 50, replace=T)) rfactor [1] c c c d b a b d d a a

Re: [R] data.table query

2010-12-03 Thread Gabor Grothendieck
On Fri, Dec 3, 2010 at 6:38 PM, Santosh Srinivas santosh.srini...@gmail.com wrote: Hello Group, I need a modification in the data.table example to get my intended result shown below ... is there a more simple way! dt - data.table(A = rep(1:3, each=4), B = rep(1:4, each=3), C = rep(1:2, 6))

Re: [R] testing and ploting t-distribution

2010-12-03 Thread Michael Bedward
Hello Bill, Have a look at the example at the bottom of the help page for ?qqplot Michael On 4 December 2010 11:19, 5...@queensu.ca wrote: Hi there, I am doing a test to see the the residual is distributed in the form of t-distribution and trying to plot the residuals and the

Re: [R] knowing the code-number of factors in a vector

2010-12-03 Thread Rainer Schuermann
It seems to be dependent upon the the character (assigned alphabetically) which I found out by manually changing the order of appearance of the characters in rfactor; the colour would stick to the character a, whether this appears first in rfactor or not. I as able to control the colours being

[R] Does stats::cor use the underlying BLAS? 32- vs. 64-bit issue

2010-12-03 Thread Peter Langfelder
Hi all, I'm curious whether the standard correlation calculation implemented in stats::cor uses the underlying BLAS (at least in the default case use = all.obs). On a 32-bit linux system using R-2.11.1 compiled with GotoBLAS, stats::cor is as fast as matrix multiplication, so it would appear

  1   2   >