[R] coding negative effects in categorical dummy variables

2009-12-01 Thread andre74
Hello, I have a problem with categorical variables and dummy encoding. I've a factor and for each pair (i,j) with i != j, I'd like to fit res ~ a*x[i] - b*x[j]. A brief example with 3 variables: a - b = 2 b - c = -1 c - a = 0 Thus I fitted the following model: fit <- lm(result ~ X + Y) whe

[R] Normal tests disagree?

2009-12-01 Thread rkevinburton
If I have data that I feed into shapio.test and jarque.bera.test yet they seem to disagree. What do I use for a decision? For my data set I have p.value of 0.05496421 returned from the shapiro.test and 0.882027 returned from the jarque.bera.test. I have included the data set below. Thank you.

[R] Aligning Diagonally Oriented Labels Under Bar Chart

2009-12-01 Thread Jason Rupert
I searched the forms (i.e., R Search) and come up with the following suggested link:  http://cran.r-project.org/doc/FAQ/R-FAQ.html#How-can-I-create-rotated-axis-labels_003f I tried to implement what I believe was being implied by that URL and came up with the below: barplot(WorldPhones[1,],   

[R] Normal tests disagree?

2009-12-01 Thread rkevinburton
If I have data that I feed into shapio.test and jarque.bera.test yet they seem to disagree. What do I use for a decision? For my data set I have p.value of 0.05496421 returned from the shapiro.test and 0.882027 returned from the jarque.bera.test. I have included the data set below. Thank you.

[R] draw a box at 10% lower and upper in scatter plot

2009-12-01 Thread Roslina Zakaria
Hi,   I would like to draw a box at each corner of lower 10% and upper 10% in the scatter plot on(0,1)*(0,1)  to indicate the lower and upper tail.  I hope somebody can help me.   Here is my code: ## scatter plot plot(hume_uni[,2],beec_uni[,2], pch=19, xlab="Hume_uni", ylab="Beec_uni", col= "bl

Re: [R] Aligning Diagonally Oriented Labels Under Bar Chart

2009-12-01 Thread Peter Alspach
Tena koe Jason Is this an example of what you want? temp <- barplot(3:17) text(temp, rep(-0.5, length(3:17)), LETTERS[3:17], srt=45, adj=1) HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Jason Rupe

[R] Error when running Conditional Logit Model

2009-12-01 Thread Hien Nguyen
Dear R-helpers, I am very new to R and trying to run the conditional logit model using "clogit " command. I have more than 4000 observations in my dataset and try to predict the dependent variable from 14 independent variables. My command is as follows clmtest1 <- clogit(Pin~Income+Bus+Pop+U

[R] Reformat x axis

2009-12-01 Thread d haywood
Hi I am trying to do a simple XY plot with a dataset that has dates stored as integers . I would like to have the X values displayed as dates. I realize I could do this by converting the x values to dates first, However, does R have the ability like SAS FORMAT, for example, of reformatting the

Re: [R] Distance between sets of points in transformed environmental space

2009-12-01 Thread Charlotte Maia
Hi Corrado, I was thinking about this some more. Maybe you could use a linear discriminate, i.e. a (hyper)plane that partitions your points into two sets, such that the misclassification rate is minimised. Closeness could be regarded as the number of misclassified points. Two sets would be dista

[R] Container/Collection Object to keep data structures and object

2009-12-01 Thread Amir Liu
I want to have a collection object that can store objects. In R I only saw lists. But these only seem to be able to handle basic objects like numbers and strings. Whenever I tried to add more complicated objects or just very simple data structures like matrices I would get an error like: "n

Re: [R] Partial correlations and p-values

2009-12-01 Thread dadrivr
I am trying to calculate a partial correlation and p-values. Unfortunately, the results in R are different than what SPSS gives. Here is an example in R (calculating the partial correlation of x and y, controlling for z1 and z2): x <- c(1,20,14,30,9,4,8) y <- c(5,6,7,9,NA,10,6) z1 <- c(13,8,16,

Re: [R] Container/Collection Object to keep data structures and object

2009-12-01 Thread Sharpie
Amir Liu wrote: > > I want to have a collection object that can store objects. In R I only saw > lists. But these only seem to be able to handle basic objects like numbers > and strings. Whenever I tried to add more complicated objects or just very > simple data structures like matrices I would

Re: [R] Reformat x axis

2009-12-01 Thread Peter Alspach
Tena koe M Haywood I haven't a clue about SAS FORMAT, but R does have the ability to specify the axis ticks, labels and titles in pretty much any way you might require. See ?axis and also ?text HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto

[R] ''system(cmd) : make not found'' error during package install

2009-12-01 Thread Matthew Anaka
Hello, I've been using various packages in R for a few years now to analyse genomics data but I've just come up with some errors for which I can’t seem to find a solution. Here’s the situation: > source("http://harlequin.jax.org/rmodel/packages/downloadRmodel.R";) > getRmodelHuman() also

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Peng Yu
On Tue, Dec 1, 2009 at 1:40 AM, Karl Ove Hufthammer wrote: > On Tue, 1 Dec 2009 14:48:04 +1100 Remko Duursma > wrote: >> any(duplicated(c(1,2,2))) > > or > anyDuplicated(c(1,2,2)) > which is slightly more efficient. I don't find anyDuplicated(). Which package is it from? ___

Re: [R] draw a box at 10% lower and upper in scatter plot

2009-12-01 Thread Peter Alspach
Tena koe Roslina Check: ?rect ?quantile Perhaps those two functions will give you what you want. HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Roslina Zakaria > Sent: Wednesday, 2 December 2009 12

Re: [R] Normal tests disagree?

2009-12-01 Thread milton ruser
Hi there, Could you provide a minimum reproducible code, please. Bests milton On Tue, Dec 1, 2009 at 6:11 PM, wrote: > If I have data that I feed into shapio.test and jarque.bera.test yet they > seem to disagree. What do I use for a decision? > > For my data set I have p.value of 0.05496421 re

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Jorge Ivan Velez
Try this: R> apropos('any') R> ?anyDuplicated HTH, Jorge On Tue, Dec 1, 2009 at 8:32 PM, Peng Yu wrote: > On Tue, Dec 1, 2009 at 1:40 AM, Karl Ove Hufthammer > wrote: > > On Tue, 1 Dec 2009 14:48:04 +1100 Remko Duursma > > wrote: > >> any(duplicated(c(1,2,2))) > > > > or > > anyDuplicated(c

[R] Passing additional argument to be numerically integrated function

2009-12-01 Thread Amir Liu
Hi, I try to use the numerical integration functionality of R to integrate a univariate (1D) function. Below I am integrating function const1 which works nicely as expected. But for some reasons I need to pass to my function that I want to integrate an additional parameter. If it were object-

Re: [R] ''system(cmd) : make not found'' error during package install

2009-12-01 Thread Duncan Murdoch
Matthew Anaka wrote: Hello, I've been using various packages in R for a few years now to analyse genomics data but I've just come up with some errors for which I canÂ’t seem to find a solution. HereÂ’s the situation: source("http://harlequin.jax.org/rmodel/packages/downloadRmodel.R";)

Re: [R] Container/Collection Object to keep data structures and object

2009-12-01 Thread Amir Liu
Here is an example of how I attempt to add elements to a given list denoted as l: > l <- list() > l list() > l[1] <- 5 > l [[1]] [1] 5 > l[2] <- "cd" > l [[1]] [1] 5 [[2]] [1] "cd" > l[3] <- matrix(1:4,2,2) Warning message: In l[3] <- matrix(1:4, 2, 2) :   number of items to replace is not

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Peng Yu
On Tue, Dec 1, 2009 at 7:46 PM, Jorge Ivan Velez wrote: > Try this: > R> apropos('any') > R> ?anyDuplicated > HTH, > Jorge > > On Tue, Dec 1, 2009 at 8:32 PM, Peng Yu wrote: >> >> On Tue, Dec 1, 2009 at 1:40 AM, Karl Ove Hufthammer >> wrote: >> > On Tue, 1 Dec 2009 14:48:04 +1100 Remko Duursma

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Jorge Ivan Velez
I guess it depends on which version of R you are using. My sessionInfo() follows. What's yours? R> sessionInfo() R version 2.10.0 Patched (2009-10-26 r50212) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252 [3] LC_MONETARY=English_United State

Re: [R] Container/Collection Object to keep data structures and object

2009-12-01 Thread Sharpie
Amir Liu wrote: > > In l[3] <- matrix(1:4, 2, 2) : >   number of items to replace is not a multiple of replacement length > When inserting single entries into a list list, you should use the '[[ ]]' notation. Use '[ ]' when you want to extract multiple entries or copy multiple entries from on

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Peng Yu
On Tue, Dec 1, 2009 at 8:04 PM, Jorge Ivan Velez wrote: > > I guess it depends on which version of R you are using. My sessionInfo() > follows. What's yours? > R> sessionInfo() > R version 2.10.0 Patched (2009-10-26 r50212) > i386-pc-mingw32 > locale: > [1] LC_COLLATE=English_United States.1252  L

Re: [R] Container/Collection Object to keep data structures and object

2009-12-01 Thread Rolf Turner
On 2/12/2009, at 3:08 PM, Sharpie wrote: Amir Liu wrote: In l[3] <- matrix(1:4, 2, 2) : number of items to replace is not a multiple of replacement length When inserting single entries into a list list, you should use the '[[ ]]' notation. Use '[ ]' when you want to extract multipl

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Rolf Turner
On 2/12/2009, at 3:09 PM, Peng Yu wrote: Here is my sessionInfo(). [Snotty comment deleted.] sessionInfo() R version 2.7.1 (2008-06-23) If you're going to use a version which is that antiquated then you can expect a great many things not to wor

[R] Is R-2.10.0 released already

2009-12-01 Thread Hiroto Miyoshi
Dear R users, and Dr. Delagard I got an R-announce message which tells that R-2.10.0 will be released on December 4, 2009. Houever, it seems the R of that version was already released. At leased I made sure that the R of that version was in Cran and Univ. of Tsukuba, and also Univ. of Toronto.

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Peng Yu
On Tue, Dec 1, 2009 at 8:24 PM, Rolf Turner wrote: > > On 2/12/2009, at 3:09 PM, Peng Yu wrote: > >         > >> Here is my sessionInfo(). > >        [Snotty comment deleted.] > >>> sessionInfo() >> >> R version 2.7.1 (2008-06-23) > >         > >        If you're going to use a version which is th

[R] Replying to Posts Within Same Thread

2009-12-01 Thread Charlotte Maia
Hi, When I reply to a post, it generally appears as a separate thread, rather than branching off the original post. Anyone know what I'm doing wrong? Noting I am currently receiving a couple of the lists in digest form. kind regards -- Charlotte Maia http://sites.google.com/site/maiagx/home

Re: [R] Is R-2.10.0 released already

2009-12-01 Thread Charlie Sharpsteen
On Tue, Dec 1, 2009 at 6:19 PM, Hiroto Miyoshi wrote: > > Dear R users, and Dr. Delagard > > I got an R-announce message which tells that > R-2.10.0 will be released on December 4, 2009. According to the message I received it was the first patch release, 2.10.1, that was announced not 2.10.0. -C

Re: [R] Is R-2.10.0 released already

2009-12-01 Thread Wincent
Hi, R-2.10.0 was released and R-2.10.1 is to be released soon. I don't think there is any problem with cran. Best 2009/12/2 Hiroto Miyoshi : > > Dear R users, and Dr. Delagard > > I got an R-announce message which tells that > R-2.10.0 will be released on December 4, 2009. > > Houever, it seems t

Re: [R] Replying to Posts Within Same Thread

2009-12-01 Thread John Sorkin
I don't know what you are doing wrong because I don't know exactly what you are doing. I do know that I don't have your problem when I simply reply to a message without touching the subject line. John -Original Message- From: Charlotte Maia To: Sent: 12/1/2009 9:48:06 PM Subject: [R]

Re: [R] Is there a function to test if all the elements in a vector are unique

2009-12-01 Thread Rolf Turner
On 2/12/2009, at 3:48 PM, Peng Yu wrote: On Tue, Dec 1, 2009 at 8:24 PM, Rolf Turner wrote: On 2/12/2009, at 3:09 PM, Peng Yu wrote: Here is my sessionInfo(). [Snotty comment deleted.] sessionInfo() R version 2.7.1 (2008-06-23) If you're going to us

[R] sort a data frame by a vector

2009-12-01 Thread Hao Cen
Hi, I have a a vector and a data frame with two columns vec = c("C", "A", "B") dataDF = data.frame(A1 = c("B", "A", "C"), A2 = c(1,2,3)) I would like to sort the data frame by column A1 such that the order of elements in A1 is as the same as in vec. After the ordering, the data frame

Re: [R] Replying to Posts Within Same Thread

2009-12-01 Thread Charlotte Maia
On 12/2/09, John Sorkin wrote: > I don't know what you are doing wrong because I don't know exactly what you > are doing. I do know that I don't have your problem when I simply reply to a > message without touching the subject line. > John Could you clarify the notion of "simply reply". There i

Re: [R] Normal tests disagree?

2009-12-01 Thread Ben Bolker
milton ruser gmail.com> writes: > > Hi there, > > Could you provide a minimum reproducible code, please. > Bests > > milton > > On Tue, Dec 1, 2009 at 6:11 PM, charter.net> wrote: > > > If I have data that I feed into shapio.test and jarque.bera.test yet they > > seem to disagree. What do I

Re: [R] sort a data frame by a vector

2009-12-01 Thread jim holtman
Is this what you want: > dataDF = data.frame(A1 = c("B", "A", "C"), A2 = c(1,2,3)) > dataDF A1 A2 1 B 1 2 A 2 3 C 3 > dataDF[order(dataDF$A1),] A1 A2 2 A 2 1 B 1 3 C 3 > If you want the sequence "CAB" then you will have to change the factors in column 1: > dataDF$A1 <- factor(dat

Re: [R] sort a data frame by a vector

2009-12-01 Thread milton ruser
not ellegant.. but... vecDF = data.frame(A1=c("C", "A", "B")) vecDF$A1.order=1:dim(vecDF) vecDF dataDF = data.frame(A1 = c("B", "A", "C"), A2 = c(1,2,3)) dataDF2<-merge(vecDF, dataDF, by=intersect(colnames(vecDF),colnames(dataDF))) dataDF2 dataDF2.ord<-dataDF2[order(dataDF2$A1.order),] dataDF2.ord

[R] How to remove R banner?

2009-12-01 Thread Peng Yu
I always see a banner like the following, which is annoying. I'm wondering how to disable it. R version 2.7.1 (2008-06-23) Copyright (C) 2008 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it

Re: [R] sort a data frame by a vector

2009-12-01 Thread jim holtman
The factor statement should have been: (missed the 'vec' on the first reading) dataDF$A1 <- factor(dataDF$A1, levels=vec) On Tue, Dec 1, 2009 at 10:57 PM, jim holtman wrote: > Is this what you want: > >> dataDF = data.frame(A1 = c("B", "A", "C"), A2 = c(1,2,3)) >> dataDF >  A1 A2 > 1  B  1 > 2

Re: [R] Replying to Posts Within Same Thread

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 10:42 PM, Charlotte Maia wrote: On 12/2/09, John Sorkin wrote: I don't know what you are doing wrong because I don't know exactly what you are doing. I do know that I don't have your problem when I simply reply to a message without touching the subject line. John Coul

Re: [R] sort a data frame by a vector

2009-12-01 Thread David Winsemius
On Dec 1, 2009, at 10:59 PM, jim holtman wrote: The factor statement should have been: (missed the 'vec' on the first reading) dataDF$A1 <- factor(dataDF$A1, levels=vec) It's not necessary to alter the data.frame. You can use the results of the construction above as the row index and st

Re: [R] How to remove R banner?

2009-12-01 Thread Ben Bolker
Peng Yu gmail.com> writes: > I always see a banner like the following, which is annoying. I'm > wondering how to disable it. R --quiet (it took about 8 seconds to find this with R --help) __ R-help@r-project.org mailing list https://stat.ethz.ch/mail

Re: [R] How to remove R banner?

2009-12-01 Thread Sharpie
Peng Yu wrote: > > I always see a banner like the following, which is annoying. I'm > wondering how to disable it. > > R version 2.7.1 (2008-06-23) > Copyright (C) 2008 The R Foundation for Statistical Computing > ISBN 3-900051-07-0 > > R is free software and comes with ABSOLUTELY NO WARRANTY.

[R] Re How to remove R banner?

2009-12-01 Thread Charlotte Maia
Hi, Annoying I love it (except possibly when re-directing standard out to a file). I think it's one of the command line options (in which case, it will be clearly documented). No idea how it works on the GUI systems (maybe an option somewhere...). In saying that, I have to assume that if peo

[R] A ggplot question

2009-12-01 Thread Megh
Let consider following plot : p <- ggplot(mtcars, aes(mpg, wt)) p + geom_point(colour="grey50", size = 4) + geom_point(aes(colour = cyl)) Now I want R to hide the color-pallet on "cyl", placed in the right edge completely. Can anyone please guide me how to do that? Thanks, -- View this me

[R] How to export a function from a package and access it only by specifying the namespace?

2009-12-01 Thread Peng Yu
I have the following test package. $ ls DESCRIPTION man NAMESPACE R $ cat DESCRIPTION Package: try.package Type: Package Title: What the package does (short line) Version: 1.0 Date: 2009-10-26 Author: Who wrote it Maintainer: Who to complain to Description: More about what it does (maybe more

Re: [R] A ggplot question

2009-12-01 Thread Ista Zahn
There was a recent discussion of the ggplot2 mailing list about a similar issue. The first question is how will people know what the colors mean if you remove the legend? -Ish On Tue, Dec 1, 2009 at 11:41 PM, Megh wrote: > > Let consider following plot : > > p <- ggplot(mtcars, aes(mpg, wt)) >  

Re: [R] How to export a function from a package and access it only by specifying the namespace?

2009-12-01 Thread Sharpie
Peng Yu wrote: > > Then I try the package 'try.package' in an R session. I'm wondering > why neither 'my_test_f' and 'try.package::my_test_f' work. > The error message you got below clearly explains this-- you did not export my_test_f in your NAMESPACE file. To access unexported functions, y

Re: [R] sort a data frame by a vector

2009-12-01 Thread Don MacQueen
This looks like a job for match(). vec = c("C", "A", "B") dataDF = data.frame(A1 = c("B", "A", "C"), A2 = c(1,2,3)) dataDF[match(dataDF$A1,vec),] A1 A2 3 C 3 2 A 2 1 B 1 -Don At 10:36 PM -0500 12/1/09, Hao Cen wrote: Hi, I have a a vector and a data frame with two columns

Re: [R] How do I run to or more R consoles on Mac OS X?

2009-12-01 Thread Don MacQueen
If myscript.r has as its first line: #! /usr/bin/Rscript and you make it executable chmod +x myscript.r Then you can run it by giving the command ./myscript.r -Don At 3:03 PM -0800 11/30/09, chronos.phenomena wrote: Thanks... that worked is there a way to run r script? for example

Re: [R] Translation from R codes to SAS.

2009-12-01 Thread xlr82sas
ychu066 wrote: > > my teachers doesnt understand R and I don't know how to use SAS. > Anyone interested in translating my codes to test whether your SAS codes > are as good as R??? > I can test it on SAS codes once you have translated it > > > > regards:working: > It is quite easy

Re: [R] explanation for left-side behaviour

2009-12-01 Thread Don MacQueen
Read the help page for substr(). It says that the first argument should be a character vector. The only one that works is the one where you gave it a character vector. You said only third one "works". But you didn't explain what you mean by "works". It's always a good idea on r-help to show both

Re: [R] A ggplot question

2009-12-01 Thread Megh
Thanks Ista for your mail. Here I wanted to have control on color-pallet. It is because, here my entire plot window is subdivided in 3 sub-plots horizontally, on basis if a factor-variable which contains three factors, using facet_grid(). Each sub-plot contains scatter-plot. I want to color the p

Re: [R] Multiple grouping on the X axis.

2009-12-01 Thread Jim Lemon
On 12/02/2009 05:07 AM, Munin wrote: I am trying to plot data with multiple logical and physical groups using R. Below is a sample of the kind of data I am working with and the desired output. We have a jmp script that can do the same thing, but at ~$200 a year the licensing is counterprodu

Re: [R] How do I run to or more R consoles on Mac OS X?

2009-12-01 Thread chronos.phenomena
Thanks Don Sent from my iPhone On 2 Dec 2009, at 06:16, "Don MacQueen [via R]" wrote: > If myscript.r has as its first line: > >#! /usr/bin/Rscript > > and you make it executable > chmod +x myscript.r > > Then you can run it by giving the command > >./myscript.r > > > -Don > > At

[R] lattice: adding information on number of observations

2009-12-01 Thread RINNER Heinrich
Dear R-users, I am using R version 2.9.1 and lattice 0.17-26 under windows. In a lattice boxplot, I would like to add information on how many observations each singel boxplot is based upon. For example (the basic plot): # Begin R-code library(lattice) dat <- data.frame(panvar = rep(c("A","B","A"

<    1   2