Displaying 20 results from an estimated 2000 matches similar to: "YAPMQ - Yet Another PlotMath Question"
2007 Nov 27
2
str() options
Hello,
Is there a way to have str() and ls.str() return all factor levels?
Thanx, DaveT.
*************************************
Silviculture Data Analyst
Ontario Forest Research Institute
Ontario Ministry of Natural Resources
david.john.thompson at ontario.ca
http://ofri.mnr.gov.on.ca
2008 May 06
2
list manipulation
Hello,
I have a set of one-liners (many thanks to previous responses from this
list) that I use to look at newly imported data sets with functions like
dim(), names(), str(), etc. within lapply(). Generally, these commands
work for me but, I am apparently still missing some aspect of list
manipulation. I don't understand why I get a set of NULL list elements
at the end of each output as
2008 Feb 12
3
Reorder data frame columns by negating list of names
Hello,
I would like to reorder columns in a data frame by their names as
demonstrated below:
Take this data frame:
> xxx <- data.frame(matrix(1:40, ncol=8))
> names(xxx) <- letters[1:8]
> xxx
a b c d e f g h
1 1 6 11 16 21 26 31 36
2 2 7 12 17 22 27 32 37
3 3 8 13 18 23 28 33 38
4 4 9 14 19 24 29 34 39
5 5 10 15 20 25 30 35 40
and reorder the columns like
2007 Nov 20
1
Process multiple columns of data.frame
Hello,
How do I do the following more concisely?
Bout[is.na(Bout$bd.n), 'bd.n'] <- 0
Bout[is.na(Bout$ht.n), 'ht.n'] <- 0
Bout[is.na(Bout$dbh.n), 'dbh.n'] <- 0
Would the form of such a command be different
between numeric, character and factor columns?
. . . between data.frames and matrices?
Thanx, DaveT.
*************************************
Silviculture
2008 Apr 09
3
Changing default plot behaviour
Hello,
How would I make the default behaviour of my plots produce output such
as the following (i.e. tick marks inside on all axes, labels only on two
(arbitrary?) sides) without needing the five additional commands each
time?
plot(1:10, axes=FALSE)
axis(1, tcl=0.5)
axis(2, tcl=0.5)
axis(3, tcl=0.5, labels=FALSE)
axis(4, tcl=0.5, labels=FALSE)
box()
Thanx, DaveT.
2008 Oct 10
2
Fatal error: unable to restore saved data in .RData
Hello,
I am unable to start an R session by double-clicking on an existing
.RData file from the Windoze file explorer.
A dialogue appears with the message
"Fatal error: unable to restore saved data in .RData",
and I notice in the R Console the last few lines are:
"Loading required package: R2HTML
NULL
error in function () : unused argument(s) (1:43)"
I tried starting
2008 Dec 09
2
assign()ing within apply
Hello,
I'm trying to convert a character column in several dataframes to lower
case.
###
#
# Sample data and 'spp' column summaries:
# dput(ban.ovs.1993[sample(row.names(ban.ovs.1993), 20), 1:4])
ban.ovs.93 <- structure(list(oplt = c(43L, 43L, 38L, 26L, 35L, 8L, 39L,
1L,
34L, 50L, 10L, 29L, 31L, 24L, 18L, 12L, 27L, 49L, 28L, 51L),
rplt = c(NA_integer_, NA_integer_,
2008 Jan 17
2
Converting plots to ggplot2
Hello Hadley,
I am trying to reproduce the following with ggplot:
a <- seq(0, 360, 5)*pi/180 ; a
ac <- sin(a + (45*pi/180)) + 1 ; ac
plot(a, ac, type='b', xaxt = "n")
axis(1, at=seq(0,6,1), labels=round(seq(0,6,1)*180/pi),1)
abline(v=c(45*pi/180, 225*pi/180))
I can get the basic plot:
p <- qplot(a, ac, geom=c('point', 'line')) ;
2008 May 26
1
SciViews and Tinn-R installation problem
Hello,
I have just installed R 2.7.0 and re-installed SciViews 0.8-9 and Tinn-R
1.19.4.7 and seem to have broken something along the way as follows.
I double-click on my current .RData file in the Windoze explorer, R
Console and Tinn-R load successfully (?).
I can list objects in my working directory with ls() but, when I attempt
to refresh any list in the R explorer tab of the Tools child
2008 Feb 08
1
Can I index a dataframe with a reference from/to a second dataframe?
Hello,
I am unable to figure out how to code a new column in a data frame based
on an existing column that matches a column in a reference data frame,
in a relational-db fashion. I would like this to maintain a minimum set
of reference tables that may be reused over several similar datasets.
Specifically, I have two data frames as listed below, 'Bos' and 'tree.'
For each case in
2008 Apr 10
1
Recovering SPlus GraphSheets
Hello,
Is it possible with R to recover the contents of SPlus GraphSheets
(*.sgr) without access to SPlus?
Also, some of the .sgr files may have multiple pages.
Thanx, DaveT.
*************************************
Silviculture Data Analyst
Ontario Forest Research Institute
Ontario Ministry of Natural Resources
david.john.thompson at ontario.ca
http://ofri.mnr.gov.on.ca
2007 Dec 20
1
Available environment variables
Hello,
I am trying to set my environment to streamline the downloading /
updating of packages. I have been through R-intro.html (10.8
Customizing-the-environment), R-FAQ (5.2 How can add-on packages be
installed?), rw-FAQ, and help pages for Sys.setenv {base},
download.packages {utils}, etc.,.
I am looking for something similar to the download.packages destdir
argument on a global environment
2008 Jun 04
1
ggplot questions
Hello,
A few questions about the following examples:
1. Why do the two plotting versions not produce the same result?
2. Is the 'scale_x_continuous' (or *_y_* or *_*_discrete) geom the best
way to setup grids (as in visual guide-lines) in polar (or for that
matter, any) coordinate system?
3. Why do these commands appear to generate 3 plot pages each?
4. Perhaps more questions to follow
2007 Nov 22
1
Summary: Process multiple columns of data.frame
Thank you Jim Holtman and Mark Leeds for your help.
Original question:
>How do I do the following more concisely?
> Bout[is.na(Bout$bd.n), 'bd.n'] <- 0
> Bout[is.na(Bout$ht.n), 'ht.n'] <- 0
> Bout[is.na(Bout$dbh.n), 'dbh.n'] <- 0
>. . .
Solution:
for (i in c('bd.n', 'ht.n', 'dbh.n')) Bout[is.na(Bout[[i]]), i] <- 0
Toy
2008 Oct 09
1
YALAQ - Yet Another LApply Question
Hello,
Two lapply questions (system info and sample data below):
1) Why does the first form of command1 add the name of y _after_ the
str() output rather than before as does the second (preferred) form?
# command1 version1
invisible(lapply(ls(pattern='bn'), function(y) cat(y, "\n",
str(get(y)), "\n") ))
# command1 version2 (preferred output)
2008 Mar 07
1
Finding Interaction and main effects contrasts for two-way ANOVA
I've tried without success to calculate interaction and main effects
contrasts using R. I've found the functions C(), contrasts(),
se.contrasts() and fit.contrasts() in package gmodels. Given the url
for a small dataset and the two-way anova model below, I'd like to
reproduce the results from appended SAS code. Thanks. --Dale.
## the dataset (from Montgomery)
twoway <-
2008 Jun 17
0
echo Rprofile.site on startup
Hello,
I have not been able to find how to have R echo the Rprofile.site
contents to the console on start-up.
Changing the windoze shortcut to include the '--verbose' option does not
show what I am looking for.
I would like to see the options and commands listed, in addition to the
library() loadings, as they are processed. Examples of the type of
options I like and shortcut-commands
2010 Aug 01
3
Constructing arguments for plotmath
Colleagues,
I am encountering difficulty adding formatted text to a graphic. Specifically, I want to add a superscript in the middle of a text string but I would like to format the text string on the fly. The commands:
plot(1,1)
ARG <- bquote('TEXT'^'\u00ae')
mtext(ARG, line=-2, side=1)
yield the desired output.
However, my goal is to paste together a string, then pass
2008 Apr 02
1
Trouble combining plotmath, bquote, expressions
I'm using R-2.6.2 on Fedora Linux 9.
I've been experimenting with plotmath.
I wish it were easier to combine expressions in plotmath with values
from the R program itself. There are two parameters in the following
example, the mean "mymean" and standard deviation "mystd". I am able
to use bquote to write elements into the graph title like
mu = mymean
and R will
2023 Jun 08
2
need help with plotmath and/or plotting unicode characters
R 4.2.3
OS X
Colleagues
This should be easy -- but not for me.
I want to plot text similar to this:
N ? XX: YY
where XX can be either 1 or 50 and YY is an integer
I envision that there would be two solutions:
UNICODE: If I can generate "?" via unicode, the problem is solved:
mtext(side=3, paste0("N ", UNICODE, " ", XX, ": ", YY))
PLOTMATH: