Displaying 20 results from an estimated 10000 matches similar to: "hiding/protecting utility functions in .Rprofile"
2010 Jan 15
4
transposing a list of vectors
I have a list of vectors, all forced to be the same length:
testlist <- list(
shape=c(0, 0, 2),
cell.fill=c("red","blue","green"),
back.fill=rep("white",3),
scale.max=rep(100,3)
)
> str(testlist)
List of 4
$ shape : num [1:3] 0 0 2
$ cell.fill: chr [1:3] "red" "blue" "green"
$ back.fill: chr [1:3]
2005 Nov 17
3
loess: choose span to minimize AIC?
Is there an R implementation of a scheme for automatic smoothing
parameter selection with loess, e.g., by minimizing one of the AIC/GCV
statistics discussed by Hurvich, Simonoff & Tsai (1998)?
Below is a function that calculates the relevant values of AICC,
AICC1 and GCV--- I think, because I to guess from the names of the
components returned in a loess object.
I guess I could use
2002 Dec 11
3
Excluding levels in table and xtabs
I'm trying to form contingincy tables among a set of character variables
which were read from a .csv file and
have missing represented as "". I want to exclude the missing levels
from the table.
> levels(CPIC)
[1] "" "N" "Y"
> levels(Manix)
[1] "" "N" "Y"
> xtabs(~CPIC + Manix, exclude=c("",NA))
2008 Jun 06
4
color scale mapped to B/W
In an R graphic, I'm using
cond.col <- c("green", "yellow", "red")
to represent a quantitative variable, where green means 'OK', yellow
represents 'warning'
and red represents 'danger'. Using these particular color names, in B/W,
red is darkest
and yellow is lightest. I'd like to find color designations to replace
yellow and
2003 Sep 25
3
ungrouping grouped data
I'm sure this is probably simple, but I can't find an answer...
I have a data frame (Galton's data on heights of parents and children),
in grouped form,
parent child frequency
73.5 72.2 1
73.5 73.2 3
72.5 68.2 1
72.5 69.2 2
72.5 70.2 1
72.5 71.2 2
72.5 72.2 7
72.5 73.2 2
72.5 74.2 4
71.5 65.2 1
71.5 66.2 3
71.5 67.2 4
71.5 68.2 3
71.5 69.2 5
71.5 70.2 10
...
and need the ungrouped
2008 Oct 29
2
sessionInfo() error
[Using R 2.7.2 on Windows XP]
After re-building our heplots package, I've begun to get the following
error from sessionInfo(),
even though it passes R CMD check and builds without errors:
> sessionInfo()
Error in x$Priority : $ operator is invalid for atomic vectors
In addition: Warning message:
In FUN(c("MASS", "heplots", "car", "rgl",
2009 Aug 05
2
reading and frequency analysis of Spanish text
For an historical paper I'm working on, I have some Spanish plaintext,
presently in the form of a Word .doc
file,
http://euclid.psych.yorku.ca/SCS/Gallery/images/Private/Langren/Verdadera-spanish-stripped.doc
and also some ciphered text from the same original source. The ultimate
goal is to use some
frequency analysis of letters and word lengths in the plaintext to help
decode the
2004 Feb 18
3
ANOVA procedure on the sufficient statistics
Hi,
I have a two-way anova with unequal cell numbers that I want to analyze.
The problem is I don't have individual observations of the data.
I only have the sufficient statistics (mean, variance, # of observations) for each cell.
Is there any existing function in S-plus that would allow me to do aov() with the sufficient statistics?
The table is like
G1 G2 G3 G5 G6
T1
T2
T3
2012 Jul 30
1
locked binding of setwd() in R 2.15.x causes .Rprofile to fail
[Env: Win XP, R 2.14.2, R 2.15.0]
I have a replacement function for setwd() in my .Rprofile which displays
the current R path in the R window
title. It no longer works in R 2.15.x, giving the error below. Worse,
the error prevents the rest of my
.Rprofile script from completing.
Is there some way to rescue this, i.e., preserve this behavior in
R 2.15? If not, how can I modify my script so it
2008 Jul 23
6
Convert list of lists <--> data frame
For a function that takes an argument as a list of lists of parameters,
I'd like to be able to convert that
to a data.frame and vice versa, but can't quite figure out how.
pats <- list(structure(list(shape = 0, shape.col = "black", shape.lty = 1,
cell.fill = "white", back.fill = "white", label = 1, label.size = 1,
ref.col = "gray80",
2009 Mar 05
2
identify() and postscript output
In the following, I'm fitting a logistic regression model, and using
car:::influencePlot. When I run the latter with
output to the screen, it calls identify() that lets me label
observations with large CookD.
However, if I use postscript() to get .eps output, identify() seems not
to be called at all. If instead, I
use dev.copy2eps() after getting output to the screen, the point labels
2002 Nov 06
6
how to update installed packages to a new version of R?
I've just installed R 1.6.1 and would like to install all the
contributed packages I had used in 1.5.1.
It's not too hard to do this manually from Rgui, but I wondered if there
is an easier way,
something like writing the results of installed.packages() from 1.5.1 to
a file and
using that with install.packages() in 1.6.1, or just having 1.6.1 read
what's in rw151/library.
--
2008 Sep 01
3
how to read multiple lines per case
How can I read a space-delimited file, where the data values for each case
are folded before column 80, and so appear on two lines for each case?
The first few cases look like this
loc type bio H2S sal Eh7 pH buf P K Ca Mg Na Mn Zn Cu NH4
OI DVEG 676 -610 33 -290 5.00 2.34 20.238 1441.67 2150.00 5169.05 35184.5
14.2857 16.4524 5.02381 59.524
OI DVEG 516 -570 35 -268 4.75 2.66 15.591 1299.19
2010 Nov 03
3
R package BibTex entries: looking for a more general solution
== Summary ==
* Problem: BibTeX entries extracted from R packages via citation()
require too much manual editing to be
of general use.
* Proposal: Date: fields should be made mandatory in package DESCRIPTION
files, perhaps
beginning with warnings from R CMD check
* Proposal: Package authors should be encouraged to use a (new)
Contributors: field in the DESCRIPTION file
rather than packing all
2003 Nov 01
4
Beginner: Homogenity of Variances
Hello,
for my meta-analysis I try to test if two varainces are equal without
using the raw scores. I have is the SD's, N's and the Means.
I want to test the variances from dependent and independend
samples.
I assume I can use the var.test procedure for the independent
samples, but what about the dependent samples ? Has anyone an
idea how to realise this with R ?
Thanks in advance
2009 Nov 03
2
reshaping pairs of columns
Given a data frame consisting of a pointID and 12 pairs of (lat, long)
variables, with names
latA, longA, latB, longB, ... latL, longL, I want to reshape it into a
data frame with the structure
point source lat long
1 A ... ...
1 B ... ...
I've looked at reshape and plyr, but can't figure out how to do this.
Details of my data frame are below
2006 Mar 23
1
comparative density estimates
I have two series of events over time and I want to construct a graph of the
relative frequency/density of these events that allows their
distributions to
be sensibly compared. The events are the milestones items in my project on
milestones in the history of data visualization [1], and I want to
compare trends
in Europe vs. North America.
I decided to use a graph of two overlaid density
2008 Dec 10
2
read.*: How to read from a URL?
The question is how to use a URL in place of a file= argument for
read.*.functions that do
not support this internally.
e.g., utils::read.table() and her family all support a file= argument
that can take a URL
equally well as a local file. So, if I have a file on the web, I can
equally well do
> langren <- read.csv("langrens.csv", header=TRUE)
> langren <-
2008 Aug 17
1
how to override/replace a function in a package namespace?
I'm trying to test an extension of mosaic() from the vcd package that
requires a change to the
basic strucplot() function from that package. I want to test my change
by sourcing the
replacement function into my R session.
But when I do that,
source("c:/R/mosaics/strucplot-MF.R")
and run my extension, it is apparent that it is vcd:::strucplot that is
eventually called, not
my
2009 Dec 17
1
poly() with unnormalized values
How can I get the result of, e.g., poly(1:3. degree=2) to give me the
unnormalized integer coefficients
usually used to explain orthogonal polynomial contrasts, e.g,
-1 1
0 -2
1 1
As I understand things, the columns of x^{1:degree} are first centered
and then
are normalized by 1/sqrt(col sum of squares), but I can't
see how to relate this to what is returned by poly().
>