search for: jacobwegelin

Displaying 13 results from an estimated 13 matches for "jacobwegelin".

2010 Feb 04
4
xyplot 3 panels 3 different Y variables
Often, when exploring a dataset, I'd like to plot several very different Y variables against the same X variable, in panels stacked one over the other. Is there an easy way to do this? I'd like to achieve an elegant look similar to the look achieved by lattice in conditioned plots--for instance no space between panels. But unlike in straightforward conditioned plot, each panel may be on a
2010 Feb 07
2
conditioned xyplot, many y variables
The example below creates parallel time-series plots of three different y variables conditioned by a dichotomous factor. In the graphical layout, ? Each y variable inhabits its own row and is plotted on its own distinct scale. ? Each level of the factor has its own column, but within each row the scale is held constant across columns. ? The panels fit tightly (as they do
2009 Nov 11
1
loop through variable names
Often I perform the same task on a series of variables in a dataframe, by looping through a character vector that holds the names and using paste(), eval(), and parse() inside the loop. For instance: thesevars<-names(environmental) environmental$ToyOutcome<-rnorm(nrow(environmental)) tableOfResults<-data.frame(var=thesevars) tableOfResults$Beta<- NA
2010 Feb 26
1
match.call to obtain the name of a function
Within a function I'd often like to obtain a text string equal to the name of the function. One use for this: To generate a filename for use in pdf(). This enables me to keep track of which function generated a particular graphic came. match.call() puts parentheses at the end of the name. I don't want parentheses in a filename. The following kludgey function gives the desired result.
2012 Sep 06
0
lme( y ~ ns(x, df=splineDF)) error
...grid_2.15.1 labeling_0.1 [6] lattice_0.20-6 MASS_7.3-18 memoise_0.1 munsell_0.3 plyr_1.7.1 [11] proto_0.3-9.2 RColorBrewer_1.0-5 reshape2_1.2.1 scales_0.2.1 stringr_0.6 [16] tools_2.15.1 The following function can also be downloaded from http://jacobwegelin.net/tmp/r-help/. wrapper <-function(WhichApproach=1, splineDF=4 ){ # Create toy dataset nID<-25 IDnames<-LETTERS[1:nID] longdat<-data.frame( x=rep(-10:10, nID) / 3 , ID= rep( IDnames , each=21) ) set.seed(5) longdat$x<-longdat$x + rnorm(nrow(longdat))/10 IDeffect<-rnorm(nID) * 2...
2010 Mar 04
2
fisher.test gives p>1
The purpose of this email is to (1) report an example where fisher.test returns p > 1 (2) ask if there is a reliable way to avoid p>1 with fisher.test. If one has designed one's code to return an error when it finds a "nonsensical" probability, of course a value of p>1 can cause havoc. Example: > junk<-data.frame(score=c(rep(0,14), rep(1,29), rep(2, 16))) >
2010 Jun 18
1
ggplot2 boxplot: horizontal, univariate
In ggplot2, I would like to make a boxplot that has the following properties: (1) Contrary to default, the meaningful axis should be the horizontal axis. Lattice does this, for instance, by library(lattice);bwplot(~mtcars$mpg) (2) It is *univariate*, i.e., of a single vector, say mtcars$mpg. I do not wish to make separate plots for the different values of mtcars$cyl. (3) Nothing on the
2009 Oct 28
3
variable labels to accompany data.frame
Often it is useful to keep a "codebook" to document the contents of a dataset. (By "dataset" I mean a rectangular structure such as a dataframe.) The codebook has as many rows as the dataset has columns (variables, fields). The columns (fields) of the codebook may include: ? variable name ? type (character, factor, integer, etc) ? variable label
2010 Apr 15
4
Does "sink" stand for anything?
Hello Everyone,   Learning about R and its wonderful array of functions. If it's not obvious, I usually try to find out what a function stands for. I think this helps me remember better.   One function that has me stumped is "sink." Can anyone tell me if this stands for something?   Thanks,   Paul         __________________________________________________ [[alternative HTML
2012 Sep 26
0
lme(y ~ ns(x, df=splineDF)) error
I would like to fit regression models of the form y ~ ns(x, df=splineDF) where splineDF is passed as an argument to a wrapper function. This works fine if the regression function is lm(). But with lme(), I get two different errors, depending on how I handle splineDF inside the wrapper function. A workaround is to turn the lme() command, along with the appropriate value of splineDF, into a text
2011 Nov 10
1
unable to load Hmisc in R 2.14.0
On my MacBook Pro (OS 10.6.8), after updating to R version 2.14.0 (2011-10-31) and reinstalling the Hmisc package, I am unable to load the Hmisc library. Hmisc was working *before* I updated R. Any idea what's wrong? Details below. > install.packages("Hmisc", dependencies=TRUE) trying URL 'http://cran.case.edu/bin/macosx/leopard/contrib/2.14/Hmisc_3.9-0.tgz' Content
2012 Dec 06
1
scope, lme, ns, nlme, splines
I want to fit a series of lme() regression models that differ only in the degrees of freedom of a ns() spline. I want to use a wrapper function to do this. The models will be of the form y ~ ns(x, df=splineDF) where splineDF is passed as an argument to a wrapper function. This works fine if the regression function is lm(). But with lme(), I get an error. fitfunction() below demonstrates this.
2013 Dec 02
2
plus/minus +/- in factor; not plotmath not expression
I want to put the "plus or minus" symbol into a character variable, so that this can be turned into a factor and be displayed in the "strip" of a faceted ggplot2 plot. A very nice solution, thanks to Professor Ripley's post of Nov 16, 2008; 3:13pm, visible at http://r.789695.n4.nabble.com/Symbols-to-use-in-text-td874239.html and subsequently