search for: dwarnold45

Displaying 20 results from an estimated 34 matches for "dwarnold45".

2012 Jul 21
4
rhsape2 bug?
All, I believe I am running the latest version of rshape2 (1.2.1). But this code: library(reshape2) tmp <- melt(smiths, id.vars=1:2, measure.vars=c("age","weight","height"), variable.name="myvars", value.name="myvals" ) names(tmp) Produces this output: > names(tmp) [1] "subject" "time"
2013 Feb 12
2
Data sets online for student use
All, If you have any good links for sites that contain data sets that can easily be accessed and copied (or downloaded) by students in introductory statistics, could you please share them? Thanks. David -- View this message in context: http://r.789695.n4.nabble.com/Data-sets-online-for-student-use-tp4658326.html Sent from the R help mailing list archive at Nabble.com.
2012 Aug 03
2
Printing a summary
All, Is this typical of how people will print a summary of results? CoinTosses <- function(n) { x <- sample(c(0,1), n, replace=TRUE) y <- x y[y==0] <- "T" y[y==1] <- "H" numHeads <- sum(x) numTails <- n-sum(x) p <- numHeads/n cat(cat(y,sep=""),"\n") cat("Number of heads: ", numHeads, "\n")
2013 Sep 17
1
"With" question
All, Trying to avoid using attach and detach while teaching class in Intro Stats. data=read.delim("dataset1.dat",header=TRUE) with(data,{ sort(age) length(age) (age[10]+age[11])/2 }) However, this code only produces output for the last line between the curly braces. Granted, as we type the lines in one at a time and execute the code, we'll see each output. And, we can fix
2012 Nov 29
2
Analysis of Variance
Hi, I am encountering a difficulty I don't understand. Be patient, I'm very new to analysis of variance. If I load this data: example12_7=read.table("http://msemac.redwoods.edu/~darnold/math15/data/chapter12/example12_7.dat",header=TRUE) The run the oneway.test: oneway.test(time~drug,data=example12_7,var.equal=TRUE) I get these results: data: time and drug F = 4.1881, num
2012 Aug 15
4
Reading one column .csv file
My friend sent an Excel file: http://msemac.redwoods.edu/~darnold/temp/cyu01_iqscores.xls http://msemac.redwoods.edu/~darnold/temp/cyu01_iqscores.xls I opened it in Excel, saved is as cyu01_iqscores.csv, then imported it into R with: iqscores=read.csv('cyu01_iqscores.csv',header=TRUE) The result was: > head(iqscores) IQ.Scores X 1 145 NA 2 101 NA 3 123 NA 4
2012 Jul 18
4
Entering Data Files
Hi, Entering data from a given file is the hardest part of learning R for me. For example, I have this datafile from Moore's text: Live Age Count Parents Age19 324 Another Age19 37 OwnPlace Age19 116 Group Age19 58 Other Age19 5 Parents Age20 378 Another Age20 47 OwnPlace Age20 279 Group Age20 60 Other Age20 2 Parents Age21 337 Another Age21 40 OwnPlace Age21 372 Group Age21 49 Other Age21 3
2012 Jul 12
4
Adjusting format of boxplot
Hi, I managed to use the attached data set and figure out the following: flies <- read.table("example12_1.dat",header=TRUE,sep="\t") boxplot(long ~ group, data = flies, horizontal = TRUE, col = "red") I'm very new to R and would like some help with the following: 1. Change the order on the y-axis from 1, 2, 3, 4, 5 to 5, 4, 3, 2, 1.
2012 Jul 21
1
Library control
All, 1. Is there a command that tells you what libraries are loaded? 2. How do you remove a library that has been loaded? 3. If you have loaded a library that masks previously loaded objects, how can you tell which object is being run? In Matlab, I would run "which f" to determine the location of the file f that will be run. Is there a similar procedure in R? David. -- View this
2012 Aug 03
1
Printing contents of a variable
All, Can someone explain why this does not print the contents of x when I source this file? CoinTosses <- function(n,print=TRUE) { x <- sample(c(0,1), n, replace=TRUE) y <- x y[y==0] <- "T" y[y==1] <- "H" p <- sum(x)/n p } x <- CoinTosses(40) x On the other hand, if I source this file: CoinTosses <- function(n,print=TRUE) { x <-
2013 Jan 10
1
SRS, Stratified, and Cluster sampling
Hi, Has anyone done (or know of) any nice R activities that help introductory students ( and teachers :) ) better understand the concepts of simple vs stratified vs cluster sampling? Any links? David -- View this message in context: http://r.789695.n4.nabble.com/SRS-Stratified-and-Cluster-sampling-tp4655099.html Sent from the R help mailing list archive at Nabble.com.
2013 Apr 03
1
prop.test vs hand calculated confidence interval
Hi, This code: n=40 x=17 phat=x/n SE=sqrt(phat*(1-phat)/n) zstar=qnorm(0.995) E=zstar*SE phat+c(-E,E) Gives this result: [1] 0.2236668 0.6263332 The TI Graphing calculator gives the same result. Whereas this test: prop.test(x,n,conf.level=0.99,correct=FALSE) Give this result: 0.2489036 0.6224374 I'm wondering why there is a difference. D. -- View this message in context:
2013 Nov 23
2
Label point with (x,hat(y))
Hi, I'd like to do this: text(1,3,"(x,yhat)",pos=3) But using (x,hat(y)). Any suggestions? D. -- View this message in context: http://r.789695.n4.nabble.com/Label-point-with-x-hat-y-tp4681049.html Sent from the R help mailing list archive at Nabble.com.
2013 Jan 05
3
Rounding
Hi, Can someone explain this: > options(digits=20) > 1/3 [1] 0.33333333333333331483 Why the 1483 at the end? Thanks, David. david-arnolds-macbook-pro-2:~ darnold$ R --version R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3-900051-07-0 Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit) -- View this
2013 Apr 17
3
t-statistic for independent samples
Hi, Typical things you read when new to stats are cautions about using a t-statistic when comparing independent samples. You are steered toward a pooled test or welch's approximation of the degrees of freedom in order to make the distribution a t-distribution. However, most texts give no information why you have to do this. So I thought I try a little experiment which is outlined here.
2012 Oct 09
2
simulating a toss of a coin
All, I've devised a way to toss a coin three times and record the number of heads, then use the table command to summarize the number of time 0, 1, 2, or 3 heads were obtained. n <- 100 x <- sample(c("H","T"),3*n,replace=TRUE) dim(x) <- c(3,n) num_heads <- apply(x,2,function(x) sum(x=="H")) table(num_heads)/n What I'd like to do next is run this
2008 Jun 13
2
Importing data with different delimters
All, I have a data file with 56 entries that looks like this: City State JanTemp Lat Long Mobile, AL 44 31.2 88.5 Montgomery, AL 38 32.9 86.8 Phoenix, AZ 35 33.6 112.5 Little Rock, AR 31 35.4 92.8 Los Angeles, CA 47 34.3 118.7 San Francisco, CA 42 38.4 123.0 I would like to "read" this data into a dataframe. Is it possible to do without editing the datafile? D.
2009 Jun 10
2
Creating a specific skewed distribution
All, Can someone help me create a skewed distribution, mean = 30, with probability of selecting a random number from the distribution greater than or equal 60 equal to 10%? I need the probability density function to equal zero at zero, and have a maximum height at or near 30. Is this possible? And if it is possible, how can I adjust the distribution so that the probability of selecting a
2012 Jul 13
4
Side by side strip charts
Hi, I'm looking for some ideas on how to reproduce the attached image in R. There are three samples, each of size n = 10. The first is drawn from a normal distribution with mean 60 and standard deviation 3. The second is drawn from a normal distribution with mean 65 and standard deviation 3. The third is drawn from a normal distribution with mean 70 and standard deviation 3.
2012 Jul 14
2
Arrange two columns into a five variable dataframe
Hi, I hope that folks can give me some simple approaches to taking the data set below, which is accumulated in two columns called "long" and "group", then arrange the data is the "long" column into a data frame containing five variables: "Group 1", "Group 2", "Group 3", "Group 4", and "Group 5". I am hoping for a few