[R] Use paste function to select column of data

2011-05-18 Thread John Poulsen
Hello, I want to build a function to call up a column of a data.frame by the names of the columns. I have column names that are sequentially named (col1, col2, etc.). How do I change a character expression into something that will be understood as a data.frame column. For example: example<

[R] Calling symbols from dataframe for xyplot

2011-02-10 Thread John Poulsen
Hello, I am trying to make a xyplot plot with points that are different symbols. I want to call the symbol type (pch) from a column in my dataframe. Here is a simplified example. In my real example I also have groups, which I have not included here. This example doesn't change the symbols or

[R] Error in R2Bugs

2010-08-10 Thread John Poulsen
01) b.s1~dnorm(0, 0.01) b.s2~dnorm(0, 0.01) b.s3~dnorm(0, 0.01) b.dcon~dnorm(0, 0.01) tau.ind~dunif(0,100) sigma.ind<-1/sqrt(tau.ind) tau.plt ~ dunif(0,100) sigma.plt<-1/sqrt(tau.plt) tau.sp ~ dunif(0,100) sigma.sp<-1/sqrt(tau.sp) tau ~ dunif(0,100) sigm

Re: [R] Plotting legend outside of multiple panels

2010-05-14 Thread John Poulsen
Patrick, Thanks for the tip below. It took me awhile to get to it, but your solution worked great. In case it is useful for other people, below is a very simple example where I create two plots side by side with the legend centered on top. John ## Example plot for R server par(mar=c

[R] Plotting legend outside of multiple panels

2010-05-03 Thread John Poulsen
Hello, I have used layout() to produce to 2 plots on a page, leaving a plotting space above them. I would like "Legend", which will actually be a real legend, to be centered above the two graphs. Right now I am only able to position "Legend" above the second graph that I create... obviously I

Re: [R] Looping until a solution is found

2009-05-30 Thread John Poulsen
Yes, it is wrapped around the code in mlefun, but could be changed... Thanks again, John. David Winsemius wrote: On May 30, 2009, at 9:36 AM, Uwe Ligges wrote: John Poulsen wrote: Hello, I am using maximum likelihood to find the best parameters for a model. This involves sometimes

[R] Looping until a solution is found

2009-05-30 Thread John Poulsen
Hello, I am using maximum likelihood to find the best parameters for a model. This involves sometimes tweaking the starting values to find a solution that converges. I would like to automate the process so that when the optimizer runs into an error it tweaks one of the parameters slightly,

[R] ade4 and inertia of axis 2

2009-05-10 Thread John Poulsen
Hello, Could someone please tell me how to find the estimate of inertia for the second axis of an RLQ analysis using ade4? Using the example from the ade4 package, I *suspect* that the inertia for the 2nd axis of the R table would be 4.139332 (see below results summary from rlq1). However, t

[R] ade4 and inertia of axis 2

2009-05-10 Thread John Poulsen
Hello, Could someone please tell me how to find the estimate of inertia for the second axis of an RLQ analysis using ade4? Using the example from the ade4 package, I *suspect* that the inertia for the 2nd axis of the R table would be 4.139332 (see below results summary from rlq1). However,

[R] Changing color of points in violin plot

2009-04-27 Thread John Poulsen
Hello, I am trying to graph a violin plot like the example in panel.violin(lattice) with the singer data - see below Does anyone know how to change the color of the boxplot on the graph from blue to green? I tried a number of changes, but to no avail. Thanks for your help, John bwplot(v

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

2009-03-28 Thread John Poulsen
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 that the non-zeros at

[R] Zero distance error in corSpatial - correlation structure using lme

2009-03-09 Thread John Poulsen
Hello, I am having a problem specifying the correlation structure in lme which leads to the error: Error in getCovariate.corSpatial(object, data = data) : Cannot have zero distances in "corSpatial". I have specified a grouping variable which is the only fix I could find by searching this err

Re: [R] c() coverts real numbers to integers?

2009-03-06 Thread John Poulsen
6.1498) > STY<-c(2.0387, 2.0214, 1.9877, 1.9846) > STX [1] 16.0962 16.1227 16.0921 16.1498 > STY [1] 2.0387 2.0214 1.9877 1.9846 Did you perhaps redefine c()? Or: options()$digits If not, then what do these say: str(STX) str(STY) On Mar 6, 2009, at 1:47 PM, John Poulsen wrote: I kn

[R] c() coverts real numbers to integers?

2009-03-06 Thread John Poulsen
Hello, I know I am forgetting to do something silly. I typed coordinates in vectors (as below) but when I call them in R they come out as integers, and I want them to be real numbers. I have tried using as.numeric, as.real, etc... but they are still read by R as integers. STX<-c(16.0962, 1

[R] c() coverts real numbers to integers?

2009-03-06 Thread John Poulsen
Hello, I know I am forgetting to do something silly. I typed coordinates in vectors (as below) but when I call them in R they come out as integers, and I want them to be real numbers. I have tried using as.numeric, as.real, etc... but they are still read by R as integers. STX<-c(16.0962, 16.12

[R] Advice on graphics to design circle with density-shaded sectors

2009-02-27 Thread John Poulsen
Hello, I am looking for some general advice on which graphics package to use to make a figure demonstrating my experimental design. I want to design a circle with 7 sectors inside. Then I will want to shade the sectors depending on densities of observations in the sectors. I will also want

[R] glmmBUGS: logistic regression on proportional data

2009-02-08 Thread John Poulsen
Hello, I am trying to run a logistic regression with random effects on proportional data in glmmBUGS. I am a newcomer to this package, and wondered if anyone could help me specify the model correctly. I am trying to specify the response variable, /yseed/, as # of successes out of total obse

Re: [R] plotting curve in xYplot -- using panel.curve

2009-01-24 Thread John Poulsen
bscripts, ...) { panel.xYplot(x, y, subscripts = subscripts, ...) panel.curve(a*(x+c)/(1+(a*(x+c)/b)), from=0, type="l", lwd=1, col="black") } xYplot(Cbind(y1, lo, hi)~jitter(sds, amount=1), method="bars",ylim=c(0,max(hi)+1), ylab="Y", xlab="X", panel

[R] plotting curve in xYplot -- using panel.curve

2009-01-23 Thread John Poulsen
Hello, I am trying to plot a curve over points plotted with se's in xYplot (see example below). I can get Figure 1 below to plot the data with error. However, I keep getting a the error message "Error using packet 1 object "y" not found" Can anyone see what I am doing wrong? Thanks! John

[R] Expanding data ...

2008-11-16 Thread John Poulsen
Hello, I have a dataset that has counts, but I need to expand the dataset so that each of the counts has its own line in the dataset (row) and is given and id. It looks something like: SiteTypeCnt 1 "A" 3 1 "B" 0 2 "C" 2 I want the dataset to look like: Site

Re: [R] Labeling points with xYplot

2008-11-10 Thread John Poulsen
,...) ltext(x=list(1,2,3,4), y=list(13,14,15,16), labels=list("A","B","C","D"), pos=2)}) --- David Winsemius, MD Heritage Labs comes with the usual warrantee... if it breaks you get to keep the parts On Nov 10, 2008, at 11:26

Re: [R] Labeling points with xYplot

2008-11-10 Thread John Poulsen
Yes, using panel.xYplot is the best thing to do. I couldn't get it to work, which probably means I was specifying it incorrectly. I would be very happy if someone had an example of how to do it. Thanks again -- John Frank E Harrell Jr wrote: John Poulsen wrote: Hello R-Users, I am t

[R] Labeling points with xYplot

2008-11-10 Thread John Poulsen
Hello R-Users, I am trying to label points on an xYplot. I can label the points, but then I lose the error bars. I suspect that I should be using panel.xYplot rather than panel.xyplot, but that didn't work either... Can anybody help me out? Example code is below. First xYplot has error b

[R] Changing colors and symbols in lattice

2008-11-01 Thread John Poulsen
Hello, I have made a plot using xYplot, but am having trouble with some final touching up details. I would appreciate your help... The below code results in a plot of 4 species, with the species being the same color. So, the first three points are blue, the second three are purple, etc...

[R] Error: C stack usage is too close to the limit

2008-10-27 Thread John Poulsen
Hello, Does anyone know in general what causes the following error: Error: C stack usage is too close to the limit I rewrote some R code that worked fine to be more streamlined, and now I get this error. I don't really know where to start to fix the problem. Thanks, John __

[R] Filling symbols in xyplot

2008-10-25 Thread John Poulsen
Hello, I am using xyplot and am happy with my graph, *except* that I cannot get the symbols to be filled. I tried using bg=c("red3","red","black","lightgrey")) in both the key and the xyplot function, that that was obviously not the answer. I would like the sybols to be filled with the same

[R] Removing characters and periods from character strings

2008-10-15 Thread John Poulsen
Hello R-users, I have code that gives me the important variables from an analysis. I need to input these variables into a different analysis. To do this, I need to modify them slightly... 1) remove all numbers at the end of the variables, 2) remove all periods. I tried to do it with the aw

[R] Problems and bugs in vgam()

2008-10-10 Thread John Poulsen
Hello R-Users, I have recently run into several problems using vgam() in the VGAM package. I am hoping someone might have some solutions... Briefly, I have been trying to fit GAM models for zero-altered negative binomial models. 1. When fitting smoothed parameters (e.g. s(X, df=2)) changin

[R] Beginner's question about vgam for zanegbinomial models

2008-10-03 Thread John Poulsen
Hello, I am just starting to use the vgam() function in VGAM to try to fit zero-altered negative binomial models. So far I have gotten some a test dataset to run, but can't seem to extract the log-likelihood. That is, I am using summary(fit)@df.residual to extract the residual df's, but can

[R] xYplot - plotting all factors

2008-09-24 Thread John Poulsen
Hello, Sorry, I have used xYplot before and feel like this should be a very easy problem to solve. But I keep hitting a snag. I want the below code to plot three panels with different point estimates and their standard errors for each of five days. I keep getting a warning message (see bel

[R] glmer -- extracting standard errors and other statistics

2008-09-21 Thread John Poulsen
Hello, I am using glmer() from lmer(lme4) to run generalized linear mixed models. However, I am having a problem extracting the standard errors for the fixed effects. I have used: summary(model)$coef fixed.effects(model) coef(model) to get out the parameter estimates, but do not seem able

[R] Jitter in xYplot?

2008-08-18 Thread John Poulsen
Hello, The simple example below plots three species by year and site. However, I would like the points to occur in groups horizontally, rather than on top of each other. I thought jitter might work, but haven't been successful in getting it to do what I want. Any ideas? Thanks in advanc

[R] Finishing details of dotplot

2008-08-12 Thread John Poulsen
Hello, I am trying to create a dotplot, and have run into a couple of snags with the finishing details. The below code creates the dotplot, but I cannot figure out how to: 1) change the color of the CI bars to black, not blue, 2) delete the horizontal dotplot lines, and 3) arrange the parame

Re: [R] Labeling lines in xyplot

2008-08-05 Thread John Poulsen
Deepayan, Thanks for your help, works great! Cheers -- John Deepayan Sarkar wrote: On Tue, Aug 5, 2008 at 11:15 AM, John Poulsen <[EMAIL PROTECTED]> wrote: Hello, I apologize in advance as this example seems really elementary. Below I have created a simple scatterplot with lines. I

[R] Labeling lines in xyplot

2008-08-05 Thread John Poulsen
Hello, I apologize in advance as this example seems really elementary. Below I have created a simple scatterplot with lines. I would like to label each line with the name of the village, instead of using a legend. Can someone please let me know how to do it. Thanks in advance -- John Po

[R] GAM hurdle models

2008-06-05 Thread John Poulsen
Hello, I have been using mgcv to run GAM hurdle models, analyzing presence/absence data with GAM logistic regressions, and then analyzing the data conditional on presence (e.g. without samples with no zeros) with GAMs with a negative binomial distribution. It occurs to me that using the nega

Re: [R] Plotting points on line graphs using xYplot in Hmisc

2008-05-09 Thread John Poulsen
Hello Deepayan, Please ignore my last e-mail and question. The information was easily found in ?panel.segments. Thanks, John On 5/5/08, John Poulsen <[EMAIL PROTECTED]> wrote: > > > Hello, > > I am using xYplot to plot lines with confidence bands (see test examp

Re: [R] Plotting points on line graphs using xYplot in Hmisc

2008-05-09 Thread John Poulsen
Hello Deepayan, Thanks for the below solution to my graphing problem - just what I was looking for. One quick additional question, where do I change graphical settings (lwd, pch, etc...) for the added points? Thanks, John On 5/5/08, John Poulsen <[EMAIL PROTECTED]> wrote: > &

[R] Plotting points on line graphs using xYplot in Hmisc

2008-05-05 Thread John Poulsen
ot;, method="filled bands", col.fill="light grey", scales=list(y=list(relation="free"),x=list(alternating=c(1,1,1))), ylim=list(c(0,1200),c(0,1)), strip=strip.custom(factor.levels=c(expression("Anls km"^2),expression("Plants km"^2)

Re: [R] Adding text to strip in xYplot

2008-04-09 Thread John Poulsen
Hello Christoph, Oops, I see that the factor.levels function is in the help menu for strip.default. I had tried it, but not specified it correctly. Thanks again for you help, John Christoph Meyer wrote: > Hi John, > > a solution to your problem would be using strip.custom like this: > > ...

[R] Adding text to strip in xYplot

2008-04-09 Thread John Poulsen
Hello again, I have been trying to add an expression to the strips in xYplot to no avail. For example, in the code below, the text in the strips for each panel is "Anls" and "Plts". However, I would like it to add "Anls km^2" and "Plants km^2" with the exponents raised. I tried resetting the

[R] Separate y-limits in xYplot panels II

2008-04-08 Thread John Poulsen
Hello, I have been trying to use xYplot in Hmisc to graph plots, allowing each panel to have a y-axis dependent on the data in the panel. Following the advice from the R-Help list, message: [R] separate y-limits in xYplot panels on Wed, 30 May 2007 08:12:06 -0700 (PDT), I used scales=list(y=list(

[R] Separate y-limits in xYplot panels II

2008-04-08 Thread John Poulsen
Hello, I have been trying to use xYplot in Hmisc to graph plots, allowing each panel to have a y-axis dependent on the data in the panel. Following the advice from the R-Help list, message: [R] separate y-limits in xYplot panels on Wed, 30 May 2007 08:12:06 -0700 (PDT), I used scales=list(y=li