Re: [R] Getting rid of unwanted csv files
WRAY NICHOLAS [2015.11.18] wrote: > > I'd like to get shot of the junk files, but I can't distinguish them by > names/label from the ones I want to keep -- the only criterion is the date of > making them, but I cannot see a way of telling R to look at the date rather > than > the name/label Obviously I could plough by hand, but there are loads and if > anyone has any ideas I'd be grateful > PS Just had a thought -- Going off R-piste now but of course is it poss to get > rid of them within Windows (which I'm using) rather than R itself? > [[alternative HTML version deleted]] You can list them by date, and them select all the ones with a certain date range. With other operating systems it would be even simplier... Pär -- Pär Leijonhufvudp...@leijonhufvud.org __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Plot and lm
I want to make a log-log plot with a regression line, but I can't figure out what I'm doing wrong. What I'm trying is: plot(mass,area, log="xy", pch=as.numeric(food)) abline(lm(mass~area)) or plot(mass,area, log="xy", pch=as.numeric(food)) islands$logmass <- log(mass) islands$logarea <- log(area) attach(islands) abline(lm(logmass~logarea)) But that does not show a line. Where am I going wrong? data: island, area,species,food,mass Ibiza , 577 , Anser n. sp., herb, 2.0 Ibiza , 577 ,Haliaeetus albicilla, carn, 4.8 Mauritius , 1874 , Raphus cucullatus, herb, 19 Mauritius , 1874 , Circus alphonsi, carn, 0.63 Mallorca , 3667 , Myotragus balearicus, herb, 40 Mallorca , 3667 , Aquila chrysaetos, carn, 4.2 Kreta , 8259 , Elephas creutzburgi, herb, 3200 ... /Par -- Par Leijonhufvud p...@hunter-gatherer.org I don't believe in reincarnation. I used to, but that was in another life. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Plot and lm
stephen sefick [2009.06.04] wrote: > Could you provide a reproducible example even with fake data would be > fine or dput() yours. Sorry, I don't understand what you mean. Im my post was the first 8 lines of my data, imported into R with islands <- read.table("islands.csv", sep=",", h=T) and the code was a cut-and-past from my .Rhistory. When I run it I get a nice graph, but no line from abline (unless it is vertical or horizontal and "superimposed" uppon one of the axes)... Which turns out ot be the case: Just running lm I get > lm(mass~area) Call: lm(formula = mass ~ area) Coefficients: (Intercept) area 3.615e+025.967e-05 > lm(logmass~logarea) Call: lm(formula = logmass ~ logarea) Coefficients: (Intercept) logarea -1.3480 0.4747 Forcing the graph with ylim=c(0,001,1) I see a line from the latter, but (no surprise) none from the former. Now I just need to fix my assumptions such that I produce a line that is an actual regession line... Thanks for making me think it through! /Par -- Par Leijonhufvud p...@hunter-gatherer.org The best comment I heard about Starship Troopers was "Based on the back cover of a book by RAH". -- Paul Tomblin __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] wilcox.test; data type conversion?
I'm working on a quick tutorial for my students, and was planning on using Mann-Whitney U as one of the tests. I have the following (fake) data grade <- c("MVG", "VG", "VG", "G", "MVG", "G", "VG", "G", "VG") sex <- c( "male", "male", "female", "male", "female", "male", "female", "male", "male") gradesbysex <- data.frame(grade, sex) The grades is in the Swedish system, where the order is G < VG < MVG The idea is that they will investigate if they can show a grade difference by sex (i.e. that the teacher gives better grades to boys or girls). Since the wilcox.test needs the order of the grades it wants numeric vector for the data. Is there a good and simple (i.e. student compatible) way to handle this? I could tell them to enter data as numbers instead, but an elegant way to do this inside R would be preferable. On the same theme, is there a way to tell barplot that, when making stacked barplots, to stack the data in a particular order (default appears to be alphabetical)? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] wilcox.test; data type conversion?
Steven McKinney [2010.10.29] wrote: > You can set up the data as > > > grade <- ordered(c("MVG", "VG", "VG", "G", "MVG", "G", "VG", "G", "VG"), > > levels = c("G", "VG", "MVG")) > wilcox.test(as.integer(grade) ~ sex, data = gradesbysex) Thanks, this solved my problems. I'll just explain the problem with ties, that is easier to understand than running jitter and comparing. > As for the barplots, I think all you need to do is specify the row and column > order you'd like. > > Try this example > > > barplot(VADeaths, beside = TRUE) > > barplot(VADeaths[5:1,c(4, 2, 3, 1)], beside = TRUE) > > Substitute your data, use beside=FALSE to stack, etc. Ahh, that simple. I'll fiddle on with that. Trying to wean the students away from using Excel for all numbers related work... __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] wilcox.test; data type conversion?
Peter Dalgaard [2010.10.30] wrote: > I wouldn't bother with that. The p-value is based on the correct > covariance matrix of the rank sums, tie-breaking just adds noise to the > analysis. Good to know. > If you really want an exact p-value, package exactRankTests is In this case I suspect that for upper secondary students we won't get that fancy. This is the first time they deal with statistics beyond mean, median and possibly standard deviation (and simple graphs, of course). Thus the request for simple and elegant solutions; arcane incantations won't make them leave the comforts of Excel. > the ticket. (Or, if there is really only 3 females in 9 students, you > can get ambitious and set up the permutation distribution by enumerating > the choose(9,3)=84 possible outcomes.) Well, this being totally fake data I created for a student exercise, there can be as many male and female students in the class as I think they can be bothered typing in... :-) /Par __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.