[R] Binning

2009-03-29 Thread Santosh
Dear useRs... How do you all do binning of an independent variable using R? For example, observations of a dependent variable at times different from a nominal time. Are there any R functions that help with binning? Thanks much in advance! Santosh [[alternative HTML version deleted]]

[R] Warning messages in Splancs package :: no non-missing arguments to min; returning Inf

2009-03-29 Thread D
Hi, I would need some help with the splans package in R. I am using a Shapefile (downloadable at) http://rapidshare.com/files/215206891/Redlands_Crime.zip and the following execution code setwd("C:\\Documents and Settings\\Dejan\\Desktop\\GIS\\assignment6\\DataSet_Redlands_Crime\\Redlands_Crim

[R] Problem in S4 object displaying from within a Java application using JRI

2009-03-29 Thread RMP
I am using JRI (Java R Interface) library in order to call R from within my Java application. But since the "rmu1" and "rmu2" ,see the following code, are objects of type S4 once i run the application the value of Null will be returned for both of them. On this regard, i would appreciate it if any

Re: [R] Matrix max by row

2009-03-29 Thread Bill.Venables
It seems to be very system dependent. Here's another take: > m <- matrix(runif(10),1000,100) > junk <- gc() > print(system.time(for(i in 1:100) X1 <- do.call(pmax,data.frame(m user system elapsed 1.530.011.57 > junk <- gc() > print(system.time(for(i in 1:100) X2 <- apply(

Re: [R] which rows are duplicates?

2009-03-29 Thread Bill.Venables
If you sort the data then the duplicated entries will occur in consecutive blocks: > m x y z 1 1 2 3 2 3 4 4 3 1 2 3 > m1 <- m[do.call(order, m), ] > m1 x y z 1 1 2 3 3 1 2 3 2 3 4 4 > duplicated(m1) [1] FALSE TRUE FALSE > When you identify the blocks, the row names will tell you where th

Re: [R] "[.data.frame" and lapply

2009-03-29 Thread Bert Gunter
Folks: I do not wish to agree or disagree with the criticisms of either the speed or possible design flaws of "[". But let's at least see what the docs say about the issues, using the simple example you provided: m = matrix(1:9, 3, 3) md = data.frame(m) md[1] # the first column

[R] which rows are duplicates?

2009-03-29 Thread Aaron M. Swoboda
I would like to know which rows are duplicates of each other, not simply that a row is duplicate of another row. In the following example rows 1 and 3 are duplicates. > x <- c(1,3,1) > y <- c(2,4,2) > z <- c(3,4,3) > data <- data.frame(x,y,z) x y z 1 1 2 3 2 3 4 4 3 1 2 3 I can't figure

Re: [R] Matrix max by row

2009-03-29 Thread Rolf Turner
I tried the following: m <- matrix(runif(10),1000,100) junk <- gc() print(system.time(for(i in 1:100) X1 <- do.call(pmax,data.frame(m junk <- gc() print(system.time(for(i in 1:100) X2 <- apply(m,1,max))) and got user system elapsed 2.704 0.110 2.819 user system elapsed 1

Re: [R] A simple problem

2009-03-29 Thread Bill.Venables
In fact subset(mydata, skill == 1) is all that you need, unless skill is a factor, when subset(mydata, skill == "1") does the trick. More importantly, as a general rule, if you think you need to use '$' in connexion with subset(), transform(), with() or within(), you are most likelyu not re

Re: [R] A simple problem

2009-03-29 Thread Bill.Venables
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of minben Sent: Monday, 30 March 2009 12:28 PM To: r-help@r-project.org Subject: [R] A simple problem > I am a new R user. Welcome. It would be polite to give us your name. > Now I h

Re: [R] A simple problem

2009-03-29 Thread milton ruser
Suggestion of thread: "Selecting rows from dataframe" subset(mydata, mydata$skill==1") may works. Best wishes milton On Sun, Mar 29, 2009 at 10:27 PM, minben wrote: > I am a new R user. Now I have some problem while I use R. I have set > up a data frame called "mydata". One of the colume o

Re: [R] Another question

2009-03-29 Thread milton ruser
How about you starting threads with something that suggest what you are looking for: Like "adding collumns in stata (gen or egen)". On Sun, Mar 29, 2009 at 10:50 PM, minben wrote: > I want to add a colume to a data frame by some rules, in stata the > command is "gen" or "egen" ,but what is it

Re: [R] Matrix max by row

2009-03-29 Thread Bert Gunter
If speed is a consideration,availing yourself of the built-in pmax() function via do.call(pmax,data.frame(yourMatrix)) will be considerably faster for large matrices. If you are puzzled by why this works, it is a useful exercise in R to figure it out. Hint:The man page for ?data.frame says: "

[R] A simple problem

2009-03-29 Thread minben
I am a new R user. Now I have some problem while I use R. I have set up a data frame called "mydata". One of the colume of it was "skill". Now I want to select the observations of the frame whose "skill" value is 1,by what command can I get it? __ R-help

[R] Another question

2009-03-29 Thread minben
I want to add a colume to a data frame by some rules, in stata the command is "gen" or "egen" ,but what is it in R? __ 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.or

Re: [R] Burt table from word frequency list

2009-03-29 Thread Murray Cooper
The usual approach is to count the co-occurence within so many words of each other. Typical is between 5 words before and 5 words after a given word. So for each word in the document, you look for the occurence of all other words within -5 -4 -3 -2 -1 0 1 2 3 4 5 words. Depending on the language

Re: [R] Sorting problem

2009-03-29 Thread Bill.Venables
Here's a clue: > rank(a) [1] 1 3 4 7 2 5 6 > order(order(a)) [1] 1 3 4 7 2 5 6 W. Bill Venables http://www.cmis.csiro.au/bill.venables/ -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Jun Shen Sent: Monday, 30 March 2009 10:1

[R] how to input multiple .txt files

2009-03-29 Thread Qianfeng Li
how to input multiple .txt files? A data folder has lots of .txt files from different customers. Want to read all these .txt files to different master files: such as: cust1.xx.txt, cust1.xxx.txt, cust1..txt,.. to master file: X.txt cust2.xx.txt, cust2.xxx.txt, cust2.

[R] Lattice axis list (when relation = "free")

2009-03-29 Thread In Hee Park
Dear R users: I am having difficulty to place x-axis location alternatively top/bottom side in Lattice plot, which is composed of seven-column as following: E1 E2 E3 E4 E5 E6 E7 Case1 -505.85 -75.32 494.52 -12.31 -98.96 50.34 -48.62 Case2 -50

Re: [R] Lattice question.

2009-03-29 Thread Rolf Turner
Thanks very much for your input. On 30/03/2009, at 12:29 PM, Felix Andrews wrote: Modifying your example... library(lattice) set.seed(42) XX <- data.frame(y=runif(300,0,10),a=factor(sample(letters[1:3],300, TRUE,c(0.5,0.3,0.2 XX <- rbind(XX,XX)

Re: [R] Sorting problem

2009-03-29 Thread Jun Shen
That's leading to another question: How does rank() work? If I have a character vector a<- c("2a", "2c", "3", "5" , "2b" ,"4a", "4b") Then a[order(a)] returns "2a" "2b" "2c" "3" "4a" "4b" "5", which makes sense But a[rank(a)] returns "2a" "3" "5" "4b" "2c" "2b" "4a", which does not seem to m

Re: [R] cmprsk- another survival-depedent package causes R crash

2009-03-29 Thread Frank E Harrell Jr
Nguyen Dinh Nguyen wrote: Dear Prof Gray and everyone, As our package developers discussed about incompatibility between Design and survival packages, I faced another problem with cmprsk- a survival dependent packacge. The problem is exactly similar to what happened to the Design package that

Re: [R] Two variables on one lattice barchart

2009-03-29 Thread jimdare
Don't worry everyone, I've solved it. See the code below: Schart<-barchart(Catch~Year,data=SNA, scales=list(col = "black", tck = c(1, 0),x=list(rot=45)), panel = function(x, ...) { panel.barchart(x, ...) panel.xyplot(x,SN

Re: [R] Lattice question.

2009-03-29 Thread Felix Andrews
Modifying your example... library(lattice) set.seed(42) XX <- data.frame(y=runif(300,0,10),a=factor(sample(letters[1:3],300, TRUE,c(0.5,0.3,0.2 XX <- rbind(XX,XX) XX$gps <- rep(c("count","percent"),each=300) print(histogram(~y|a*gps,as.table=TRUE,dat

[R] Lattice question.

2009-03-29 Thread Rolf Turner
Hi. I am trying to do histograms in lattice, and I want to get both counts and percents in the same plot. To try to be clearer --- there are 3 levels to my factor; I'd like to get a 2 x 3 array of plots where the top row consist of histograms by counts and the bottom consists of (the correspond

Re: [R] Sorting problem

2009-03-29 Thread Stavros Macrakis
On Sun, Mar 29, 2009 at 5:21 PM, Ben Bolker wrote: >  Adding > > xtfrm.numeric <- function(x) {x} > > would seem to add the case that people are looking for -- unless > there's something special that needs to be handled with NAs ??? Yes, that was what I was suggesting. xtfrm currently converts N

[R] unable to compile package

2009-03-29 Thread sten...@go.com
I am trying to install RMySQL on OpenSolaris and need to pass some options to configure. Tried the 3 recommended ways of doing it and nothing works, configure cannot find the headers and the libs. I ran configure manually and that worked fine ./configureCC=ccCFLAGS="-dali

[R] cmprsk- another survival-depedent package causes R crash

2009-03-29 Thread Nguyen Dinh Nguyen
Dear Prof Gray and everyone, As our package developers discussed about incompatibility between Design and survival packages, I faced another problem with cmprsk- a survival dependent packacge. The problem is exactly similar to what happened to the Design package that when I just started runnin

Re: [R] help on plot tick marks

2009-03-29 Thread jim holtman
SOmething like this should do it for you: x <- seq(as.Date('1990-1-1'), as.Date('2030-1-1'), by='1 year') plot(x,runif(length(x))) axis(1, at=as.Date('2008-1-1'), label='2008', las=2) On Sun, Mar 29, 2009 at 5:32 PM, Junjie Zhang wrote: > > Hi there, > > > > I have a yearly data from 1990-2030.

Re: [R] a loop for boxplot graphs

2009-03-29 Thread Coen van Hasselt
Oops, the example only accounts for 1 observation, so better do something like this in that case: .. for (i in unique(dat$id)){ .. On Mon, Mar 30, 2009 at 07:50, Coen van Hasselt wrote: > You could use the paste() function to dynamically assign label values. > For instance, like this: > > dat<-da

Re: [R] a loop for boxplot graphs

2009-03-29 Thread Coen van Hasselt
You could use the paste() function to dynamically assign label values. For instance, like this: dat<-data.frame(id=1:4,x=1:4,y=1:4) par(mfrow=c(2,2)) for (i in dat$id){ boxplot(dat$x[dat$id==i], dat$y[dat$id==i], main=paste("Results for Subject",i) ) } There might be a better

[R] help on plot tick marks

2009-03-29 Thread Junjie Zhang
Hi there, I have a yearly data from 1990-2030. The tick marks only show every five years. I want to add another tick mark at 2008 since data beyond that are predicted. How can I just add one tick mark to the X axis? Thank you. Best, Jacky ___

Re: [R] Sorting problem

2009-03-29 Thread Ben Bolker
Duncan Murdoch-2 wrote: > > On 29/03/2009 2:14 PM, Stavros Macrakis wrote: >> On Sun, Mar 29, 2009 at 6:15 AM, Duncan Murdoch >> wrote: >>> On 28/03/2009 4:57 PM, Stavros Macrakis wrote: On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch wrote: 1) Where does the name 'xtfrm' come

Re: [R] Constrined dependent optimization.

2009-03-29 Thread Ben Bolker
rkevinburton wrote: > > I have an optimization question that I was hoping to get some suggestions > on how best to go about sovling it. I would think there is probably a > package that addresses this problem. > > This is an ordering optimzation problem. Best to describe it with a simple > exam

[R] a loop for boxplot graphs

2009-03-29 Thread James Lenihan
Dear Colleagues   I have the following code that generates a boxplot for one specific labtest:   boxplot.n(LBSTRESN~COHORT, main="Boxplot of laboratory data for XLXXX-XXX test=Creatinine", subset = LBTEST=="Creatinine", xlab = "Cohort Number", ylab = "Units = umol/L", varwidth=TRUE   I would lik

Re: [R] Quantiles for bivariate normal distribution

2009-03-29 Thread li li
Thank you very much for your reply! I know we can find the quantile c that satisfies P(Z1>c, Z2>c)=0.05/6 using R function qmvnorm. But the problem here is to find the quantile c that satisfies the equation P(Z1>1.975, Z2c, Z2>c)=0.05/6. I think it is different from the above problem. I checked t

[R] Constrined dependent optimization.

2009-03-29 Thread rkevinburton
I have an optimization question that I was hoping to get some suggestions on how best to go about sovling it. I would think there is probably a package that addresses this problem. This is an ordering optimzation problem. Best to describe it with a simple example. Say I have 100 "bins" each wit

[R] Two variables on one lattice barchart

2009-03-29 Thread jimdare
Hi, I created the barchart below using the lattice package, however I can't seem to find a way to add another variable as a line (see the desired square/lines that I drew for the last 10 years of the plot). Can anyone help me with this? Your help is much appreciated! Code: Schart<-barchart(Ca

[R] Darker markers for symbols in lattice

2009-03-29 Thread Naomi B. Robbins
In lattice, using the command trellis.par.get for superpose.symbol, plot, symbol and/or dot.symbol shows that we can specify alpha, cex, col, fill (for superpose.symbol and plot.symbol), font, and pch. Trial and error shows that the font affects letters but not pch=1 or pch=3 (open circles and pl

Re: [R] binary AND operators in R

2009-03-29 Thread Duncan Murdoch
mau...@alice.it wrote: I cannot find any R function or operator that performs a binary AND operation, as performed by Fortran built-in function "iand". Ideally either R operator "&" or "&&" should do that. But some tests proved they do not: R doesn't have an operator like iand built in, bu

Re: [R] Quantiles for bivariate normal distribution

2009-03-29 Thread Dimitris Rizopoulos
have a look at packages mnormt and mvtnorm. Best, Dimitris li li wrote: Hi, Does anyone know how to write a R function to solve the quantile c for the following equation. P(Z1>1.975, Z2c, Z2>c)=0.05/6. Z1 and Z2 have a bivariate normal distribution with mean 0, variance 1 and correlation 0.5

Re: [R] binary AND operators in R

2009-03-29 Thread Wacek Kusnierczyk
mau...@alice.it wrote: > I cannot find any R function or operator that performs a binary AND > operation, as performed by Fortran built-in function "iand". > Ideally either R operator "&" or "&&" should do that. But some tests proved > they do not: > they do not, it seems clear from the docum

[R] Quantiles for bivariate normal distribution

2009-03-29 Thread li li
Hi, Does anyone know how to write a R function to solve the quantile c for the following equation. P(Z1>1.975, Z2c, Z2>c)=0.05/6. Z1 and Z2 have a bivariate normal distribution with mean 0, variance 1 and correlation 0.5. Thanks a lot! Hannah [[alternative HTML version deleted]

Re: [R] binary AND operators in R

2009-03-29 Thread Daniel Nordlund
> -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of mau...@alice.it > Sent: Sunday, March 29, 2009 12:23 PM > To: r-help@r-project.org > Subject: [R] binary AND operators in R > > I cannot find any R function or operator that perf

Re: [R] binary AND operators in R

2009-03-29 Thread Domenico Vistocco
You should find the functions: bitAnd, bitOr and bitXor in the bitops package. Ciao, domenico mau...@alice.it wrote: I cannot find any R function or operator that performs a binary AND operation, as performed by Fortran built-in function "iand". Ideally either R operator "&" or "&&" should d

[R] Frailty models and omnibus test

2009-03-29 Thread Johannes Huesing
This is very possibly not a question on R. I was under the impression that the argument that gives rise to Fisher's LSD method in ANOVA works in other situations with three-way comparisons too, given that formal logic works the same ("if the omnibus test rejects, only two of the three groups may b

[R] binary AND operators in R

2009-03-29 Thread mauede
I cannot find any R function or operator that performs a binary AND operation, as performed by Fortran built-in function "iand". Ideally either R operator "&" or "&&" should do that. But some tests proved they do not: > A<- 1 > B <- 2 > A [1] 1 > B [1] 2 > as.numeric(A&B) [1] 1 > as.numeric(A&&B)

[R] finite population correction factor

2009-03-29 Thread vladimir . gazda
Dear R subscribers, I may be too unexperienced and I spent a lot of time looking for the possibilities of hypothesis testing using "finite population correction factor". My question is: "Is there a possibility to perform standard statistical tests using finite population correction factor to avoi

Re: [R] Sorting problem

2009-03-29 Thread Duncan Murdoch
On 29/03/2009 2:14 PM, Stavros Macrakis wrote: On Sun, Mar 29, 2009 at 6:15 AM, Duncan Murdoch wrote: On 28/03/2009 4:57 PM, Stavros Macrakis wrote: On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch wrote: 1) Where does the name 'xtfrm' come from? I don't know. Hmm. If the origins of the na

[R] DCT function?

2009-03-29 Thread Red Roo
Looking for the DCT function, but don't see it in the signal pkg. http://rss.acs.unt.edu/Rdoc/library/signal/html/signal.package.html http://rss.acs.unt.edu/Rdoc/library/signal/html/00Index.html As I understand it, the 'signal' functions are ports of the corresponding matlab/octave code, where t

Re: [R] Post-hoc and planned comparisons for repeated measures

2009-03-29 Thread Kingsford Jones
A couple more thoughts. If you're using nlme::lme to fit the model there is a 'contrasts' argument to lme which can be used to structure the design matrix to produce tests of hypotheses of interest. Also, when you pass an lme object to anova you can use the 'L' argument to specify linear combinat

Re: [R] Sorting problem

2009-03-29 Thread Stavros Macrakis
On Sun, Mar 29, 2009 at 6:15 AM, Duncan Murdoch wrote: > On 28/03/2009 4:57 PM, Stavros Macrakis wrote: >> On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch >> wrote: >> 1) Where does the name 'xtfrm' come from? > I don't know. Hmm. If the origins of the name are lost in the mists of history, per

Re: [R] re form data for aov()?

2009-03-29 Thread Dieter Menne
Dan Kelley gmail.com> writes: > > > I have data in a file named hands.dat, which is given at the end of this > question. (It's from a stats textbook example on anova). I'd like to do an > aov on this, which I guess would be > > d <- read.table("~/hands.dat", header=TRUE) > > aov(Bacterial.C

Re: [R] Post-hoc and planned comparisons for repeated measures

2009-03-29 Thread Kingsford Jones
Hi Dwight, The answer likely depends on how you are fitting the model. Have a look at the multcomp package and its vignettes to see if it can handle the model class you are interested in. hth, Kingsford Jones On Sun, Mar 29, 2009 at 11:11 AM, Krehbiel, Dwight wrote: > Dear colleagues, > > C

Re: [R] re form data for aov()?

2009-03-29 Thread Dan Kelley
As a followup, I show below what I get if I "break out" the variables by making a new data frame with new (boolean) columns that indicate the treatment. (The experiment was germ count on hands, after cleansing with 4 different methods.) What I'm hoping is to find a way to do this in a less "hard

Re: [R] Burt table from word frequency list

2009-03-29 Thread Ted Harding
On 29-Mar-09 16:32:11, Joan-Josep Vallbé wrote: > Ok, thank you. And is there any function to get the table directly > from the original corpus? > > best, > joan-josep vallbé You will have to think about what you are doing. As Duncan said, you need "counts of pairs of words" or, more precisely,

Re: [R] re form data for aov()?

2009-03-29 Thread Kingsford Jones
Hi Dan, You could kill two birds with one stone (i.e. learn about both linear models and R at the same time) by using one of the many R-focused modeling references. Quite a few can be found in the contributed documentation section of CRAN. Here's one: http://cran.r-project.org/doc/contrib/Faraw

[R] re form data for aov()?

2009-03-29 Thread Dan Kelley
I have data in a file named hands.dat, which is given at the end of this question. (It's from a stats textbook example on anova). I'd like to do an aov on this, which I guess would be d <- read.table("~/hands.dat", header=TRUE) aov(Bacterial.Counts ~ Water + Soap + Antibacterial.Soap + Alcohol

Re: [R] constraint optimization: solving large scale general nonlinear problems

2009-03-29 Thread Ravi Varadhan
You don't need to find the fixed points. This is a kind of "profiling" approach. As I had said before, a better approach would be to jointly maximize over x and b: max_{x, b} h(x, b) = f(g(x,b), b). You can use any unconstrained optimization tools (assuming there are no box-constraints on x

Re: [R] Burt table from word frequency list

2009-03-29 Thread Joan-Josep Vallbé
Ok, thank you. And is there any function to get the table directly from the original corpus? best, joan-josep vallbé On Mar 29, 2009, at 2:00 PM, Duncan Murdoch wrote: On 29/03/2009 7:02 AM, Joan-Josep Vallbé wrote: Dear all, I have a word frequency list from a corpus (say, in .csv), wh

[R] Post-hoc and planned comparisons for repeated measures

2009-03-29 Thread Krehbiel, Dwight
Dear colleagues, Can anyone give some clues about how best to conduct post-hoc comparisons or planned comparisons for repeated-measures data in R? The UCLA web site gives wonderful examples for doing repeated-measures analyses of variance, but pairwise or other comparisons are still escaping me

[R] re form data for aov()?

2009-03-29 Thread Dan Kelley
I'm trying to follow along in a text by Velleman and others, with the 'handwashing' example of anova. I used read.table() to read the data, and now I have an object d (put below the dots here), with an entry Method that has possible values "Water", "Soap", etc. What I can't figure out is how to

Re: [R] Data decomposition

2009-03-29 Thread Gabor Grothendieck
Its not clear what it means for the sum of the weeks in a month to equal the month since the weeks don't evenly divide a month but if we apportion them pro rata then here is a possibility. We create the input monthly series z and then produce a series of Date class days d covering the period. Mer

Re: [R] constraint optimization: solving large scale general nonlinear problems

2009-03-29 Thread Florin Maican
Ravi, I solve for the fixed-point x=g(x;b,Y). The variable Y is given - i can omitted here to not introduce confusion. max_{x,b} f(x,b) constrx=g(x;b) Let b1 the initial values for b. Having b1 I can compute the solution x1 of the system x=g(x,b1) - x1 fixed-point. So,

Re: [R] Subscription request

2009-03-29 Thread Ted Harding
On 29-Mar-09 11:48:12, Michael Larsson wrote: > Hello, > I would like to subscribe to the mailing list. I already receive > the daily digest, but for some reason I am not subscribed to the > list, meaning any posts I make by replying to the e-mail digest > have to be placed on the list by a moderat

Re: [R] Find inflection points using smooth.spline

2009-03-29 Thread Ravi Varadhan
Hi, Here is another approach: set.seed(123) x <- sort(runif(200)) y <- sin(3*pi*x) + rnorm(200, sd=0.1) smspl <- smooth.spline(x, y) d2 <- function(x) predict(smspl, x , deriv=2)$y x <- seq(0, 1, length=500) plot(x, d2(x), type="l") abline(h=0, lty=2) uniroot(f=d2, interval=c(0.1, 0.5)) # fir

[R] Washington DC R User Group

2009-03-29 Thread Doran, Harold
I see on occasion posts to this list useR group meetings in various cities. Not sure how these get organized in general, so I'm wondering if a post here regarding a user meeting in Washington DC might start that conversation. Since this isn't related to r-help, I think it is best to keep any subse

Re: [R] Problem with circular::plot.circular()

2009-03-29 Thread Duncan Murdoch
On 29/03/2009 9:58 AM, Duncan Murdoch wrote: On 29/03/2009 9:23 AM, Michael Kubovy wrote: Thanks so much. I have another question: why the difference here: require(circular) c1 <- circular(pi/2 + .0, zero = pi/2, rotation = 'clock') c2 <- circular(pi/2 + .1, zero = pi/2, rotation = 'cl

Re: [R] Problem with circular::plot.circular()

2009-03-29 Thread Michael Kubovy
Thanks so much. I have another question: why the difference here: require(circular) c1 <- circular(pi/2 + .0, zero = pi/2, rotation = 'clock') c2 <- circular(pi/2 + .1, zero = pi/2, rotation = 'clock') opar <- par(mfrow = c(1, 2)) plot(c1, stack = TRUE, bins = 1, main = expression(pi

Re: [R] Problem with circular::plot.circular()

2009-03-29 Thread Duncan Murdoch
On 29/03/2009 9:23 AM, Michael Kubovy wrote: Thanks so much. I have another question: why the difference here: require(circular) c1 <- circular(pi/2 + .0, zero = pi/2, rotation = 'clock') c2 <- circular(pi/2 + .1, zero = pi/2, rotation = 'clock') opar <- par(mfrow = c(1, 2)) plot(c1, st

[R] Data decomposition

2009-03-29 Thread Pele
Hi R users, I have a time series variable that is only available at a monthly level for 1 years that I need to decompose to a weekly time series level - can anyone recommend a R function that I can use to decompose this series? eg. if month1 = 1200 I would to decompose so that the sum of the

Re: [R] problems importing file

2009-03-29 Thread Duncan Murdoch
On 29/03/2009 8:53 AM, Giacomo Prodi wrote: hi ladies and gentlemen of the R community. i'm federico an italian student of statistics and i've got an issue to submit to you: i've got a huge file.txt replenished of blank values (over a milion of them). by importing it into R the read.table() f

Re: [R] Merging rows in dataframes

2009-03-29 Thread Umesh Srinivasan
Hi, Not exactly sure what you mean, but try ? intersect and see if this matches your need. Cheers, Umesh On Sun, Mar 29, 2009 at 6:28 PM, Gabor Grothendieck wrote: > Example 7c has been aded to the home page which illustrates how > to do this using nested selects. > http://sqldf.googlecode.

Re: [R] Merging rows in dataframes

2009-03-29 Thread Gabor Grothendieck
Example 7c has been aded to the home page which illustrates how to do this using nested selects. http://sqldf.googlecode.com 2009/3/29 Schragi Schwartz : > Hi, > Again, thank you for your extremely helpful answer. I'll try my luck a third > time with a similar but different question: assuming I ha

[R] problems importing file

2009-03-29 Thread Giacomo Prodi
hi ladies and gentlemen of the R community. i'm federico an italian student of statistics and i've got an issue to submit to you: i've got a huge file.txt replenished of blank values (over a milion of them). by importing it into R the read.table() function higlights missing objects per row an

[R] Subscription request

2009-03-29 Thread Michael Larsson
Hello, I would like to subscribe to the mailing list. I already receive the daily digest, but for some reason I am not subscribed to the list, meaning any posts I make by replying to the e-mail digest have to be placed on the list by a moderator - incurring significant delay. Thanks, Michael

Re: [R] Calculate directions between points

2009-03-29 Thread Wanja Mathar
Thank you! I managed it with this function - for a data fram with x and y coordinates: anglefun<-function(x,y,unit="degrees") {x.new<-outer(x,x,"-"); y.new<-outer(y,y,"-");angles<-atan2(x.new,y.new);diag(angles)<-NA;if(unit == "degrees") return(180*angles/pi) if (unit == "radians") return(angles

Re: [R] select observations from longitudinal data

2009-03-29 Thread Wacek Kusnierczyk
Peter Dalgaard wrote: > >> >> times = 3:4 >> do.call(rbind, by(data, data$id, function(data) >> with(data, { >> rows = (time == times[which(times %in% time)[1]]) >> if (is.na(rows[1])) data.frame(id=id, time=NA, x=NA) else >> data[rows,] }))) >> >> # id

Re: [R] Problem with circular::plot.circular()

2009-03-29 Thread Duncan Murdoch
On 29/03/2009 7:39 AM, Michael Kubovy wrote: require(circular) c <- circular(rep(0, 20), zero = pi/2, rotation = 'clock') plot(c, stack = TRUE, shrink = 1.5) Can anyone tell me why the stack is offset from 0? It's a histogram, and the bin starts at zero, and runs to pi/10 (I'm guessing, since

Re: [R] select observations from longitudinal data

2009-03-29 Thread Peter Dalgaard
Wacek Kusnierczyk wrote: gallon li wrote: Suppose I have a long format for a longitudinal data id time x 1 1 10 1 2 11 1 3 23 1 4 23 2 2 12 2 3 13 2 4 14 3 1 11 3 3 15 3 4 18 3 5 21 4 2 22 4 3 27 4 6 29 I want to select the x values for each ID when time is equal to 3. When that observation is

Re: [R] Burt table from word frequency list

2009-03-29 Thread Duncan Murdoch
On 29/03/2009 7:02 AM, Joan-Josep Vallbé wrote: Dear all, I have a word frequency list from a corpus (say, in .csv), where the first column is a word and the second is the occurrence frequency of that word in the corpus. Is it possible to obtain a Burt table (a table crossing all words wit

[R] Problem with circular::plot.circular()

2009-03-29 Thread Michael Kubovy
require(circular) c <- circular(rep(0, 20), zero = pi/2, rotation = 'clock') plot(c, stack = TRUE, shrink = 1.5) Can anyone tell me why the stack is offset from 0? _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Ch

Re: [R] asking advice for Integer Programming packages

2009-03-29 Thread Hans W. Borchers
Looking into the 'Optimization' task view you will also identify the Rsymphony package. A short overview of these packages and a benchmark based on a test suite can be found in . Different problems may have quite different ru

Re: [R] select observations from longitudinal data

2009-03-29 Thread Wacek Kusnierczyk
gallon li wrote: > Suppose I have a long format for a longitudinal data > > id time x > 1 1 10 > 1 2 11 > 1 3 23 > 1 4 23 > 2 2 12 > 2 3 13 > 2 4 14 > 3 1 11 > 3 3 15 > 3 4 18 > 3 5 21 > 4 2 22 > 4 3 27 > 4 6 29 > > I want to select the x values for each ID when time is equal to 3. When that > obse

[R] Burt table from word frequency list

2009-03-29 Thread Joan-Josep Vallbé
Dear all, I have a word frequency list from a corpus (say, in .csv), where the first column is a word and the second is the occurrence frequency of that word in the corpus. Is it possible to obtain a Burt table (a table crossing all words with each other, i.e., where rows and columns are

Re: [R] Eclipse and StatET Howto (also added Subversion, Rtools)

2009-03-29 Thread Duncan Murdoch
Thanks for posting these. One minor correction about Rtools installation below: On 28/03/2009 11:25 PM, Ken-JP wrote: I recently got a RFC on Eclipse and StatET setup from a R-help user, so here it is. Note: there may be slight errors of omission in my directions as I am making these notes af

Re: [R] number of ticks in a persp() plot

2009-03-29 Thread Duncan Murdoch
On 28/03/2009 9:42 PM, a s wrote: Hi, I am trying to specify four ticks (at 0,1,2,3 for the y axis) in a persp plot but the defaults overrule my specification and I obtain seven of them. Is it possible to gain full control over them in such a plot? Here is my code: matlines=matrix(c(1:7,3:9,3:9,

Re: [R] Sorting problem

2009-03-29 Thread Duncan Murdoch
On 28/03/2009 4:57 PM, Stavros Macrakis wrote: On Sat, Mar 28, 2009 at 7:53 AM, Duncan Murdoch wrote: ...More generally, the xtfrm() function converts a vector into a numeric one that sorts in the same order. ... Thanks, I learn a lot just by reading the answers to other people's questions o

Re: [R] Merging rows in dataframes

2009-03-29 Thread Schragi Schwartz
Hi, Again, thank you for your extremely helpful answer. I'll try my luck a third time with a similar but different question: assuming I have two dataframes, a and b, each of which containing a set of start and end coordinates, and I want to create a new dataframe c, which contains all coordinates i

Re: [R] Selecting elements from a vector (a simple question with weird results)

2009-03-29 Thread andrew
aa[order(aa)] is the same as sort, although sort is much quicker and has lower memory requirements: > aa <- rnorm(1000) > all(aa[order(aa)] == sort(aa)) [1] TRUE > system.time(sort(aa)) user system elapsed 7.270.088.25 > system.time(aa[order(aa)]) user system elapsed 29.58

Re: [R] select observations from longitudinal data

2009-03-29 Thread Bill.Venables
Let's tackle the bigger problem of doing this not just for time = 3 but for all times. First we start with your data frame: > dat id time x 1 11 10 2 12 11 3 13 23 4 14 23 5 22 12 6 23 13 7 24 14 8 31 11 9 33 15 10 34 18 11 35 2

Re: [R] Breaks in y-axis of histogram using lattice

2009-03-29 Thread Jim Lemon
John Poulsen wrote: Hello R-Users, I am plotting several histograms to demonstrate zero-inflated data using lattice. Because there are so many zeros, it is difficult to see the observations of non-zeros on the graph (i.e. the y-axis scale is too large). I would like to break the y-scale so

Re: [R] list of variables to table of factors

2009-03-29 Thread Bill.Venables
Here is a possibility. There is only one trick. > data Q1_1 Q1_2 Q1_3 Q1_4 Q1_5 Q1_6 Q1_7 Q1_8 155545454 245355535 344344442 455555444 5555555

[R] select observations from longitudinal data

2009-03-29 Thread gallon li
Suppose I have a long format for a longitudinal data id time x 1 1 10 1 2 11 1 3 23 1 4 23 2 2 12 2 3 13 2 4 14 3 1 11 3 3 15 3 4 18 3 5 21 4 2 22 4 3 27 4 6 29 I want to select the x values for each ID when time is equal to 3. When that observation is not observed, then I want to replace it with

Re: [R] simple example for linear mixed effects model

2009-03-29 Thread Dieter Menne
Edna Bell wrote: > > Could someone point me to a small example of a linear mixed effects > model, please? > Check R_HOME/library/nlme/scripts/ch01.R But better get the book by Pinheiro/Bates (PB) Edna Bell wrote: > > Ideally, this example would only have a few data points so I could > cal

Re: [R] how to get all iterations if I meet NaN?

2009-03-29 Thread Nash
Okay! Thank you! On Sun, 29 Mar 2009 10:01:29 +0200, Peter Dalgaard wrote > Nash wrote: > >> Uwe Ligges wrote: > >> Please read the question more carefully, the sin() example was used > >> as a method that does not give an error but works as expected (just > >> with the warning), but the questi

Re: [R] how to get all iterations if I meet NaN?

2009-03-29 Thread Peter Dalgaard
Nash wrote: Uwe Ligges wrote: Please read the question more carefully, the sin() example was used as a method that does not give an error but works as expected (just with the warning), but the question is how not to break the loop, and so my answer was "see ?try". So, Do you have any soluti

[R] list of variables to table of factors

2009-03-29 Thread arademaker
Sorry about the simple question. Is there any function to transform a data.frame like this (rows are observations and columns are variables): Q1_1 Q1_2 Q1_3 Q1_4 Q1_5 Q1_6 Q1_7 Q1_8 155545454 245355535 344344

Re: [R] how to get all iterations if I meet NaN?

2009-03-29 Thread Nash
> Uwe Ligges wrote: > Please read the question more carefully, the sin() example was used > as a method that does not give an error but works as expected (just > with the warning), but the question is how not to break the loop, > and so my answer was "see ?try". So, Do you have any solution abo