Re: [R] How to detect and exclude outliers in R?

2010-01-18 Thread GlenB
What makes an outlier an outlier depends on the model. A highly discrepant observation under one model is entirely typical under another. Even given a model, criteria for what consititutes an outlier vary by application area and user. Even given all of that, exclusion is only one of many possib

Re: [R] How to detect and exclude outliers in R?

2010-01-18 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of vikrant > Sent: Monday, January 18, 2010 10:09 PM > To: r-help@r-project.org > Subject: [R] How to detect and exclude outliers in R? > > > Suppose I am reading data from a file a

[R] How to detect and exclude outliers in R?

2010-01-18 Thread vikrant
Suppose I am reading data from a file and the data contains some outliers. I want to know if it is possible in R to automatically detect outliers in a dataset and remove them -- View this message in context: http://n4.nabble.com/How-to-detect-and-exclude-outliers-in-R-tp1017285p1017285.html Sent

[R] how to open excel 2007 (.xlsx) file in R

2010-01-18 Thread vikrant
i am unable to open a file which is saved as .xlsx format in R . The file contains approximately 1,50,000 rows. So I m not able to save it as csv file.Please suggest ways to open this file -- View this message in context: http://n4.nabble.com/how-to-open-excel-2007-xlsx-file-in-R-tp1017273p101

[R] RSPerl help.

2010-01-18 Thread yvijayalakshmi
Dear Sir, I am Vijaya, working as a research assistant in one small research organisation named IBAB in India. Here is my problem, after installing RSPerl in linux, I tried to test it by executing test.pl program which is present in RSPerl/script directory but I am getting the following

Re: [R] change codes into loops

2010-01-18 Thread Simon Knapp
You can do this... # Some random data: b_1 <- b_2 <- b_3 <- matrix(,2,3) for(i in 1:3) eval(substitute(A <- matrix(rnorm(6), 2), list(A=paste('a', i, sep='' # the loop for (i in 1:2) { for (j in 1:3) { for(k in 1:3) { eval(substitute(A[i,j] <- rank(c(a1[i,j],a2[i,j],a

[R] Data import export zipped files from URLs

2010-01-18 Thread Velappan Periasamy
I am not able to import zipped files from the following link. How to get thw same in to R?. mydata <- read.csv("http://nseindia.com/content/historical/EQUITIES/2010/JAN/cm15JAN2010bhav.csv.zip";) __ R-help@r-project.org mailing list https://stat.ethz.ch

Re: [R] CAMAN R package

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 10:55 PM, David Winsemius wrote: On Jan 18, 2010, at 8:58 PM, Jim Silverton wrote: Hello everyone, I tried searching for a manual for CAMAN package for mixture models, but was unable to find one. Does anyone have the pdf manual for this package? http://www.charite.de

[R] A model-building strategy in mixed-effects modelling

2010-01-18 Thread Stats Wolf
Dear all, Consider a completely randomized block design (let's use data(Oats) irrespoctive of the split-plot design it was arranged in). Look: library(nlme) fit <- lme(yield ~ nitro, Oats, random = ~1|Block, method="ML") fit2 <- lm(yield ~ nitro + Block, Oats) anova(fit, fit2) gives this: Mo

[R] Help ~

2010-01-18 Thread Fan Dan
Dear Helper: Thank you very much for your time on this question. It is a little long and complicated. Generate a clustered pattern in [0; 1]2 as follows: (a) Generate n, say 20, independent cluster centers (which can be called parents) that are distributed i.i.d. uniformly in the unit square;

[R] Two-stage Probit Least Squares

2010-01-18 Thread Patrick Shea
Has anyone successful conducted 2SPLS (or better yet, two stage conditional maximum likelihood) in R? If so, could you point me in the right direction? I have searched around, but have not seen any examples. Thanks, Patrick _

Re: [R] CAMAN R package

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 8:58 PM, Jim Silverton wrote: Hello everyone, I tried searching for a manual for CAMAN package for mixture models, but was unable to find one. Does anyone have the pdf manual for this package? Where did you get the package? -- David. _

Re: [R] (no subject)

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 10:15 PM, Jim Silverton wrote: I am considering testing: Ho: Odds Ratio =1 H1: Odds Ratio <>1 How can I generate data from the null distribution for a specific configuration of a Fisher exact test? ?r2dtable -- David. __ R-help

[R] (no subject)

2010-01-18 Thread Jim Silverton
I am considering testing: Ho: Odds Ratio =1 H1: Odds Ratio <>1 How can I generate data from the null distribution for a specific configuration of a Fisher exact test? Jim [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] R and S+ Courses offered by TIBCO Spotfire (both Blended and Live)

2010-01-18 Thread Louis Bajuk-Yorgan
Hello All, The TIBCO Spotfire Q1 course schedule for R and S+ training is now available online at: http://inter.viewcentral.com/reg/TIBCO/stats Take advantage of one of our live courses delivered by professional instructors and statisticians, or space out your learning to increase re

Re: [R] how to install spatstat

2010-01-18 Thread Rolf Turner
On 19/01/2010, at 11:24 AM, Senlin Liang wrote: Hi, I tried to install spatstat using: install.packages("spatstat", dependencies = TRUE, lib = "./R/i486-pc-linux-gnu-library/2.8") but got the following msg: --- Please select a CRAN mirror for use in this session --- The error message is pu

Re: [R] change codes into loops

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 9:21 PM, rusers.sh wrote: > If the number of datasets for a* is small (here is 3), it is ok for > creating b_ijn[i, j, nn] and make assignments to it. But it will be > a little bit impossible for a larger number of datasets for a*, say > 999. We may need 999 lines to do

Re: [R] Odp: For loops in R

2010-01-18 Thread cjmr
Hello Petr. For the random values, I wanted to generate a different random number for each element of my velocity matrix. So will this do it? rmat <- matrix(runif(1000), 500,2) rmat2 <- matrix(runif(1000), 500,2) rindex <- sample(1:500, replace=TRUE) #with repetition velocity<-0.4 * velocity +

Re: [R] change codes into loops

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 7:58 PM, David Winsemius wrote: On Jan 18, 2010, at 7:19 PM, rusers.sh wrote: Hi, See example. for (i in 1:2) { for (j in 1:3) { b_1[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[1] b_2[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[2] b_3[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))

[R] Help on using WinBUGS on Mac

2010-01-18 Thread Wayne (Yanwei) Zhang
Dear all, I had trouble in setting up WinBUGS on my Mac, and I'm seeking for some help here. I followed the instruction by Tom Palmer here: http://www.ruudwetzels.com/MacBUGS/winbugsonmacosx.pdf I installed Darwine 1.1.21, and downloaded WinBUGS14. However, when I double-clicked the WinBUGS1

Re: [R] change codes into loops

2010-01-18 Thread rusers.sh
If the number of datasets for a* is small (here is 3), it is ok for creating b_ijn[i, j, nn] and make assignments to it. But it will be a little bit impossible for a larger number of datasets for a*, say 999. We may need 999 lines to do this. Maybe there are other alternatives. 2010/1/18 David Win

Re: [R] does any package have the functionality of ace() from old acepack?

2010-01-18 Thread GlenB
I tried to use transace but it tried to call ace from acepack. So I re-downloaded Hmisc to make sure I had the latest version (Warning message: "package 'Hmisc' was built under R version 2.10.1" - I am running 2.10.0, Windows version running under XP). looking at transace, it has this: > if (.

Re: [R] CAMAN R package

2010-01-18 Thread Jim Silverton
Hello everyone, I tried searching for a manual for CAMAN package for mixture models, but was unable to find one. Does anyone have the pdf manual for this package? Jim [[alternative HTML version deleted]] __ R-help@r-project.org mailing list htt

Re: [R] Predict polynomial problem

2010-01-18 Thread Charles C. Berry
On Mon, 18 Jan 2010, Barry Rowlingson wrote: I have a function that fits polynomial models for the orders in n: lmn <- function(d,n){ models=list() for(i in n){ models[[i]]=lm(y~poly(x,i),data=d) } return(models) } My data is: > d=data.frame(x=1:10,y=runif(10)) So first just do it for

Re: [R] Using the output of strsplit

2010-01-18 Thread Henrique Dallazuanna
Try this also: do.call(rbind, spl) On Mon, Jan 18, 2010 at 7:48 PM, James Rome wrote: > I successfully combined my data frames, and am now on my next hurdle. > > I had combined the data and quarter, and used tapply to count the > entries for each unique date/quarter pair. > ar= tapply(ewrgnd$gw,

Re: [R] An argument processing puzzle --- solution.

2010-01-18 Thread Duncan Murdoch
On 18/01/2010 7:51 PM, Rolf Turner wrote: Thanks to Berton Gunter and Peter Ehlers who both effectively solved my problem. Prof. Gunter's solution, slightly more succinct, is: foo <- function(x) { if(is.name(sb <- substitute(x))) deparse(sb) else eval(sb) } (appropriately modified to fi

Re: [R] change codes into loops

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 7:19 PM, rusers.sh wrote: Hi, See example. for (i in 1:2) { for (j in 1:3) { b_1[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[1] b_2[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[2] b_3[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[3] } } The inner codes is really repeated, so

Re: [R] add spline to longitudinal data - preferably similar to SAS's 'I=SM50S' routine

2010-01-18 Thread Eric Fail
Hi Dennis Works like a charm. It's some of the best help I have ever received. Very thankful! Eric On 18/01/2010, at 19.12, Dennis Murphy wrote: > Hi: > > There is a very similar example in the ggplot book by Hadley Wickham > (section 4.5, pp. 50-52). Here's > one approach using ggplot: > >

Re: [R] An argument processing puzzle --- solution.

2010-01-18 Thread Rolf Turner
Thanks to Berton Gunter and Peter Ehlers who both effectively solved my problem. Prof. Gunter's solution, slightly more succinct, is: foo <- function(x) { if(is.name(sb <- substitute(x))) deparse(sb) else eval(sb) } (appropriately modified to fit into the ``mv()'' context. Duncan Murdoch

[R] change codes into loops

2010-01-18 Thread rusers.sh
Hi, See example. for (i in 1:2) { for (j in 1:3) { b_1[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[1] b_2[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[2] b_3[i,j]<-rank(c(a1[i,j],a2[i,j],a3[i,j]))[3] } } The inner codes is really repeated, so i want to change the inner codes into loop

Re: [R] Predict polynomial problem

2010-01-18 Thread Bert Gunter
Barry: I reproduced your error on Windows. However, as you know, in your code below, the first two components of your list are NULL. This is a bit clumsy, so I modified your lmn function by changing it from ... for(i in n) ... to ... for( i in 1:n) ... With that change, there are no errors.

Re: [R] add spline to longitudinal data - preferably similar to SAS's 'I=SM50S' routine

2010-01-18 Thread Dennis Murphy
Hi: There is a very similar example in the ggplot book by Hadley Wickham (section 4.5, pp. 50-52). Here's one approach using ggplot: library(ggplot2) p <- ggplot(tolerance.pp, aes(age, tolerance, group = id)) + geom_line() p + geom_smooth(aes(group = 1), size = 2) The second command adds a smoot

Re: [R] add spline to longitudinal data - preferably similar to SAS's 'I=SM50S' routine

2010-01-18 Thread Dylan Beaudette
On Mon, Jan 18, 2010 at 3:25 PM, Eric Fail wrote: > Hi Ruser > > I'm trying to replicate some SAS code. I have to add a spline to my > longitudinal spaghetti plot. > > I have the plot, but I can't add the spline, a overall trend line. In the > SAS code they use the command   'I=SM50S' and I would

[R] Predict polynomial problem

2010-01-18 Thread Barry Rowlingson
I have a function that fits polynomial models for the orders in n: lmn <- function(d,n){ models=list() for(i in n){ models[[i]]=lm(y~poly(x,i),data=d) } return(models) } My data is: > d=data.frame(x=1:10,y=runif(10)) So first just do it for a cubic: > mmn = lmn(d,3) > predict

[R] add spline to longitudinal data - preferably similar to SAS's 'I=SM50S' routine

2010-01-18 Thread Eric Fail
Hi Ruser I'm trying to replicate some SAS code. I have to add a spline to my longitudinal spaghetti plot. I have the plot, but I can't add the spline, a overall trend line. In the SAS code they use the command 'I=SM50S' and I would prefer something similar. I’m using R 2.10.1 on windows

Re: [R] problem of data manipulation

2010-01-18 Thread Bert Gunter
Subject to finite precision arithmetic, it should work as before (either approach – perhaps with an explicit as.factor() cast first for your numeric columns in my case). HOWEVER, as usual , finite precision arithmetic may now mess up either way of doing it, depending how the numbers in the columns

Re: [R] exporting text output to pdf

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 5:07 PM, Dimitri Shvorob wrote: ... You can modify this (dysfunctional) snippet. pdf() plot.new() mtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque leo ipsum, ultricies scelerisque volutpat non, volutpat et nulla. Curabitur consequat ullamcorper t

Re: [R] An argument processing puzzle.

2010-01-18 Thread Peter Ehlers
Rolf Turner wrote: I have been trying to write a function mv(a,b) to move an object a to object b. It returns no value, but only exists for this side effect. Basically it just does b <- a; rm(a). With some checking and prompting about over-writing. The thing is, I'd like to be able to use ei

Re: [R] exporting text output to pdf

2010-01-18 Thread Greg Snow
Here are some options (none direct, but all would get you there). Create the html document using hwriter (it seems you know how to do that) then convert/print to pdf, openoffice may be able to do the conversion, or you can install cutepdf as a printer and print to that. Use sweave as has been m

Re: [R] problem of data manipulation

2010-01-18 Thread rusers.sh
I just remembered that my actual dataset for var2 and var3 are numerical data,e.g. 12.34, not factors. The above example data is misleading. Suppose var2 and var3 are numerical variables, not factors. How should we do it? Very sorry for the misleading. 2010/1/18 William Dunlap > > -Origi

Re: [R] exporting text output to pdf

2010-01-18 Thread Dimitri Shvorob
... You can modify this (dysfunctional) snippet. pdf() plot.new() mtext("Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque leo ipsum, ultricies scelerisque volutpat non, volutpat et nulla. Curabitur consequat ullamcorper tellus id imperdiet. Duis semper malesuada nulla, blandit lob

Re: [R] exporting text output to pdf

2010-01-18 Thread Dimitri Shvorob
> Error in library(ReadImages) : .First.lib failed for 'ReadImages' David, I was aware of title, main and mtext when I asked the question, and although advice concerning them was certainly sound, it was not news. Yes, one can put text into images - I wish I had not brought up images at all and fo

Re: [R] exporting text output to pdf

2010-01-18 Thread Dimitri Shvorob
> I wish I had not brought up images at all and focused on text In fact, let's do that and forget about images - I just want to put text into a PDF. Let's take, say, five long strings to represent paragraphs, then put them on a single page, one after another, with minimal code. I don't want to fi

Re: [R] An argument processing puzzle.

2010-01-18 Thread Duncan Murdoch
On 18/01/2010 3:22 PM, Rolf Turner wrote: I have been trying to write a function mv(a,b) to move an object a to object b. It returns no value, but only exists for this side effect. Basically it just does b <- a; rm(a). With some checking and prompting about over-writing. The thing is, I'd lik

[R] how to install spatstat

2010-01-18 Thread Senlin Liang
Hi, I tried to install spatstat using: install.packages("spatstat", dependencies = TRUE, lib = "./R/i486-pc-linux-gnu-library/2.8") but got the following msg: --- Please select a CRAN mirror for use in this session --- __ R-help@r-project.org mailing l

Re: [R] Problem extracting from mer objects

2010-01-18 Thread Ben Bolker
Chris Ramsborg yahoo.com> writes: > I am having a problem extracting from "mer" objects.  >   > I have constructed my problem using existing datasets. >   > Using the following commands: >   > require(lme4) > fm1 <- lmer(Yield ~ 1 + (1 | Batch), Dyestuff) > fixef(fm1) > > I get the following er

Re: [R] Using the output of strsplit

2010-01-18 Thread Peter Alspach
Tena koe Jim You could use unlist and matrix. For example: > tempList [[1]] [1] "a" "A" [[2]] [1] "b" "B" [[3]] [1] "c" "C" > unlist(tempList) [1] "a" "A" "b" "B" "c" "C" > matrix(unlist(tempList), nrow=3) [,1] [,2] [1,] "a" "B" [2,] "A" "c" [3,] "b" "C" > matrix(unlist(tempList),

[R] Res: Problem extracting from mer objects

2010-01-18 Thread Ivan Bezerra Allaman
Chris I think your problem is in the model. In his model, it seems that their fixed effects are the averages. Is that so? M.Sc Ivan Bezerra Allaman Zootecnista Doutorando em Produção Animal/Aquicultura - UFLA email e msn - ivanala...@yahoo.com.br Tel: 35/3822-8117; 35/9925-6428

[R] Cannot load RInterpreter (SJava)

2010-01-18 Thread Jiiindo
Hello, I write a test for call R function from Java by Eclipse. When i run it, raise a error: Loading RInterpreter library Exception in thread "main" java.lang.UnsatisfiedLinkError: no RInterpreter in java.library.path at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1709) at

Re: [R] lattice and probem

2010-01-18 Thread robert-mcfadden
Excellent. Thank you very much. Best, Robert Dnia 18 stycznia 2010 18:20 Peter Ehlers napisał(a): > robert-mcfad...@o2.pl wrote: > > I have a simple chart: > >barchart(Counts ~ Purchase | Products , data = my.data, groups = Model) > > where Purchase in data has values {0,1,2,3...10}. In a

[R] Using the output of strsplit

2010-01-18 Thread James Rome
I successfully combined my data frames, and am now on my next hurdle. I had combined the data and quarter, and used tapply to count the entries for each unique date/quarter pair. ar= tapply(ewrgnd$gw, list(ewrgnd$dq), sum) #for each date/quarter combination sums the gw (which are all 1) dq=row.n

[R] RFE: bQuote like sQuote

2010-01-18 Thread Jack Tanner
I'm writing SQL queries, and it's very handy to be able to use sQuote for string parameter values. It makes me wish that I could use an sQuote-like function for enclosing column names and other identifiers in backticks, i.e., select `foo` from `table`. Obviously I can do this with paste(), I'm just

Re: [R] problem of data manipulation

2010-01-18 Thread rusers.sh
Thank you so much. I got it. 2010/1/18 William Dunlap > > -Original Message- > > From: Bert Gunter [mailto:gunter.ber...@gene.com] > > Sent: Monday, January 18, 2010 12:32 PM > > To: William Dunlap; 'rusers.sh'; r-help@r-project.org > > Subject: RE: [R] problem of data manipulation > > >

[R] Problem extracting from mer objects

2010-01-18 Thread Chris Ramsborg
I am having a problem extracting from "mer" objects.    I have constructed my problem using existing datasets.   Using the following commands:   require(lme4) fm1 <- lmer(Yield ~ 1 + (1 | Batch), Dyestuff) fixef(fm1) I get the following error message: "Error in UseMethod("fixef") : no applicable

Re: [R] problem of data manipulation

2010-01-18 Thread William Dunlap
> -Original Message- > From: Bert Gunter [mailto:gunter.ber...@gene.com] > Sent: Monday, January 18, 2010 12:32 PM > To: William Dunlap; 'rusers.sh'; r-help@r-project.org > Subject: RE: [R] problem of data manipulation > > Absolutely... so long as you assume the dates are in order -- > o

Re: [R] problem of data manipulation

2010-01-18 Thread Bert Gunter
Absolutely... so long as you assume the dates are in order -- or at least that the earliest date of a group appears first. -- Bert -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of William Dunlap Sent: Monday, January 18, 2010 12:1

[R] An argument processing puzzle.

2010-01-18 Thread Rolf Turner
I have been trying to write a function mv(a,b) to move an object a to object b. It returns no value, but only exists for this side effect. Basically it just does b <- a; rm(a). With some checking and prompting about over-writing. The thing is, I'd like to be able to use either call by name or

Re: [R] problem of data manipulation

2010-01-18 Thread William Dunlap
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Bert Gunter > Sent: Monday, January 18, 2010 11:54 AM > To: 'rusers.sh'; r-help@r-project.org > Subject: Re: [R] problem of data manipulation > > One way to do it: > > 1. Conver

Re: [R] exporting text output to pdf

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 1:33 PM, Dimitri Shvorob wrote: Let's revisit my fist post How can I get a normal-font-sized 'Hello world' displayed on a page, with a plot underneath, instead of a giant 'Hello world' on one page, and a plot on another? I suggested that you look at the wiki and you

[R] R jobs keep hanging linux server despite mem.limits modifcations

2010-01-18 Thread Nathan Stephens
My group is working with datasets between 100 Mb and 1 GB in size, using multiple log ins. From the documentation, it appears that vsize is limited to 2^30-1, which tends to prove too restrictive for our use. When we drop that restriction (set vsize = NA) we end up hanging the server, which requi

[R] Rotating pca scores

2010-01-18 Thread francesca iordan
Dear Folks I need to rotate PCA loadings and scores using R. I have run a pca using princomp and I have rotated PCA results with varimax. Using varimax R gives me back just rotated PC loadings without rotated PC scores. Does anybody know how I can obtain/calculate rotated PC scores with R? Your

Re: [R] problem of data manipulation

2010-01-18 Thread Bert Gunter
One way to do it: 1. Convert your date column to the Date class using the as.Date() function. This allows you to do the necessary arithmetic on the dates below. dt <- as.Date(a[,4],"%d/%m/%Y") 2. Create a factor out of your first three columns whose levels are in the same order as the unique rows

Re: [R] exporting text output to pdf

2010-01-18 Thread Thomas S. Dye
If you use emacs, then another alternative is Org-babel, which allows you to mix and match languages. Using the literate programming paradigm, Org-babel will tangle your hwriter code snippets and expand references to any R-code that you want to embed within them. I use Org-babel to combine

Re: [R] How to convert character matrix or data.frame to numeric?

2010-01-18 Thread hadley wickham
> Ouch!   Hmmm.   From the "Value" section of the apply docs... "If each call > to FUN returns a vector of length n, then apply returns an array of > dimension c(n, dim(X)[MARGIN]) if n > 1."  Since I set MARGIN to 1, then I > was operating on rows where n  is 3. > >> c(n, dim(X)[MARGIN]) > [1] 3 2

Re: [R] Help using Cast (Text) Version

2010-01-18 Thread hadley wickham
>> If you can point me towards a doc that explains this in simple terms I >> would be obliged. Don't expect you to have to provide the answer. > > Any of the introductory texts should explain the various forms of indexing > and the use of the apply family of functions. They are both central to > ef

Re: [R] output

2010-01-18 Thread Ashta
Hi all, I have a data set such that the response variable size binary (Short or Long) Color has two classes (red and green) red=1 ; green=0 Lm1 <- glm(size ~color, data =test, family = binomial()) Estimate Std. Errorz value (Intercept) 12.0523.11037-12.273 col

Re: [R] advice/opinion on "<-" vs "=" in teaching R

2010-01-18 Thread Thomas Lumley
On Mon, 18 Jan 2010, S Ellison wrote: Thomas Lumley 15/01/2010 16:07 >>> Which should I use or does it matter, please? I would say to use = if you are teaching people familiar with C or Java, and to use <- otherwise. Nothing like an option to induce polarisation! '=' is used in at leas

Re: [R] exporting text output to pdf

2010-01-18 Thread Dimitri Shvorob
Let's revisit my fist post How can I get a normal-font-sized 'Hello world' displayed on a page, with a plot underneath, instead of a giant 'Hello world' on one page, and a plot on another? Then The goal is to produce a proper-looking PDF *document* with text and images - similar to what I coul

[R] Rotating pca scores

2010-01-18 Thread francesca . iordan
Dear Folks I need to rotate PCA loadings and scores using R. I have run a pca using princomp and I have rotated PCA results with varimax. Using varimax R gives me back just rotated PC loadings without rotated PC scores. Does anybody know how I can obtain/calculate rotated PC scores with R?

Re: [R] Can an object reference itself?

2010-01-18 Thread Janko Thyson
Hadley, thanks for your comment. What you're saying is true, of course, and possibly I did not really chose the best header to describe the actual issue I was addressing. However, in the help archive I found something that gets me what I want (calling a certain "slot function" without having to sp

[R] problem of data manipulation

2010-01-18 Thread rusers.sh
Hello, See my problem below. a<-data.frame(c("s","c","c","n","n","n"),c(rep(1,3),rep(2,3)),c(rep(2,3),rep(1,3)),c("01/01/1999","10/02/2000","13/02/2000","11/02/2000","15/02/2000","23/02/2000")) colnames(a)<-c("var1","var2","var3","var4") > a var1 var2 var3 var4 1s1201/01/1

Re: [R] column selection for aggregate()

2010-01-18 Thread Gabor Grothendieck
It looks ok except you have both specified the wanted factors and removed the undesired factors from the data frame. You only need to do one of these as in the example I gave, not both, so the solution could be simpler. On Mon, Jan 18, 2010 at 11:19 AM, Ivan Calandra wrote: > Hi! > > It looks li

Re: [R] exporting text output to pdf

2010-01-18 Thread Ista Zahn
You may as well go all the way and use Sweave. See http://www.stat.umn.edu/~charlie/Sweave/ for examples. -Ista On Mon, Jan 18, 2010 at 4:41 PM, Dimitri Shvorob wrote: > > Nothing relevant, as far as I can tell :( > Putting text into a PDF document in R appears to be a cumbersome exercise. > --

[R] permutations from vectors out of a matrix

2010-01-18 Thread Etienne Stockhausen
Dear R-Users, I'm relativley new to R and have the following problem. I need all permutations of the vectors created by the collumns of a matrix. I will give a small example: p=3 n=2^p-1 #number of obtainable vect

Re: [R] exporting text output to pdf

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 11:41 AM, Dimitri Shvorob wrote: Nothing relevant, as far as I can tell :( Putting text into a PDF document in R appears to be a cumbersome exercise. You might get more specific ideas if your were in turn more specific. Offer an example that sends output to a scr

[R] high precision numbers

2010-01-18 Thread kayj
Hi All, I need to sum a large number of extremely small numbers. These small number are a result of an expression that I wrote using R but the sum of these numbers is incorrect because the numbers perhaps get truncated. How van I make sure that R us summing the numbers without rounding or trunca

Re: [R] exporting text output to pdf

2010-01-18 Thread Dimitri Shvorob
Nothing relevant, as far as I can tell :( Putting text into a PDF document in R appears to be a cumbersome exercise. -- View this message in context: http://n4.nabble.com/exporting-text-output-to-pdf-tp837699p1016808.html Sent from the R help mailing list archive at Nabble.com. __

[R] get the ranks for arrays

2010-01-18 Thread rusers.sh
Hello, 'rank' function seems to be only for vectors, but i need to get the ranks for 3-dimensional arrays. See problems below. #Example Data a1<-array(1:12,c(2,3,2)); a2<-array(2,c(2,3,2)); a3<-array(0,c(2,3,2)) > a1 , , 1 [,1] [,2] [,3] [1,]135 [2,]246 , ,

Re: [R] lattice and probem

2010-01-18 Thread Peter Ehlers
Slight correction below. (Mother always said I needed to learn to count.) Peter Ehlers wrote: robert-mcfad...@o2.pl wrote: I have a simple chart: barchart(Counts ~ Purchase | Products , data = my.data, groups = Model) where Purchase in data has values {0,1,2,3...10}. In a chart xlab begins

Re: [R] lattice and probem

2010-01-18 Thread Peter Ehlers
robert-mcfad...@o2.pl wrote: I have a simple chart: barchart(Counts ~ Purchase | Products , data = my.data, groups = Model) where Purchase in data has values {0,1,2,3...10}. In a chart xlab begins with 1 not 0. How to change it? I guess that barchart() will coerce Purchase to be a factor wi

Re: [R] Choose every second value

2010-01-18 Thread Greg Snow
In addition to the other suggestions, you can use logical subsetting with autoreplication: > x <- 1:6 > x[ c(T,F) ] [1] 1 3 5 > x[ c(F,T) ] [1] 2 4 6 -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message

[R] lattice and probem

2010-01-18 Thread robert-mcfadden
I have a simple chart: barchart(Counts ~ Purchase | Products , data = my.data, groups = Model) where Purchase in data has values {0,1,2,3...10}. In a chart xlab begins with 1 not 0. How to change it? Best, Robert __ R-help@r-project.org mailing li

Re: [R] output

2010-01-18 Thread Adaikalavan Ramasamy
Season X is taken as the reference category. So the output "factor(season)y 10.59739" means the feed_intake is higher by 10.59 units in Season Y _compared to_ Season X. Change your levels in season. E.g. season <- factor(season, levels=c("Z", "X", "Y") which means that Z will be taken as th

Re: [R] column selection for aggregate()

2010-01-18 Thread Ivan Calandra
Hi! It looks like it works perfectly. However, since I cannot check whether I get the good result or not, can you please let me know if you see any mistakes? Here is the code: ssfamean <- summaryBy(.~SPECSHOR+BONE+TO_POS+FACETTE+SHEARFAC+ENA_BA, data = subset(ssfa, select = - c(MEASUREM, SEL_FA

Re: [R] output

2010-01-18 Thread Henrique Dallazuanna
Try this: DF$season <- relevel(DF$season, 'y') fit1 <- lm(Feed_Intake ~ weight + season + weight*season, data = DF) On Mon, Jan 18, 2010 at 2:00 PM, Ashta wrote: > Hi all, > I am trying to interparete  the result of the following output from  lm; > > > fit1 =lm(Feed _Intake ~ weight + season + w

Re: [R] column selection for aggregate()

2010-01-18 Thread Gabor Grothendieck
Try summaryBy in the doBy package. e.g. using the built-in CO2 summarize each numeric variable by each factor except for the factors Plant and Type: library(doBy) summaryBy(. ~ ., data = subset(CO2, select = - c(Plant, Type))) On Mon, Jan 18, 2010 at 9:53 AM, Ivan Calandra wrote: > Hi everybody

Re: [R] exporting text output to pdf

2010-01-18 Thread David Winsemius
Perhaps you should look at what Murrell offers: http://www.jstatsoft.org/v30/i04 Or at worked examples in the Wiki: http://wiki.r-project.org/rwiki/doku.php?id=tips:graphics-misc:display-images On Jan 18, 2010, at 10:21 AM, Dimitri Shvorob wrote: Ah, mine was not a helpful example. Text at

Re: [R] column selection for aggregate()

2010-01-18 Thread b k
On Mon, Jan 18, 2010 at 10:33 AM, Ivan Calandra < ivan.calan...@uni-hamburg.de> wrote: > I didn't understand from the help what really does the function rowMeans > but it looks like it doesn't take into account the categorical variables (I > want to calculate the means when the values of all categ

[R] output

2010-01-18 Thread Ashta
Hi all, I am trying to interparete the result of the following output from lm; fit1 =lm(Feed _Intake ~ weight + season + weight*season) Season has three classes(x,y,z) Reults are Estimate (Intercept) 21.51559 weight 2.13051 factor(season)y

Re: [R] Help using Cast (Text) Version

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 10:26 AM, Steve Sidney wrote: David Excellent ! It its exactly what I was looking for. Two very small questions to conclude 1) I don't understand the significance of the -1 in the sq brackets. It removes the first column from the object that is offered to apply().

Re: [R] function to set log(0)=0 not working on tables or vectors

2010-01-18 Thread maiya
Peter, you're right about the error - I had R commander open and used the terminal instead - this makes me miss the error messages. Not that I would have known how to solve it had I seen it :) And yes, ifelse does work. Not sure I understand what the difference is, but thanks! David, I had no id

Re: [R] exporting text output to pdf

2010-01-18 Thread Dimitri Shvorob
Ah, mine was not a helpful example. Text atop a picture is a special scenario, handled by title(); the goal is to produce a proper-looking PDF *document* with text and images - similar to what I could do in HTML with hwriter package. -- View this message in context: http://n4.nabble.com/export

Re: [R] variable name substitution

2010-01-18 Thread Ivan Calandra
Wonderful!! Thanks a lot! Ivan Duncan Murdoch a écrit : > On 18/01/2010 9:02 AM, Ivan Calandra wrote: >> Hi everybody! >> >> I'm trying to write a script to plot a histogram, a boxplot and a >> qq-plot (under Windows XP, R2.10 if it matters) >> >> What I want to do: define the variables (x and y)

Re: [R] Exporting a data.frame to excel using sqlSave - adds a character ' to values

2010-01-18 Thread Tal Galili
Thanks Dieter, Reading it back is fine, but still - I wish I could control this behavior. Tal Contact Details:--- Contact me: tal.gal...@gmail.com | 972-52-7275845 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.

Re: [R] column selection for aggregate()

2010-01-18 Thread Ivan Calandra
I didn't understand from the help what really does the function rowMeans but it looks like it doesn't take into account the categorical variables (I want to calculate the means when the values of all categorical variables are the same, second part of aggregate). Moreover, ssfa_num contains only

Re: [R] Help using Cast (Text) Version

2010-01-18 Thread Steve Sidney
David Excellent ! It its exactly what I was looking for. Two very small questions to conclude 1) I don't understand the significance of the -1 in the sq brackets. 2) Not sure I really understand how function(x)works in this context. If you can point me towards a doc that explains this in si

Re: [R] variable name substitution

2010-01-18 Thread Duncan Murdoch
On 18/01/2010 9:02 AM, Ivan Calandra wrote: Hi everybody! I'm trying to write a script to plot a histogram, a boxplot and a qq-plot (under Windows XP, R2.10 if it matters) What I want to do: define the variables (x and y) to be used at the very beginning, so that I don't have to change all o

Re: [R] column selection for aggregate()

2010-01-18 Thread b k
On Mon, Jan 18, 2010 at 10:17 AM, Ivan Calandra < ivan.calan...@uni-hamburg.de> wrote: > Thanks for your answer, but it doesn't work... > > Here is what I get: > > ssfamean <- aggregate(ssfa[[10:24]],ssfa[c("SPECSHOR", "BONE", "TO_POS", > "FACETTE", "SHEARFAC", "ENA_BA")],mean) > Error in .subset2

Re: [R] unique: factor to string

2010-01-18 Thread David Winsemius
On Jan 18, 2010, at 10:05 AM, Markus Mühlbacher wrote: Hi community, I want to count the occurrence of values within a dataframe. data$names is a list of many names. It's most likely a vector. With namelist <- unique(data$names) I get all the existing names. But the result is a factor, no

Re: [R] column selection for aggregate()

2010-01-18 Thread Ivan Calandra
Thanks for your answer, but it doesn't work... Here is what I get: > ssfamean <- aggregate(ssfa[[10:24]],ssfa[c("SPECSHOR", "BONE", "TO_POS", "FACETTE", "SHEARFAC", "ENA_BA")],mean) Error in .subset2(x, i, exact = exact) : recursive indexing failed at level 2 I think I've tried everything tha

  1   2   >