plots),
randomization tests, bootstrapping, and run t-tests, chi-square, ANOVA, and
regression.
I tried using RStudio, but it is still overkill for what I want my students
to be able to do. They don't need an IDE. Randall Pruim has kindly made a
PDF for using R with Lock5, but that is too much
Perhaps the original question was only the syntax question about how if()
statements work. That has been answered. (But I’ll add a note that omitting {
} in this situation is a good way to introduce bugs over time, so I generally
avoid doing that.)
But in case the question is motivated by the
Christopher,
It sounds to me like you are the right track to answering your own question.
There are certainly packages that make some things much easier (like the
tidyverse suite you mention), and in the end you will need to match what you
choose to your audience and your goals.
So my take
Are you familiar with the learnr package for creating tutorials? That might do
much of what you want. Also, checkr (by Danny Kaplan) is in development and
will provide a way for you to check work and give feedback.
—rjp
> On Feb 20, 2018, at 9:40 PM, BRET R LARGET
Steve,
This is on the edge of what R-sig-teaching is for (since it isn’t really about
teaching). But since I think there are elements of what you are doing that
lead students to think that R is terrible, I’ll show you how I might approach
things.
First a few comments about my solution.
1) I
The issue of ties probably has no answer that is best in all situations.
Here’s what mosaic::ntiles() does:
> x <- c(2,4,8,9,11,11,11,12,15)
> rbind(x, ntiles(x, 2))
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9]
x2489 11 11 11 12 15
111112
e all this gets called, and with which arguments, I don’t know
whether this matters or not.
—rjp
On Nov 28, 2015, at 1:35 PM, Ista Zahn
<istaz...@gmail.com<mailto:istaz...@gmail.com>> wrote:
On Nov 28, 2015 12:56 PM, "Randall Pruim"
<rpr...@calvin.edu<mailto:r
A couple more questions for you:
* what type of object do you want created? (A matrix? data frame? something
else?)
* is there a reason to have 3 named arguments and then … if you are treating
them all the same in the end anyway? Seems like that just makes your function
less flexible
I think perhaps it would be useful if you tipped your hand a bit more about
what you are actually trying to do with your function, but I think that this
does the immediate task for functions that have … in the argument list.
foo <- function(x=1, y=2, z=3, ...) {
m <- length(formals()) +
Try readxl
I’ve found that that package works very well.
> On Sep 23, 2015, at 10:02 AM, Steven Stoline wrote:
>
> Dear All:
>
> I am having trouble reading an *.xlsx data file into R.
>
> I tried to install the packages XLSX and readx1, but still did not work.
>
> Any
But be warned that depending on the kinds of data you have, exporting to CSV
and then reading in the CSV may or may not give you exactly what you are
expecting. So it is safer to use a tool designed to read excel files directly
if (a) you can make it work and (b) the tool you are using is good
A few thoughts. You can do what you want with them.
1) Use R formulas.
If you lattice graphics, then lm() and plots have essentially the same
syntax and you can make nice connections between the graphs and the
analyses. For example,
bwplot( weightLoss ~ diet ) or xyplot (weightLoss ~
I'm not sure exactly what sort of plot was desired, but I'll offer 1.5
possibilities.
Currently you can do something like this:
require(mosaic)
plotFun( x^2 - 4 ~ x , xlim=c(-6,6), col='blue' )
plotFun( (x^2 - 4)/as.numeric(x^2 -4 0) ~ x , xlim=c(-6,-2),
add=TRUE, col='blue', lwd=4 )
It
The xlim=c(-6,-2) is extraneous in the code below. It snuck in from
something else I was doing. It doesn't hurt any, but it doesn't do
anything either since the plotting limits are inferred from the
surrounding plot when add=TRUE is used.
On Feb 16, 2012, at 10:07 AM, Randall Pruim
I recently wrote a function for the mosaic package that makes it easy
to generate various kinds of plots of distributions. For example, to
plot a Binom(30,.35) distribution, you just use:
distPlot(binom,params=list(size=30, prob=.35))
and get the attached plot (if it makes it through to
I have modified the distPlot() function in the mosaic package so that
the following makes the desired plot (as a density histogram):
distPlot( binom, params=list(35,.25), groups= y
dbinom(qbinom(0.05, 35, .25), 35,.25), kind='hist')
The groups argument is used to get the desired shading of
I just joined this list, and I see in the archives that there have
been several answers to this already, but I'll add another one:
install.packages(mosaic)
example(xpnorm)
xpnorm() is a function that behaves much like pnorm() but provides
more verbose output and a plot to go with the
17 matches
Mail list logo