Re: [R] Is there an lm() equivalent of panel.lmline()?

2012-10-30 Thread Greg Snow
You can use the lmList function in the nlme package to do several seperate regressions, or use a model that allows for multiple intercepts. Possibly Xvalues ~ 0 + log(Qvalues)*Tfac or Xvalues ~ 0 + Tfac + log(Qvalues):Tfac (assuming Tfac is a factor). On Tue, Oct 30, 2012 at 5:53 AM, Alex van der

Re: [R] error in lm

2012-10-30 Thread Greg Snow
First your response in the formula is a matrix which causes the lm function to return an object of type 'mlm' for multivariate linear model. Then when you run the stepAIC function it runs the addterm function which looks for a method(function) to add terms to mlm objects. However nobody has writt

Re: [R] daylight

2012-10-24 Thread Greg Snow
Do you care about local topography/terrain? I think most of the calculators/tables that are commonly used assume that you are at a fairly flat place on the earth's surface, but that is not always true. The area where my wife grew up had its longest day closer to the equinox than the summer solsti

Re: [R] Creating a polygon from an unordered set of points

2012-10-23 Thread Greg Snow
One possibility: Estimate the center of the polygon with the mean of the x coords and the mean of the y coords. Calculate the angle of each point from that center point using the atan2 function sort the data by the angle calculated. This will not be perfect if you have inlets and peninsulas, but

Re: [R] how can I make a legend that applies for all the barplots in one same page?

2012-10-19 Thread Greg Snow
First of all, in the command par(xpd=F), what is the value of F? If it is the default value of FALSE then that says to not plot anything outside of the plot region, so any attempts to put a legend in the outer margin will not plot anything. if F is TRUE (which is a recipe for disaster) then you c

Re: [R] Help with

2012-10-18 Thread Greg Snow
Another option would be to read the data using read.table or similar to get the data into a data frame then use the xtabs function, something like: result <- xtabs( count ~ docID + wordID, data=mydf) On Thu, Oct 18, 2012 at 6:44 AM, Rui Esteves wrote: > Hi, > > I downloaded a dataset from UCI

Re: [R] Getting a table of coefficients from R

2012-10-18 Thread Greg Snow
You have a list of models, the coef and confint functions only work on a single model, so you need to use lapply or sapply to get the information from each model. Possibly something like (untested): tableOfOddsRatios <- sapply( models, function(x) exp(c( coef(x)[2], confint(x)[2,]) ) I included

Re: [R] legend of maps generated by function symbols

2012-10-18 Thread Greg Snow
Possible? Yes. (see fortune("Yoda")) Automated using the legend function? No Automated using another function? possbly somewhere in the 4,000+ packages on CRAN, but I don't know which. It is doable with the basic tools. You could either find a part of your graph with open area to put the legend i

Re: [R] z.test for dataframe

2012-10-17 Thread Greg Snow
Rui answered the main question by pointing out that you need z.test(m, stdev=s(m)), or you could use z.test(m,,sd(m)), but I think the stdev= approach is clearer. But you are really abusing the concept of z tests in general (and the z.test function in particular) by using the sd of the sample. If

Re: [R] dynamic plots

2012-10-17 Thread Greg Snow
It should be able to be done. You would first need the data and be able to create the static version of the plot. Then write a function that will create the static version of the plot with some way (argument passed in) to add a highlighted line. Then it is just a matter of figuring out which lin

Re: [R] plots for presentation

2012-10-12 Thread Greg Snow
Duncan's answer is probably the easiest, but another alternative is to use the tikz device instead of .eps files, then you can find the code within the figure for the parts that you want to appear later and enclose them in the beamer commands that will make them appear later. Unfortunately this is

Re: [R] package request

2012-10-10 Thread Greg Snow
There are packages for big data analysis, which is best depends on what you want to do. The High Performance Computing task view on CRAN has a section on packages that deal with big data which gives some more detail and may help you choose which package(s) to use. On Wed, Oct 10, 2012 at 12:36 AM

Re: [R] RMySQL install on windows

2012-10-10 Thread Greg Snow
I finally was able to compile/load it under windows 7. I had similar problems to what you show below. I set the MYSQL_HOME environmental variable through windows (start button > control panel > System and Security > system > Advanced System Settings > Environmental variables). I had to set it to

Re: [R] synthetic distribution built upon set of discrete values

2012-10-10 Thread Greg Snow
In addition to Bert's answer. If the 0 and/or 100 are hard boundaries (you know that values cannot be outside those values) and you have data points near one or both of the bounds, then the functions in the logspline package may be of use. On Tue, Oct 9, 2012 at 2:38 PM, Bert Gunter wrote: > ??

Re: [R] plot.new() and grid functions in multipage pdfs

2012-10-09 Thread Greg Snow
The plot.new function is for base graphics and base and grid graphics don't usually play well together. You probably want to use grid.newpage function instead. On Tue, Oct 9, 2012 at 1:26 PM, Ali Tofigh wrote: > Hi, > > when using the grid package, I've come across this weird behaviour > where a

Re: [R] BCA Package

2012-10-05 Thread Greg Snow
Kokila, Note that the quality of replies on this mailing list tend to correlate with the quality of the questions. Follow the advice found in the last 2 lines of this (and all) message and ask a better question and you are more likely to get a better reply. On Fri, Oct 5, 2012 at 5:53 AM, kokila

Re: [R] barplot with some 0 frequencies

2012-10-05 Thread Greg Snow
Others have shown barchart commands that include 0's. My guess (which could be wrong, feel free to ignore this e-mail if so) is that your problem is due to the way you are creating/summarizing the data before the plotting command is used. R needs some way to know about what bars you want, even if

Re: [R] convert multi dimensional array to list

2012-10-05 Thread Greg Snow
See fortune("toad") for a bit more on this concept. On Thu, Oct 4, 2012 at 3:19 PM, David Winsemius wrote: > > On Oct 4, 2012, at 8:57 AM, anto.r wrote: > >> Hi Michael >> >> thanks! That was the option if I kept it an array. The list format with $ >> sign since it leaves me feeling that the name

Re: [R] predict.lm if regression vector is longer than predicton vector

2012-10-03 Thread Greg Snow
The most common case that I see that error is when someone fits their model using syntax like: fit <- lm( mydata$y ~ mydata$x ) instead of the preferred method: fit <- lm( y ~ x, data=mydata ) The fix (if this is what you did and why you are getting the error) is to not use the first way and in

Re: [R] Having two different versions of a package in the same R installation

2012-10-02 Thread Greg Snow
So if you have both loaded in the same instance of R, how will R know which version of lmer or other functions that you want to run? It seems cleanest to me to have the 2 different instances of R running like you do now. The other option would be to change all the names (exported ones anyways) in

Re: [R] Proposal: Package update log

2012-10-02 Thread Greg Snow
There is already support in the packaging system for a NEWS file which can be accessed within R using the 'news' function. What would the changelog that you are proposing contribute or contain beyond what the NEWS file already does? Creating and updating NEWS is not mandatory, but is encouraged.

Re: [R] calculating probability from the density function

2012-10-01 Thread Greg Snow
You may find it easier to use the logspline density fits (logspline package) rather than the kernel density estimators for this. On Mon, Oct 1, 2012 at 7:46 AM, Eugene Kanshin wrote: > Hello, > I have a data x with normal (or very close to normal) distribution, I can > plot a density distribution

Re: [R] Plotting of regsubsets adjr2 values not correct

2012-09-26 Thread Greg Snow
Does your dataset have any missing data? (without a reproducible example we can only guess). If it does then you may be fitting the same model to different subsets of the data between the 2 methods. On Tue, Sep 25, 2012 at 9:03 AM, Maximilian Lklweryc wrote: > Hi, > I want to make model selectio

Re: [R] add lowess predicted line to scatter plot

2012-09-24 Thread Greg Snow
Is GNI sorted? if not then the lines function plots the line segments to the points in the order given and that would explain part of the strangeness (the png file did not make it through). Are there gaps between the GNI values? even if GNI is sorted, your code below will just draw line segments

Re: [R] Line over Boxplot

2012-09-20 Thread Greg Snow
I expect that the coordinate system being set up and used by boxplot is different from what you are expecting. See the ?boxplot and ?bxp help pages for details. You may be able to have the boxplots drawn where you expect by using the "at" argument (you may want to specify "xlim" as well). On Thu

Re: [R] Why x[1] is not getting substituted?

2012-09-19 Thread Greg Snow
I nominate Jim's answer below for the fortunes package. On Wed, Sep 19, 2012 at 3:50 AM, Jim Lemon wrote: > Sri krishna Devarayalu Balanagu wrote: >> >> >> Suppose I want the output as "Trial and a sheet" without quotes >> x=c("a", "b", "c") >> print("Trial and x[1] sheet") >> >> Getting "Tr

Re: [R] Why x[1] is not getting substituted?

2012-09-18 Thread Greg Snow
In addition to Jessica's answers try sprintf("Trial and %s sheet", x[1]) library(gsubfn) fn$cat("Trial and `x[1]` sheet\n") On Tue, Sep 18, 2012 at 8:42 AM, Jessica Streicher wrote: >> paste("Trial and",x[1],"sheet") > [1] "Trial and a sheet" >> cat("Trial and",x[1],"sheet") > Trial and a sheet

Re: [R] Lowest AIC after stepAIC can be lowered by manual reduction of variables

2012-09-18 Thread Greg Snow
Do you understand what you did (not the individual steps, but what the overall process does)? You simplified your model using things other than the AIC, if you go back and look at the AIC at each step that you did you will probably find that some of the intermediate steps actually had a slightly h

Re: [R] ctrl+r does not work sometimes

2012-09-14 Thread Greg Snow
I can confirm that I have this problem occasionally as well (windows 7 laptop), I see it more often when clicking the button in the GUI that does the same as ctrl-R. Here is my sessionInfo: R version 2.15.1 (2012-06-22) Platform: x86_64-pc-mingw32/x64 (64-bit) locale: [1] LC_COLLATE=English_Unit

Re: [R] Plotting every probability curve

2012-09-12 Thread Greg Snow
Thanks for including an example that could be copied and pasted. However TkPredict and Predict.Plot both need at least one numeric (not factor) predictor. So I added another column called x that was just 1:5 to the sample data frame and included it in the model. Here are a couple of approaches us

Re: [R] method or package to make special boxplot

2012-09-08 Thread Greg Snow
The symbols function allows you to place boxplot symbols at specified x,y coordinates. Would that do what you want? On Sat, Sep 8, 2012 at 8:14 AM, Zhang Qintao wrote: > Hi, All, > > I am trying to use R to make the following type of boxplot while I couldn't > find a way to do it. > > My dataset

Re: [R] No room for labels in barplot

2012-09-06 Thread Greg Snow
Look at the staxlab function in the plotrix package. On Thu, Sep 6, 2012 at 12:03 PM, David-Arnold wrote: > All, > > I have: > > sales <- c(2300,900,155,102,42,10) > names(sales) <- c("Christmas","Valentine's Day", >"Mother's Day","Father's Day", >"Thanksgiving","New Year'

Re: [R] how to find the index of points selected from a scatter plot?

2012-09-03 Thread Greg Snow
I would be very surprised if the x value from locator matched the x value in the data to the precision needed by ==, and what if 2 points have the same x-value but different y-values, you would need to also check the y's. With appropriate rounding this would work, but would just be reinventing the

Re: [R] Help on Plot Title where text is "mixed" with numerical carachters

2012-08-30 Thread Greg Snow
Look at the sprintf and paste functions (either one will do what you describe). On Thu, Aug 30, 2012 at 7:49 AM, Andras Farkas wrote: > Dear All, > > I have the following code set up: > > x <-2000 > y <-8 > z <-3 > > I would need to use these numbers to show up in my plot title "mixed" with > te

Re: [R] Create and Assign value into a variable from Another variable

2012-08-28 Thread Greg Snow
Others have mentioned assign and get, but generally when the answer to a question is "assign" it means that you are asking the wrong question (see fortune(236)). This is actually FAQ 7.21, the most useful part of the answer in the FAQ is the last few lines. If you tell us more about what you are

Re: [R] Is there a data/variable explorer in R?

2012-08-22 Thread Greg Snow
Look at the TkListView function in the TeachingDemos package. On Wed, Aug 22, 2012 at 1:30 PM, Michael wrote: > Is there a data/variable explorer in R? > > Hi all, > > I am inspecting a complex variable which has lists inside lists... > > Is there a data-explorer that can help me view the structu

Re: [R] Barplot with Secondary axis

2012-08-22 Thread Greg Snow
Using par(new=TRUE) will often cause more problems than it helps. A better approach would be to use the twoord.plot function from the plotrix package or to use the updateusr function from the TeachingDemos package along with the lines function to add the lines afterwards. On Wed, Aug 22, 2012 at

Re: [R] What makes R different from other programming languages?

2012-08-20 Thread Greg Snow
I think the big unique thing about R is that it is both an interactive environment and a programming language. A new user can start it, enter some data, and compute same basic statics without ever "programming". A more advanced user can write their own function to automate common procedures or im

Re: [R] Colour gradients and colour fill between points

2012-08-20 Thread Greg Snow
The akima package does interpolation and there are probably others as well. You could also fit a parametric, semi-parametric, or local model to the observed data and use the predicted values from the model for the interpolations (see the loess function for one option that might work well for you).

Re: [R] Reference a variable inside a string and another for object assingments

2012-08-16 Thread Greg Snow
Perhaps the sprintf function is what you are looking for. It is one way to insert information from a variable into a string. A couple of other options are paste, paste0, and the gsubfn package, but I think sprintf will be simplest for what you are asking. On Thu, Aug 16, 2012 at 1:30 PM, Kenneth

Re: [R] Big Data reading subsample csv

2012-08-16 Thread Greg Snow
The read.csv.sql function in the sqldf package may make this approach quite simple. On Thu, Aug 16, 2012 at 10:12 AM, jim holtman wrote: > Why not put this into a database, and then you can easily extract the > records you want specifying the record numbers. You play the one time > expense of cr

Re: [R] legend position help

2012-08-16 Thread Greg Snow
s not plot the legend, but gives you the information that you can use to create the legend yourself (and could therefore move the pieces that you want moved). On Wed, Aug 15, 2012 at 8:05 PM, Jinsong Zhao wrote: > On 2012-08-16 0:22, Greg Snow wrote: >> >> You can use the grconv

Re: [R] shade overlapping portions of circles (or other shapes)

2012-08-15 Thread Greg Snow
A quick and simple way would be to fill both circles with a semi-transparent color (does not work on all devices), then the overlapping area will will show up as a different color/shade due to the alpha blending. You might want to redraw the circles without fill after the filled ones so that the 1

Re: [R] legend position help

2012-08-15 Thread Greg Snow
You can use the grconvertY function to find the position in the current user coordinates that corresponds to the top of the device area (instead of using locator). Look at the "merge" argument to the legend function. On Wed, Aug 15, 2012 at 10:04 AM, Jinsong Zhao wrote: > Hi there, > > I draw a

Re: [R] Fill pattern for Boxplots?

2012-08-11 Thread Greg Snow
The fill patterns date back to when the main way to get quality graphs was using a pen plotter. Filling a rectangle with color using a pen plotter took a long time and often resulted a soggy hole in the paper, so the fill lines were preferred back then. Now with high resolution screens and printe

Re: [R] All combinations possible in a mutliple regression

2012-08-11 Thread Greg Snow
Look at the leaps function in the leaps package. It will compute the Cp statistic which is a function of AIC. On Thu, Aug 9, 2012 at 7:28 AM, zel7223 wrote: > Hi, > > I want to use four independent variables to predict the output of one > dependent variable using a linear model lm. I want to com

Re: [R] Problem with global variable building a package

2012-08-07 Thread Greg Snow
Probably the best thing to do is create an environment within the package that you can assign to and read from. Somewhere in the source code for the package include a line like: my.env <- new.env() then within any functions defined after that line you can set variables within the environment wit

Re: [R] MANOVA polynomial contrasts

2012-07-24 Thread Greg Snow
You should not need to write them yourself. Look at the contr.poly function along with the C function (Note uppercase C) or the contrasts function. On Monday, July 23, 2012, Manzoni, GianMauro wrote: > Dear all, > I am quite new to R and I am having trouble writing the polynomial > contrasts for

Re: [R] EM for missing data

2012-07-21 Thread Greg Snow
The EM algorithm does not impute missing data, rather it estimates parameters when you have missing data (those parameters can then be used to impute the missing values, but that is separate from the EM algorithm). If you create a dataset that has missing values imputed (a single time) and then an

Re: [R] Entering Data Files

2012-07-18 Thread Greg Snow
For reading data into R you should start with http://cran.r-project.org/doc/manuals/R-data.html (or the local copy that was installed with R on your machine). For the example above the read.table function should be fine. If you want to change the shape of the resulting data frame then look at the

Re: [R] Table/Frame - output

2012-07-17 Thread Greg Snow
There are functions that allow for the "plotting" of text and R objects that could be used to plot to a bitmap. Look at the 'addtable2plot' function in the plotrix package and the textplot function in the gplots package (look for alternative spellings if you don't find them based on those exact sp

Re: [R] Power analysis for Cox regression with a time-varying covariate

2012-07-17 Thread Greg Snow
where that takes me. > > Paul > > --- On *Fri, 7/13/12, Greg Snow <538...@gmail.com>* wrote: > > > From: Greg Snow <538...@gmail.com> > Subject: Re: [R] Power analysis for Cox regression with a time-varying > covariate > To: "Paul Miller" > Cc:

Re: [R] significance test interquartile ranges

2012-07-13 Thread Greg Snow
A permutation test may be appropriate: 1. compute the ratio of the 2 IQR values (or other comparison of interest) 2. combine the data from the 2 samples into 1 pool, then randomly split into 2 groups (matching sample sizes of original) and compute the ratio of the IQR values for the 2 new samples.

Re: [R] Power analysis for Cox regression with a time-varying covariate

2012-07-13 Thread Greg Snow
For something like this the best (and possibly only reasonable) option is to use simulation. I have posted on the general steps for using simulation for power studies in this list and elsewhere before, but probably never with coxph. The general steps still hold, but the complicated part here will

Re: [R] Computing inverse cdf (quantile function) from a KDE

2012-07-12 Thread Greg Snow
If you are going to be doing a lot of this then you might want to consider using logspline density estimates (logspline package) instead of kernel density estimates. On Wed, Jul 11, 2012 at 8:33 AM, firdaus.janoos wrote: > Hello, > > I wanted to know if there is a simple way of getting the invers

Re: [R] How to add marker in Stacked bar plot?

2012-07-12 Thread Greg Snow
If you want something other than an arrow (or an arrow that looks different from those produced by the arrows function) then look at the my.symbols function in the TeachingDemos package. On Mon, Jul 9, 2012 at 9:37 PM, Manish Gupta wrote: > Hi, > I am working on stacked bar plot and want to add m

Re: [R] How to use external image with R plot?

2012-07-12 Thread Greg Snow
You can use the locator function to retrieve the user coordinates of a point that you click on in the plot, then use those points with rasterImage to add the image. So replace the last 2 lines of Michael's answer with something like: > barplot(VADeaths, border = "dark blue") > tmp <- locator(1) >

Re: [R] is it possible to insert a figure into into another new figure by r script

2012-07-12 Thread Greg Snow
You could read the .png (or some other formats) in then use the rasterImage function to put that into the current plot. On Mon, Jul 9, 2012 at 8:25 PM, Jie Tang wrote: > hi R-users >Now I have a figure in emf or png or tiff format that have been drawn > by other tool and I want to insert thi

Re: [R] Plotting the probability curve from a logit model with 10 predictors

2012-07-07 Thread Greg Snow
Try the following: library(TeachingDemos) ?TkPredict fit.glm1 <- glm( Species=='virginica' ~ Sepal.Width+Sepal.Length, data=iris, family=binomial) TkPredict(fit.glm1) (you may need to install the TeachingDemos package first if you don't already have it installed) You

Re: [R] Plotting the probability curve from a logit model with 10 predictors

2012-07-06 Thread Greg Snow
Look at the Predict.Plot and TkPredict functions in the TeachingDemos package. These will not plot all 11 dimensions at once, but will plot 2 of the dimensions conditioned on the others. You can then change the conditioning to see relationships. These use base rather than ggplot graphics. On Th

Re: [R] How to generate a correlated binary data set?

2012-07-04 Thread Greg Snow
A simple approach is to generate correlated normal data (mvrnorm function in MASS package is one way), then use a cut-off to convert them to binary. On Wed, Jul 4, 2012 at 12:25 PM, Soyeon Kim wrote: > Hi. > I am trying to generate a correlated binary data set. > I've tried to use mvtBinaryEP, bi

Re: [R] Printing from R Console in colour

2012-07-04 Thread Greg Snow
As has been mentioned, the windows GUI will not do this for you, but here are some options. You can save or copy the transcript file and load it into an R syntax aware editor (e.g. emacs with ess and others) which will do the coloring/formatting for you and may be able to print with the coloring.

Re: [R] loop in list

2012-06-30 Thread Greg Snow
Instead of a loop you can use the replicate or lapply functions which will create lists for you. otherwise you can start with an empty list (mylist <- list() ) then add to the list in each iteration of the loop: for(i in 1:10) { mylist[[i]] <- myfunction(i) } On Sat, Jun 30, 2012 at 1:34

Re: [R] plot background - excel gradient style background ?

2012-06-30 Thread Greg Snow
Here are examples of a histogram and a boxplot using rasterImage to make the background: bg <- matrix( c('#ff','#ff','#ff'), ncol=1 ) tmp <- hist(iris$Sepal.Width) xylim <- par('usr') rasterImage(bg, xylim[1], xylim[3], xylim[2], xylim[4]) plot(tmp, add=TRUE, lwd=3) plot( Petal.Le

Re: [R] turning R expressions into functions?

2012-06-30 Thread Greg Snow
Look at the replicate function, it takes an expression (does not need a function) and runs that expression the specified number of times. Will that accomplish what you want without needing to worry about substitute, quote, eval, etc.? On Fri, Jun 29, 2012 at 11:36 AM, Jochen Voß wrote: > [ please

Re: [R] How to defeat buffering in Rgui? (was: Re: Printing a variable in a loop)

2012-06-29 Thread Greg Snow
In the R gui for windows you can turn off buffering with cntrl-w or through one of the menus, but for more general solutions you should look at: ?flush.console ?winProgressBar or ?tcltk::tkProgressBar or ?txtProgressBar On Fri, Jun 29, 2012 at 1:01 AM, Spencer Graves wrote: > Hello, All: > > >

Re: [R] survfit function

2012-06-28 Thread Greg Snow
Try: survfit(Surv(Time, 1-Status)~1) On Wed, Jun 27, 2012 at 5:37 AM, niloo javan wrote: > > > Hello > > In (survfit(Surv(Time,Status)~1)) > > I want to have status=0 as Failure and status=1 as Censore. > > Changing above formula to (survfit(Surv(Time,Status)~0)) doesnot help!! > What should i do

Re: [R] density function

2012-06-27 Thread Greg Snow
Here are 2 approaches: Use logspline density estimates (logspline package) rather than kernel density estimates, this can give you a function to pass to integrate or other tools, the estimates may be a little different from the kernel density estimates. If you need to use kernel density estimates

Re: [R] Plotting tidal speed and direction in R

2012-06-20 Thread Greg Snow
You can use the 'my.symbols' and 'ms.arrows' functions in the TeachingDemos package to plot arrows at given locations with specified angles, lengths, and colors. On Sat, Jun 16, 2012 at 5:16 AM, zoeita wrote: > Hi, > > I have had a look around the forums and I can't seem to find anything that > w

Re: [R] String Manipulation in R

2012-06-12 Thread Greg Snow
Or use 'fixed=TRUE' as an argument to grepl to avoid the regular expression matching (but learning regular expressions will be a useful tool in the long run). On Tue, Jun 12, 2012 at 9:15 AM, Jeff Newmiller wrote: > ?grepl > > Note that this function uses regular expressions, in which certain cha

Re: [R] Rotating characters in text

2012-06-12 Thread Greg Snow
If you insert `\n` between each letter, then it should do what you want with a single call to text or mtext. To expand on David's example: plot(1:10) text(5,5, paste( strsplit(txvec, ''), collapse='\n') ) On Tue, Jun 12, 2012 at 10:16 AM, David Winsemius wrote: > > On Jun 12, 2012, at 9:49 AM

Re: [R] How do I obtain the current active path of a function that's being called?

2012-06-07 Thread Greg Snow
Wow, even those of us who have been using S for more than 25 years (and R since well before version 1.0) still have things to learn since R keeps improving. So I stand corrected (well sit actually) on the part about not keeping track of this sort of thing. On Thu, Jun 7, 2012 at 3:04 AM, Duncan M

Re: [R] non ascill characters in plots. no alternative but plotmath?

2012-06-07 Thread Greg Snow
I think the problem is with fonts and encodings. The pdf device is using a different font and/or encoding than the screen device and so the non-ascii characters are looking different. If you can convince the pdf driver to use the same font and encoding then the symbols/characters in the plot shou

Re: [R] How do I obtain the current active path of a function that's being called?

2012-06-05 Thread Greg Snow
You can use the debug, fix, or edit functions to insert break points into the version of the function in memory without needing to edit the original source code. On Tue, Jun 5, 2012 at 5:51 PM, Michael wrote: > Thanks so much for your help! > > I'd like but however I couldn't provide the code sin

Re: [R] How do I obtain the current active path of a function that's being called?

2012-06-05 Thread Greg Snow
There are several ways that a function can come into being within R, it can be sourced from a file like in your case, but it could also be typed in by hand at the command prompt, or created by another function, etc. So R does not in general keep links to the files from which the file was generated

Re: [R] plot background - excel gradient style background ?

2012-06-05 Thread Greg Snow
Well that answers the question as answer. So while you are working within the system to get your company to change the policy you can use rasterImage to add a gradient background to the plot, then use points or lines or other functions to put the parts of interest back on top of the gradient (if i

Re: [R] Non-linear curve fitting (nls): starting point and quality of fit

2012-06-05 Thread Greg Snow
One thing to note is that there are more than one model that can be called exponential. Two of the common ones are: y = exp( a + b*x + error ) y = exp( a + b*x ) + error The common way to fit the first is to take the log of both sides and just fit a linear model with log(y), I expect (but am not

Re: [R] Determining frequency and period of a wave

2012-06-02 Thread Greg Snow
You could use the 'nls' function to fit a sine (or cosine) function to the data. On Fri, Jun 1, 2012 at 7:54 PM, Aaron Patterson wrote: > Hello!  I'm collecting data on a refrigerator that I'm using to cure > meat.  Specifically I am collection humidity and temperature readings. > The temperature

Re: [R] plot background - excel gradient style background ?

2012-06-02 Thread Greg Snow
The short answer is "yes". The question as answer is "what is wrong with your data that you feel the need to hide/distort information and distract from the story of the data?". The hopefully thought provoking answer is "fortune(197)". The answer to the question not asked that should have been is

Re: [R] print.data.frame to string?

2012-05-31 Thread Greg Snow
What do you mean by prints? You can use capture.output to get what would regularly be printed to the screen into a text vector, or use dput to get a version of an object that could be read back into another R session. On Thu, May 31, 2012 at 2:10 PM, ivo welch wrote: > dear R experts---is there

Re: [R] Customized R Regression Output?

2012-05-30 Thread Greg Snow
Are the x variables all the same? if so, you can give lm a matrix as the y variable and it will compute all the different regressions for each column in the y matrix. The summary function will then return a list with the summary information for each of the regressions. If the x variables are not

Re: [R] How to assign height value on bar plot?

2012-05-26 Thread Greg Snow
Did you look at the help page that Uwe directed you to? At least one of the examples on that page demonstrates adding text to a barplot. But before you do that you should read through the discussion here: http://tolstoy.newcastle.edu.au/R/e2/help/07/08/22858.html on why you might not want to add t

Re: [R] use list as function arguments

2012-05-24 Thread Greg Snow
?do.call On Thu, May 24, 2012 at 9:32 AM, Alexander Shenkin wrote: > Hello Folks, > > Is there any way to pass a list into a function such that the function > will use the list as its arguments?  I haven't been able to figure that out. > > The background: I'm trying to build a function that will

Re: [R] applying cbind (or any function) across all components in a list

2012-05-24 Thread Greg Snow
The "do.call" function may be what you want, but it is not completely clear. If that does not solve your problem then try giving us an example of what your list looks like (the dput function can help) and what you want your end result to look like. On Thu, May 24, 2012 at 5:38 AM, Hans Thompson

Re: [R] set tkscale by tkentry

2012-05-24 Thread Greg Snow
I believe that what is happening is that when you try to edit the entry widget any intermediate values get sent to the slider widget which then checks to see if they are in the allowable range and if it is not then it sets the value to either the minimum and maximum and sends that back to the entry

Re: [R] Distances between countries package?

2012-05-23 Thread Greg Snow
This depends on what you mean by "distance between the 2 countries". Do you want the shortest distance from a point on the border of each country? The distance from the one capitol to the other? Distance between centroids? Weighted distance based on population distributions? Etc. Do you want grea

Re: [R] Menus - best practices?

2012-05-22 Thread Greg Snow
The tkexamp function in the TeachingDemos package can be used to create a tcltk based GUI for your own functions. On Fri, May 18, 2012 at 5:45 PM, Noah Silverman wrote: > Hello, > > I need to design a fairly simple front-end for someone to use an R script > system that I've built.  My thought wa

Re: [R] Optimization problem

2012-05-16 Thread Greg Snow
There are a couple of options. First if you want the mean to equal 7, then that means the sum must equal 21 and therefore you can let optim only play with 2 of the variables, then set the 3rd to be 21-s1-s2. If you want the mean to be greater than 7 then just put in a test, if the mean is less th

Re: [R] Multiple regression Categorical data

2012-05-11 Thread Greg Snow
?contr.sum On Fri, May 11, 2012 at 8:13 AM, Rosario Garcia Gil wrote: > Hello > > It is possible to set up an lm() model where none of the categories of the > categorical independent variable need to be used as references, I mean use > the total mean instead. > > Thanks > /R > _

Re: [R] How to import .accda database into R

2012-05-09 Thread Greg Snow
The phrase "doesn't work" does not do much to help us help you, see: https://stat.ethz.ch/pipermail/r-help/2012-April/311074.html Also if you don't tell us what you have tried (and how the results differed from what you want) then we have no way of knowing if you have already tried our first sugge

Re: [R] Exporting plots generated by a 'for' loop

2012-04-30 Thread Greg Snow
A couple of things that I did not see mentioned by the others: Generally statistics plots work better in .png files than in .jpg files due to the type of compression each uses (detailed image plots and some surface plots may be the exception), though that may be out of your control (some journals

Re: [R] R2HTML output shows NULL

2012-04-28 Thread Greg Snow
t 2:52 PM, Greg Snow <538...@gmail.com> wrote: >> Jeff, there are also many times that people are told not to post HTML, >> so this case would be a bit of a Catch 22.  Also some of us (well me >> at least, I expect others have as well) have experienced this already >> a

Re: [R] R2HTML output shows NULL

2012-04-27 Thread Greg Snow
Jeff, there are also many times that people are told not to post HTML, so this case would be a bit of a Catch 22. Also some of us (well me at least, I expect others have as well) have experienced this already and fully understand what is being discussed without needing an example (and for this cas

Re: [R] How to test if a slope is different than 1?

2012-04-26 Thread Greg Snow
ferent from 1.0, right? > > If I may ask one more question: could I use the offset to test if the slope > of 0.56 is different from yet another value, e.g., 0.5? > > Much appreciated. > > Many thanks, Mark Na > > > > > > On Wed, Apr 25, 2012 at 3:27 PM, Greg Snow <538

Re: [R] print table on plot

2012-04-26 Thread Greg Snow
Look at the 'addtable2plot' function in the 'plotrix' package or the 'textplot' function in the 'gplots' package. On Thu, Apr 26, 2012 at 7:26 AM, statquant2 wrote: > Hello, > I would like to be able to plot an array on a plot, something like: >        |arg1  | arg2 | arg3 > val1| 0.9    | 1.1  

Re: [R] Accessing a list

2012-04-26 Thread Greg Snow
mistakes of others (or others to learn from my mistakes). On Wed, Apr 25, 2012 at 5:31 PM, David Winsemius wrote: > > On Apr 25, 2012, at 6:02 PM, Greg Snow wrote: > >> I believe that fortune(312) applies here.  As my current version of >> fortunes does not show this I am gu

Re: [R] Selecting columns whose names contain "mutated" except when they also contain "non" or "un"

2012-04-26 Thread Greg Snow
Sorry I took so long getting back to this, but the paying job needs to take priority. The regular expression "(? wrote: > Hi Greg, > > This is quite helpful. Not so good yet with regular expressions in general or > Perl-like regular expressions. Found the help page though, and think I was > able

Re: [R] Use of optim to fit two curves at the same time ?

2012-04-26 Thread Greg Snow
The phrase "does not work" is not very helpful, it can mean quit a few things including: * Your computer exploded. * No explosion, but smoke is pouring out the back and microsoft's "NoSmoke" utility is not compatible with your power supply. * The computer stopped working. * The computer sits aroun

Re: [R] Positioning main title

2012-04-26 Thread Greg Snow
You could also use the grconvertX function to convert from the middle of the plotting region (from='npc') to user coordinates (to='user'), or many other combinations. On Wed, Apr 25, 2012 at 5:53 AM, Ramon Ovelar wrote: > Many many thanks for the tip and for authoring this function! > > The final

Re: [R] Accessing a list

2012-04-25 Thread Greg Snow
is a magical shortcut and like any other magic if used incorrectly is likely to do the programmatic equivalent of turning yourself into a toad. —Greg Snow (in response to a user that wanted to access a column whose name is stored in y via x$y rather than x[[y]]) R-help (February 2012) On Tue, Apr 24

<    1   2   3   4   5   6   7   8   9   10   >