[R] error message fitting tcopula

2010-06-09 Thread Roslina Zakaria
Hi r-users,   I really need help in fitting the t-copula.  I try to reproduce the example given by Jun Yan in “Enjoy the joy of copula” but I’m not sure how to correct the error based on the error message.  I tried so many ways but still could not get it working.   loglik.marg <- funct

[R] Help with Tinn-R

2010-06-09 Thread Van Wyk, Jaap
I have just installed the latest versions of R and Tinn-R (running Windows XP prof.) R 2.11.0 Tinn-R version 2.3.5.2 Everything seems fine, except for the following: I usually do this: Open Tinn-R and click on the R icon to open R - this splits the screen into two parts horiozontally, with Tinn-R

[R] Issues with Bar Graph

2010-06-09 Thread beloitstudent
Hello all! I am relatively new at R and was having a few issues with the following graph: barplot(c(5724.688,7290.7875), ylab=expression(paste(Delta, "AUC 45-200 min (μg/ml * 155 min)")), xlim=c(0,2), width=0.5, border="black",font.lab=2,cex.lab=1.7, names.arg=c("Saline (n=8)", "Exendin (9-39)

Re: [R] comparing two regression models with different dependent variable

2010-06-09 Thread Or Duek
Ok. Thank you very much for setting me straight :) On Wed, Jun 9, 2010 at 7:22 PM, Joris Meys wrote: > On Wed, Jun 9, 2010 at 5:19 PM, Or Duek wrote: > > Hi, > > I would like to compare to regression models - each model has a different > > dependent variable. > > The first model uses a number

Re: [R] lattice: how to remove ticks from splom()?

2010-06-09 Thread Deepayan Sarkar
On Wed, Jun 9, 2010 at 10:03 PM, Marius Hofert wrote: > How do I remove the labels (numbers)? > > Is splom(~iris[,1:4], axis.line.tck = 0, axis.text.cex =0) the way to go? Just use 'pscales = 0'. There is even an example of this is in help(splom). You should really get into the habit of reading d

Re: [R] Specifying formula inside a function

2010-06-09 Thread Mark Seeto
Bill and Erik, thank you very much for your help. In addition to solving my problem, both solutions contain other good things I didn't know about. Regards, Mark Seeto On Thu, Jun 10, 2010 at 2:44 PM, Erik Iverson wrote: > Hello, > >> How does one specify a formula to lm inside a function (with v

[R] Help with Post-Hoc tests for TWO-WAY within subject ANOVA

2010-06-09 Thread Xiao He
Dear R users, I posted a couple of questions and got no response, so I am giving it another shot. I ran an experiment with a TWO-WAY within subject design. A sample dataset is in http://www-scf.usc.edu/~hex/data.txt I already ran ANOVA by using the following formula: aov(RT~Factor1*Factor2 + Er

Re: [R] lattice: how to remove ticks from splom()?

2010-06-09 Thread Marius Hofert
How do I remove the labels (numbers)? Is splom(~iris[,1:4], axis.line.tck = 0, axis.text.cex =0) the way to go? Thanks, Marius On 2010-06-10, at 06:42 , Deepayan Sarkar wrote: > On Wed, Jun 9, 2010 at 1:32 PM, Marius Hofert wrote: >> Dear ExpeRts, >> >> why does >> >> splom(~iris[,1:4],sc

Re: [R] Retrieving the 2 row of "dist" computations

2010-06-09 Thread Bill.Venables
This is a lazy way, and a slightly extravagant way if your memory is limited and you are dealing with large numbers of rows. NCols <- 5 NRows <- 7 myMat <- matrix(runif(NCols*NRows), ncol=NCols) d <- dist(myMat) dm <- as.matrix(d) diag(dm) <- Inf ij <- which(dm == min(dm), arr.ind = TRUE)[1,]

Re: [R] Specifying formula inside a function

2010-06-09 Thread Bill.Venables
Here is one way. f <- function(d) { y <- names(d)[1] xs <- names(d)[-1] nx <- length(xs) xs <- sort(sample(xs, sample(1:nx, 1))) form <- as.formula(paste(y, "~", paste(xs, collapse="+"))) Call <- substitute(lm(FORM, data = d), list(FORM = form)) eval(Call) } d <- within(data.frame(y

Re: [R] Specifying formula inside a function

2010-06-09 Thread Erik Iverson
Hello, How does one specify a formula to lm inside a function (with variable names not known in advance) and have the formula appear explicitly in the output? For example, f <- function(d) { in.model <- sample(c(0,1), ncol(d)-1, replace=T) current.model <- lm(paste(names(d)[1], "~", paste(

Re: [R] lattice: how to remove ticks from splom()?

2010-06-09 Thread Deepayan Sarkar
On Wed, Jun 9, 2010 at 1:32 PM, Marius Hofert wrote: > Dear ExpeRts, > > why does > > splom(~iris[,1:4],scales = list(alternating = c(0,0), tck = c(0,0))) > > not remove the ticks and labels (xyplot does)? It does actually, though not in the way you think. Compare with splom(~iris[,1:4], scales

Re: [R] Retrieving the 2 row of "dist" computations

2010-06-09 Thread Jorge Ivan Velez
Hi there, I am sure there is a better way to do it, but here is a suggestion: res <- matrix(NA, ncol = 2, nrow = 5) for(i in 1:5) res[i, ] <- which(as.matrix(d) == sort(d)[i], arr.ind = TRUE)[1,] res HTH, Jorge On Wed, Jun 9, 2010 at 11:30 PM, Jeff08 <> wrote: > > Dear R Gurus, > > As you pro

Re: [R] panel.abline {lattice} help

2010-06-09 Thread Deepayan Sarkar
On Wed, Jun 9, 2010 at 6:49 PM, Xin Ge wrote: > Hi All, > > I need a small help plotting median lines on lattice boxplots. > > # Data > a <- rep(c("A","B"), each=10) > b <- rep(c("a","a+b","b","b+a"), each=5) > c <- c(1,9,5,2,7,7,8,8,8,5,4,5,3,2,5,6,7,8,9,1) > x <- data.frame(a, b, c) > med.A <- m

[R] Retrieving the 2 row of "dist" computations

2010-06-09 Thread Jeff08
Dear R Gurus, As you probably know, dist calculates the distance between every two rows of data. What I am interested in is the actual two rows that have the least distance between them, rather than the numerical value of the distance itself. For example, If the minimum distance in the following

[R] Specifying formula inside a function

2010-06-09 Thread Mark Seeto
Hello, How does one specify a formula to lm inside a function (with variable names not known in advance) and have the formula appear explicitly in the output? For example, f <- function(d) { in.model <- sample(c(0,1), ncol(d)-1, replace=T) current.model <- lm(paste(names(d)[1], "~", paste(na

[R] 45 degree tick marks

2010-06-09 Thread beloitstudent
Hello experts. Sorry this is such a novice question, but I have been trying, fruitlessly to get my x axis to angle at 45 degrees. I have tried the text() call with srt and adj and just cannot get my labels to tilt. Does anyone have any other suggestions? The following is my command for the gra

[R] Using the Ingres SQL database with R

2010-06-09 Thread Denis Brown
Dear R Forum members, I am wondering of anyone has used R to pull data from an Ingres SQL database? My initial thoughts would be to use the RJDBC package and Ingres's JDBC driver. Before I get this thing together, has anyone used this combination and can verify that it works, or can forewarn m

Re: [R] Creating reports using R

2010-06-09 Thread Erik Iverson
John Antonakakis wrote: is there a good way to generate reports in R? I found the following code using split.screen but this only works with plots and i would like to generate reports with tables and charts. thx The answer is definitively yes, and you can spend a lot of time learning about how

[R] Creating reports using R

2010-06-09 Thread John Antonakakis
is there a good way to generate reports in R? I found the following code using split.screen but this only works with plots and i would like to generate reports with tables and charts. thx if (interactive()) { par(bg = "white") # default is likely to be transparent split.screen(c(

Re: [R] question about "mean"

2010-06-09 Thread Phil Spector
One possibility is aggregate(iris[,-5],list(iris[,5]),mean) Group.1 Sepal.Length Sepal.Width Petal.Length Petal.Width 1 setosa5.006 3.4281.462 0.246 2 versicolor5.936 2.7704.260 1.326 3 virginica6.588 2.9745

[R] Re :help to aggregate data

2010-06-09 Thread Mohan L
Dear All, I have the data some thing like this, I am showing here three days data only: > dummy.data <- read.table(file='dummy.txt',sep='', header=TRUE) > dummy.data StDate Domaindesc Logins 1 05/01/10xxx 10 2 05/01/10xxx 45 3 05/01/10xxx 2 4 05/01/10

Re: [R] question about "mean"

2010-06-09 Thread Bill.Venables
Here is an alternative with(iris, rowsum(iris[, -5], Species)/table(Species)) -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Langfelder Sent: Thursday, 10 June 2010 12:27 PM To: SH.Chou Cc: r-help@r-project.org Subject: R

Re: [R] question about "mean"

2010-06-09 Thread Peter Langfelder
apply(iris[, -5], 2, tapply, iris$Species, mean) On Wed, Jun 9, 2010 at 3:43 PM, SH.Chou wrote: > Hi there: > I have a question about generating mean value of a data.frame. Take > iris data for example, if I have a data.frame looking like the following: > - >Sepal.Len

[R] Can RMySQL be used for a paramterized query?

2010-06-09 Thread Ted Byers
I have not found anything about this except the following from the DBI documentation : Bind variables: the interface is heavily biased towards queries, as opposed > to general > purpose database development. In particular we made no attempt to define > “bind > variables”; this is a mechanism by wh

Re: [R] counting Na/not NA by groups by column

2010-06-09 Thread steven mosher
thats beautiful > apply(m[, 3:14], 2, + function(x) tapply(x, m[,2], function(x) sum(!is.na(x [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] 1800332332333 3 3 3 1801332332333 3

Re: [R] correcting a few data in an unreshaped data frame

2010-06-09 Thread Mr. Natural
Joris: Very, very nice. I have spent the day learning about indices. Thank you very much. Mr. Natural -- View this message in context: http://r.789695.n4.nabble.com/correcting-a-few-data-in-an-unreshaped-data-frame-tp2248219p2249599.html Sent from the R help mailing list archive at Nabble.com.

[R] question about "mean"

2010-06-09 Thread SH.Chou
Hi there: I have a question about generating mean value of a data.frame. Take iris data for example, if I have a data.frame looking like the following: - Sepal.Length Sepal.Width Petal.Length Petal.WidthSpecies 15.1 3.5

[R] Gamma Copula

2010-06-09 Thread Peter Stueckler
Hello R-Team, I am trying to construct a Copula from a multivariate Gamma distribution with its marginals gamma-distributed. The multivariate Gamma should be able to contain a correlation coeficient or matrix. I have studied the book "Continuous Multivariate Distributions vol.I Models and app

Re: [R] panel.abline {lattice} help

2010-06-09 Thread Erik Iverson
Xin, Xin Ge wrote: Hi All, I need a small help plotting median lines on lattice boxplots. # Data a <- rep(c("A","B"), each=10) b <- rep(c("a","a+b","b","b+a"), each=5) c <- c(1,9,5,2,7,7,8,8,8,5,4,5,3,2,5,6,7,8,9,1) x <- data.frame(a, b, c) med.A <- median(subset(x$c, x$a=="A")) med.B <- media

[R] panel.abline {lattice} help

2010-06-09 Thread Xin Ge
Hi All, I need a small help plotting median lines on lattice boxplots. # Data a <- rep(c("A","B"), each=10) b <- rep(c("a","a+b","b","b+a"), each=5) c <- c(1,9,5,2,7,7,8,8,8,5,4,5,3,2,5,6,7,8,9,1) x <- data.frame(a, b, c) med.A <- median(subset(x$c, x$a=="A")) med.B <- median(subset(x$c, x$a=="B"

Re: [R] counting Na/not NA by groups by column

2010-06-09 Thread Erik Iverson
Hello, steven mosher wrote: # create a matrix with some random NAs in it m<-matrix(NA,nrow=15,ncol=14) m[,3:14]<-52 m[13,9]<-NA m[4:7,8]<-NA m[1:2,5]<-NA m[,2]<-rep(1800:1804, by=3) y<-order(m[,2]) m<-m[y,] m[,1]<-rep(1:3,by=5) # what we want is a result that looks like this 1800 3 3

[R] counting Na/not NA by groups by column

2010-06-09 Thread steven mosher
# create a matrix with some random NAs in it > m<-matrix(NA,nrow=15,ncol=14) > m[,3:14]<-52 > m[13,9]<-NA > m[4:7,8]<-NA > m[1:2,5]<-NA > m[,2]<-rep(1800:1804, by=3) > y<-order(m[,2]) > m<-m[y,] > m[,1]<-rep(1:3,by=5) > m [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] [,13] [,

Re: [R] R-List on Spanish Where I can find???

2010-06-09 Thread Marc Schwartz
On Jun 9, 2010, at 8:38 PM, TND (Ing. Marcos Ortiz Valmaseda) wrote: > Regards to all R-Help list > I ´m searching a R list on Spanish > Do you know any? > > Regards and thanks a lot Go here: https://stat.ethz.ch/mailman/listinfo/r-help-es HTH, Marc Schwartz __

[R] R-List on Spanish Where I can find???

2010-06-09 Thread TND (Ing. Marcos Ortiz Valmaseda)
Regards to all R-Help list I ´m searching a R list on Spanish Do you know any? Regards and thanks a lot __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-g

Re: [R] RGoogleDocs not working for me with " wise" service

2010-06-09 Thread Farrel Buchinsky
Dear Duncan I am not the only one who thinks RGoogleDocs is fantastic. See below. I think it would save many people a lot of time and/or disappointment if the omegahat site were updated to show/offer 0.4-1 instead of 0.4-0. Am I correct in believing that I cannot change it, only you can? If so, th

Re: [R] Finding the bootstrapped coefficient of variation and the stderr on the CV(boot)

2010-06-09 Thread Jorge Ivan Velez
Hi D., One option would be to use the boot library: require(boot) x <-c(1, 0, 0.153846154, 0, 0.142857143) mycv <- function(x, id){ xs <- x[id] sd(xs)/mean(xs) } my.boot <- boot(x, mycv, R = 999) my.boot plot(my.boot) boot.ci(my.boot) Also, take a look at [1], [2] and [3]. HTH, Jorge [1]

Re: [R] geom_ribbon removes missing values

2010-06-09 Thread Karsten Loesing
Hi Paul, On 6/9/10 1:12 AM, Paul Murrell wrote: > grid.polygon() can do multiple polygons in a single call, but rather > than using NA's to separate sub-polygons, it uses an 'id' argument (or > an 'id.lengths' argument) to identify sub-polygons within the vectors of > x- and y-values (see the exam

Re: [R] Draw text with a box surround in plot.

2010-06-09 Thread Peter Ehlers
Maybe this can be display-dependent. I just measured the two diagonals on the plot and they're equal to within less than one mm (possibly closer but that was the accuracy of my measuring device (pencil and strip of paper)). -Peter Ehlers On 2010-06-09 16:57, g...@ucalgary.ca wrote: For me, the

[R] ANOVA of a sort

2010-06-09 Thread Claus O'Rourke
Dear R Help, I have a general question - I know this is the R list, but I hope someone can help me out a little as I've always found the help here to be absolutely fantastic. I have run a psychological study where participants are given multiple stimuli and their responses to those stimuli are me

[R] Finding the bootstrapped coefficient of variation and the stderr on the CV(boot)

2010-06-09 Thread D Cornacchia
Dear R-Helpers, I am trying to bootstrap the coefficient of variation on a suite of vectors, here I provide an example using one of the vectors in my study. When I ran this script with the vector x <-c(0.625, 0.071428571, 0.1, 0.125, 0), it returned CV(boot) [the second one], and s

[R] cbind with vectors of different lengths?

2010-06-09 Thread Arantzazu Blanco Bernardeau
Hello R help I have a dataframe, with 71 samples (rows) and 30 variables. I got linear models for some of the variables,  and I want to join fitted and residuals of these models to the data frame. Sometimes, these vectors have the same length of the dependant variable, but in a few cases, NA va

Re: [R] Draw text with a box surround in plot.

2010-06-09 Thread guox
For me, the angles circled are not exactly right. See the pdf file: plot.pdf. But it is OK. Thanks Peter for your directions -james > On 2010-06-09 14:17, g...@ucalgary.ca wrote: >> Thank. >> Better. Seems that angles are close to but not equal to pi/2. >> It may be because the plot box is not a sq

Re: [R] Draw text with a box surround in plot.

2010-06-09 Thread Peter Ehlers
On 2010-06-09 14:17, g...@ucalgary.ca wrote: Thank. Better. Seems that angles are close to but not equal to pi/2. It may be because the plot box is not a square: the length of x-axis is not the same as the length of y-axis. Even curves y = x and y = 1-x look like not orthogonal but they should si

[R] back transforming arcsine transformations in metafor

2010-06-09 Thread Chris Miller
Hi everyone, I'm using the metafor package to meta-analyze a set of proportions. This is working really well for the raw proportions, but is there a way to back-transform the arcsine transformed proportions in the rma or forest functions with the atransf option? The estimates and CIs for the tr

Re: [R] RGoogleDocs not working for me with " wise" service

2010-06-09 Thread Harlan Harris
It works! How fantastic a capability, and how embarrassing that I missed that version change! Thanks very much! -Harlan On Wed, Jun 9, 2010 at 5:52 PM, Farrel Buchinsky wrote: > Harlan Harris harris.name> writes: > > > > > Hello, > > > > I'm trying to figure out how to use the RGoogleDocs pa

Re: [R] RGoogleDocs not working for me with " wise" service

2010-06-09 Thread Farrel Buchinsky
Harlan Harris harris.name> writes: > > Hello, > > I'm trying to figure out how to use the RGoogleDocs package from OmegaHat, > and am having a bit of trouble. I emailed Duncan Temple Lang directly, but > didn't receive a response, so I thought I'd try here to see if anyone else > can help. > >

Re: [R] Problem with library(SSPA)

2010-06-09 Thread David Scott
Samuel Okoye wrote: I can't find his email and I have asked the same question to bioconduc...@stat.math.ethz.ch Regards, Samuel So you need the handy function maintainer() added to 2.11.0: > require(GeneralizedHyperbolic) > maintainer("GeneralizedHyperbolic") [1] "David Scott " David Sc

Re: [R] barplot of a table

2010-06-09 Thread Greg Snow
If your data came in using read.csv then it is most likely a data frame rather than a matrix. Try as.matrix to convert it to a matrix and then use barplot. If that does not work then give us a sample of your data and the exact commands (copy/paste) that use used along with any errors/warnings.

Re: [R] Problem Matching Exact Values

2010-06-09 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Brigid Mooney > Sent: Wednesday, June 09, 2010 1:49 PM > To: r-help@r-project.org > Subject: [R] Problem Matching Exact Values > > Sorry for the basic question - bur I ran into s

[R] non-parametric repeated measures anova using Proportional Odds Model - examples?!

2010-06-09 Thread Tal Galili
Hello dear R-help mailing list, I wish to perform a non-parametric repeated measures anova. If what I read online is true, this could be achieved using a mixed Ordinal Regression model (a.k.a: Proportional Odds Model). I found two packages that seems relevant, but couldn't find any vignette on the

[R] barplot of a table

2010-06-09 Thread Phillip Porter
Good morning, I've been dabbling in R, so my knowledge has quite a few holes in it. I'm hoping that this has a simple answer and just falls into one of those holes. I have a table of percentages that I want to display as a barchart. Groups 1-4 in columns and Variables 1-5 in rows, with the perce

Re: [R] creating a new variable, conditional on the value of an existing variable, selected conditionally

2010-06-09 Thread Henrique Dallazuanna
Try this: f$E <- diag(as.matrix(f[f$D])) On Wed, Jun 9, 2010 at 11:03 AM, Malcolm Fairbrother < m.fairbrot...@bristol.ac.uk> wrote: > Dear all, > > I have a data frame f, with four variables: > > f <- data.frame(A=c(0,0,1,1), B=c(0,1,0,1), C=c(1,1,0,1), D=c(3,1,2,3)) > f > A B C D > 1 0 0 1 3

[R] Problem Matching Exact Values

2010-06-09 Thread Brigid Mooney
Sorry for the basic question - bur I ran into something I haven't noticed before and would appreciate a little more perspective on my problem. I am using R to determine if various thresholds are hit (or surpassed) in a data set.  If a threshold is surpassed, I have had no problems identifying it. 

Re: [R] counting across leves of factors

2010-06-09 Thread Peter Langfelder
To get the counts, assuming your data frame is called factors and it only contains the 17 factors, you can do n = nrow(factors) aux = rep(1, n); tab = tapply(aux, as.list(factors), sum); example: factors = matrix(sample(c(1:3), 3000, replace = TRUE), 1000, 3) lfactors = as.list(data.fran = nrow(

[R] lattice: how to remove ticks from splom()?

2010-06-09 Thread Marius Hofert
Dear ExpeRts, why does splom(~iris[,1:4],scales = list(alternating = c(0,0), tck = c(0,0))) not remove the ticks and labels (xyplot does)? Cheers, Marius __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do re

Re: [R] iterating over groups of columns

2010-06-09 Thread Greg Snow
You could try something like this (untested): > tmpfun <- function(i) { + tmp <- paste( "^k.", i, sep="") + apply( subset(mydf, select=grep(tmp, names(mydf) ) ), 1, min ) + } > out1 <- lapply(1:10, tmpfun) > names(out1) <- paste( "min.k.", 1:10, sep="" ) > mydf2 <- cbind(mydf, out1) -- Gre

[R] maPalette() and the number of colors returned (bug?)

2010-06-09 Thread Ali Tofigh
Hi, The maPalette() function (in the marray package) does not always return the number of colors requested. More specifically, if a middle color is given and the number of colors requested is odd, then maPalette returns either one more or one less than the requested number of colors: maPalette(lo

Re: [R] Draw text with a box surround in plot.

2010-06-09 Thread Greg Snow
If you cannot set the aspect ratio to 1 for the entire plot (Peter's solution), then you may consider using either subplot or my.symbols (TeachingDemos package) to create an asp=1 region within the plot that you can use to plot the rotated rectangle. The other option is to do a little more matr

Re: [R] [R-sig-Geo] How to extract coordinates values from a shapefile?

2010-06-09 Thread Nikhil Kaza
What does coordinates() give for a polygon? centeroid? I suppose I could look up the code, but it would be immensely helpful if the help page could specify it. regards Nikhil On Jun 9, 2010, at 3:50 PM, Rodrigo Aluizio wrote: > I'm not sure if this is what you want. But the function > coordi

Re: [R] Draw text with a box surround in plot.

2010-06-09 Thread guox
Thank. Better. Seems that angles are close to but not equal to pi/2. It may be because the plot box is not a square: the length of x-axis is not the same as the length of y-axis. Even curves y = x and y = 1-x look like not orthogonal but they should since multiplication of their slopes is -1. -jame

Re: [R] Performing a function on columns specified in another dataframe

2010-06-09 Thread Jorge Ivan Velez
Hi Josh, One way would be: res <- apply(b, 1, function(Names) t.test(a[, Names[1]], a[, Names[2]])) do.call(rbind, lapply(res, function(l) c(l$statistic, l$parameter, p = l$p.value))) # t df p # test.1 1.775490 17.35589 0.09335398 # test.2 -1.489210 15.82584

Re: [R] Subset columns by prefix

2010-06-09 Thread Henrique Dallazuanna
Try this: subset(x, select = grep("cru", names(x))) On Wed, Jun 9, 2010 at 2:41 PM, Josh B wrote: > Hello R listserve, > > I would appreciate someone's help with this problem. Consider the following > toy dataset: > > x <- read.table(textConnection("worldclim.1 worldclim.2 cru.1 cru.2 > indv.1

Re: [R] Change the name of one column ONLY

2010-06-09 Thread Jorge Ivan Velez
Hi Josh, Here is a suggestion: colnames(x)[1] <- 'mynewname' colnames(x) # [1] "mynewname" "apples""bananas" "cherries" HTH, Jorge On Wed, Jun 9, 2010 at 1:45 PM, Josh B <> wrote: > Hi all, > > I have a very simple problem that I cannot seem to find the answer to. > Consider the follow

Re: [R] [R-sig-Geo] How to extract coordinates values from a shapefile?

2010-06-09 Thread Rodrigo Aluizio
I'm not sure if this is what you want. But the function coordinates() in sp package gives you the coordinates of SpatialObjects. Regards. Rodrigo. 2010/6/9 Nikhil Kaza > You need to execute gpclibPermit() to enable gpclib. > > library(maptools) should have issued a warning to that effect. > >

Re: [R] Change the name of one column ONLY

2010-06-09 Thread Henrique Dallazuanna
Try: names(x)[1] <- 'pears' On Wed, Jun 9, 2010 at 2:45 PM, Josh B wrote: > Hi all, > > I have a very simple problem that I cannot seem to find the answer to. > Consider the following toy dataset: > > x <- read.table(textConnection("V1 apples bananas cherries > indv.1 7 8 4 3 > indv.2 7 7 4 9")

[R] counting across leves of factors

2010-06-09 Thread peterko
I have dataframe with 17factors variables (for example every factor have 3levels) I have maybe 5000 observation. And i need to do table where is in every raw 1 of possible combination of this factors and the numbur how many time is this combination in my dataset. I wrote one code, but this is ver

[R] Performing a function on columns specified in another dataframe

2010-06-09 Thread Josh B
Hello Listserve, Here is another question to keep you on your toes. Please consider the following toy dataset: a <- read.table(textConnection("fred sam joe alex measure.1 10 4 10 1 measure.2 10 4 2 8 measure.3 3 1 8 3 measure.4 5 1 3 3 measure.5 8 6 8 3 measure.6 9 5 1 0 measure.7 4 6 10 1 measu

[R] makign help files by hand

2010-06-09 Thread Philip A. Viton
Can someone tell me how to make up (eg) a library's html help files by hand? I think I ought to be able to use RCMD Rdconv for this but (R-2.10.0, MS-win) when I type (in a dos session) "rdcmd rdconv --help" I get a message to the effect that a perl script rdconv can't be opened. Can I do t

[R] Subset columns by prefix

2010-06-09 Thread Josh B
Hello R listserve, I would appreciate someone's help with this problem. Consider the following toy dataset: x <- read.table(textConnection("worldclim.1 worldclim.2 cru.1 cru.2 indv.1 7 8 32 658 indv.2 7 7 39 422"), header = TRUE) How could I create a subset of the data based on the column prefi

[R] Change the name of one column ONLY

2010-06-09 Thread Josh B
Hi all, I have a very simple problem that I cannot seem to find the answer to. Consider the following toy dataset: x <- read.table(textConnection("V1 apples bananas cherries indv.1 7 8 4 3 indv.2 7 7 4 9"), header = TRUE) How would I change the column name of ONLY the first column, not the othe

Re: [R] creating a new variable, conditional on the value of an existing variable, selected conditionally

2010-06-09 Thread Doran, Harold
How about this: f <- data.frame(A=c(0,0,1,1), B=c(0,1,0,1), C=c(1,1,0,1), D=c(3,1,2,3)) N <- nrow(f) mat <- cbind(1:N,f$D) f$E <- f[mat] f A B C D E 1 0 0 1 3 1 2 0 1 1 1 0 3 1 0 0 2 0 4 1 1 1 3 1 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project

[R] bug? in stats::cor for use=complete.obs with NAs

2010-06-09 Thread hugh.genin
Ar, I think I've found a bug in the behavior of the stats::cor function when NAs are present, but in case I'm missing something, could you look over this example and let me know what you think: > a = c(1,3,NA,1,2) > b = c(1,2,1,1,4) > cor(a,b,method="spearman", use="complete.obs") [1] 0.8164

Re: [R] Draw text with a box surround in plot.

2010-06-09 Thread Peter Ehlers
Your transformation assumes that the x- and y-axes are on the same scale. Add 'asp = 1' to your plot() call to set the appropriate aspect ratio. -Peter Ehlers On 2010-06-09 10:13, g...@ucalgary.ca wrote: Rectangle R centered at (x,y) with width 2w and height 2h is given by x1=x-w y1=y-h x2=x

[R] Fixed sill in variogram fitting (geoR)

2010-06-09 Thread Aziz Chaouch
Dear all, I'm trying to fit a variogram model using variofit function in geoR package. There is an option to fix the nugget but is there anyway to force the variogram sill to equal some defined value? I'm working with standardized longitudinal data so the process variance is 1 and I'd like

Re: [R] How to add a new plot in the same graph using add=T at the command plot?

2010-06-09 Thread Larissa Lucena
I've really apreciated your advice! Thanks! On Wed, Jun 9, 2010 at 14:05, Peter Ehlers wrote: > Soapbox: > Well, if you're just starting out with R it would be > a VERY good idea to learn right away that T is not TRUE > and F is not FALSE, at least not always. Sooner or > later you WILL have pro

Re: [R] for loop incremented by 0.01

2010-06-09 Thread John Kane
Why? See ?seq seq(0,1,.01) --- On Wed, 6/9/10, suman dhara wrote: > From: suman dhara > Subject: [R] for loop incremented by 0.01 > To: r-h...@stat.math.ethz.ch > Received: Wednesday, June 9, 2010, 12:30 PM > Sir, > I want to use a for loop which will be incremented by 0.01 > in 0 to 1. > P

Re: [R] Rglpk

2010-06-09 Thread Peter Ehlers
On 2010-06-09 5:11, Kaveh Vakili wrote: Hi list, in the Rglpk_solve_LP function (::Rglpk), on line 26, the function calls a function as.glp_bounds() that i cannot access. i'm trying to alter the Rglpk_solve_LP function to add a line to retrieve column/row dual values. everytime i change the s

Re: [R] combining expressions in mathplot

2010-06-09 Thread RICHARD M. HEIBERGER
Uwe, Very nice, thank you. Rich [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide comm

Re: [R] passing local parameters to nls?

2010-06-09 Thread Gabor Grothendieck
It looks in the environment of your formula (which in this case is the global environment) and then in data. Thus here are two solutions: f2 <- function(c) { environment(fo) <- environment() nls(fo, data=d, start=list(a=1, b=1)) } f3 <- function(c) nls(fo, data=c(d, c = c), start

[R] cut edge from surface using persp()

2010-06-09 Thread marlene marchena
Hi R users! Is it possible to cut the edges from a surface graph without to cut the axes using persp function? I am using the following code: op <- par(bg = "white") persp(phi1, phi2, z,main="Bullwhip generated with AR(2) demand when L=1", xlab ="phi1" , ylab ="phi2", zlab ="Bullwhip", t

Re: [R] how to draw the probability ellipse circle figure?

2010-06-09 Thread Ben Bolker
Jie TANG gmail.com> writes: > > hi ,R user folks . > > Nowadays I read a paper which draw a probability ellipse circle figure > shown in the appendix. > I wonder how to draw this figure by R ? > the x-axis and y-axis both express the error but in different direction . Your question is quit

Re: [R] dealing with heteroscedasticity in lmer: problem with the method weights

2010-06-09 Thread Ben Bolker
doris gomez yahoo.fr> writes: > > Dear lmer users, You should probably redirect this sort of question to r-sig-mixed-mod...@r-project.org , rather than the generic R help list. > > The experiment includes 15 groups of (3 males and 1 female). > The female is characterized by its quality Q1

Re: [R] How to add a new plot in the same graph using add=T at the command plot?

2010-06-09 Thread Peter Ehlers
Soapbox: Well, if you're just starting out with R it would be a VERY good idea to learn right away that T is not TRUE and F is not FALSE, at least not always. Sooner or later you WILL have problems. So do yourself a favour and get into the habit of using TRUE/FALSE instead of T/F. (I know that Pe

Re: [R] generate list of variable names

2010-06-09 Thread Jon Erik Ween
Thanks Erik I can't figure out how to use the various x_apply functions in this setting, nor post datasets to reproduce. But anyhow: the table structure is something like this: id (integer), handedness(R,L,A), gender(M,F), cat1(patient, control). cat2(stroke, MS, dement, control), accuracy(int

Re: [R] OOP and passing by value

2010-06-09 Thread michael meyer
Thanks to all replies. I was able to get it running with the R.oo package. I hope this reply makes it to the proper thread. Michael [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo

Re: [R] creating a new variable, conditional on the value of an existing variable, selected conditionally

2010-06-09 Thread Erik Iverson
Can your data.frame be properly coerced to a matrix like your example? If so, apply(f, 1, function(x) x[eval(x)["D"]]) Malcolm Fairbrother wrote: Dear all, I have a data frame f, with four variables: f <- data.frame(A=c(0,0,1,1), B=c(0,1,0,1), C=c(1,1,0,1), D=c(3,1,2,3)) f A B C D 1 0 0 1

Re: [R] for loop incremented by 0.01

2010-06-09 Thread Erik Iverson
not tested for(i in seq(0, 1, by = 0.01)) { print(i) } Read FAQ 7.31 though. suman dhara wrote: Sir, I want to use a for loop which will be incremented by 0.01 in 0 to 1. Please help. Regards, Suman Dhara [[alternative HTML version deleted]] __

[R] calibration and validation for svycoxph

2010-06-09 Thread R user
Hello, This post is for Dr. Thomas Lumley or anybody familiar with the survey package. I am estimating a proportional hazards model with weights using svycoxph. Are there functions already built in the survey package that allow me to do validation and calibration of the model? Thanks -- View t

[R] Dr. Hadley Wickham - Data Visualisation in R: Harnessing the power of ggplot2. London - November 2010

2010-06-09 Thread Sarah Lewis
Dr. Hadley Wickham - Data Visualisation in R: Harnessing the power of ggplot2 to produce elegant data graphics London: 1st - 2nd November 2010 Mango Solutions is delighted to offer a one-off 2 day training course with Dr. Hadley Wickham, R Project Data Visualisation Guru and creator of ggplot 2.

Re: [R] Issue with assigning text to matrix

2010-06-09 Thread Jessica Queree
Thanks for all your help. I found adding the 'stringsAsFactors' condition solved the problem. On 1 June 2010 17:09, Joris Meys wrote: > Hi Jessica, > > this tells me that your text is saved as a factor. > Try : > names <- read.csv(file="Names.csv",stringsAsFactors=F) > > > Cheers > Joris > > O

[R] creating a new variable, conditional on the value of an existing variable, selected conditionally

2010-06-09 Thread Malcolm Fairbrother
Dear all, I have a data frame f, with four variables: f <- data.frame(A=c(0,0,1,1), B=c(0,1,0,1), C=c(1,1,0,1), D=c(3,1,2,3)) f A B C D 1 0 0 1 3 2 0 1 1 1 3 1 0 0 2 4 1 1 1 3 I want to create a new variable (f$E), such that each of its elements is drawn from either f$A, f$B, or f$C, accordin

[R] passing local parameters to nls?

2010-06-09 Thread ivo welch
dear R wizards: environment-related programming question: myformula = y ~ a*x^2+b*x+c d= data.frame( x=rnorm(20), y=rnorm(20) ) cat("\nunconstrained works: \n"); nls( myformula, data=d, start=list(a=1, b=1, c=1), trace= TRUE) cat("\nconstrained works: \n"); b=1; nls( myformula, data=d, start=li

[R] for loop incremented by 0.01

2010-06-09 Thread suman dhara
Sir, I want to use a for loop which will be incremented by 0.01 in 0 to 1. Please help. Regards, Suman Dhara [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read t

[R] marginal structural models

2010-06-09 Thread moleps
Dear listers, Does anyone have any experience running marginal structural models in r or can point me in the direction of any good tutorials on this? Regards, //M __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEAS

[R] Calibration and validation for svycoxph

2010-06-09 Thread R user
Hello, This post is for Dr. Thomas Lumley or anybody familiar with the survey package. I am estimating a proportional hazards model with weights using svycoxph. Are there functions already built in the survey package that allow me to do validation and calibration of the model? Thanks -- View th

Re: [R] comparing two regression models with different dependent variable

2010-06-09 Thread Joris Meys
On Wed, Jun 9, 2010 at 5:19 PM, Or Duek wrote: > Hi, > I would like to compare to regression models - each model has a different > dependent variable. > The first model uses a number that represents the learning curve for reward. > The second model uses a number that represents the learning curve

Re: [R] generate list of variable names

2010-06-09 Thread Erik Iverson
Jon Erik Ween wrote: Hi! Would anyone know how to generate a list of variable names from a data frame by the class of the variable? a start... df <- data.frame(f1 = factor(1:10), f2 = factor(1:10), n1 = 1:10, n2 = 1:10) sapply(df, class)

[R] help for generating data from ar1 like model

2010-06-09 Thread li li
Hi all, I wrote the following function to generate data following a mixture-ar1 model. The model is described as below: theta is a m-vector with each entries identically and independent Bernoulli trials with success probability pi1. x is a m-vector with entries follow a ar1 mod

Re: [R] Draw text with a box surround in plot.

2010-06-09 Thread guox
Rectangle R centered at (x,y) with width 2w and height 2h is given by x1=x-w y1=y-h x2=x+w y2=y-h x3=x+w y3=y+h x4=x-w y4=y+h polygon(c(x1,x2,x3,x4),c(y1,y2,y3,y4)) Rotating a point (u,v) at (0,0) by theta degree is given by matrix [cos(theta),-sin(theta) sin(theta),cos(theta)] so we have a new

  1   2   >