[R] Using factor levels as coordinates with geom_rect

2014-09-23 Thread Loris Bennett
Hi, With ggplot2 I can use the following to create a rectangle geom_rect(aes(ymin=as.Date(8-Apr-2014, format=%d-%b-%Y), ymax=as.Date(30-Apr-2014, format=%d-%b-%Y), xmin=node002,xmax=node098), where the x values are levels of a factor. This works if I want the

[R] ANOVA and permutation tests : beware of traps

2014-09-23 Thread Stéphane Adamowicz
Recently, I came across a strange and potentially troublesome behaviour of the lm and aov functions that ask questions about calculation accuracy. Let us consider the 2 following datasets dat1 dat2 : (dat1 - data.frame(Y=c(1:3, 10+1:3), F=c(rep(A,3), rep(B,3 Y F 1 1 A 2 2 A 3 3 A 4

Re: [R] ANOVA and permutation tests : beware of traps

2014-09-23 Thread Joshua Wiley
Hi Stephane, This is the well known result of limitted floating point precision (e.g., http://www.validlab.com/goldberg/addendum.html). Using a test of approximate rather than exact equality shows R yields the correct answer: nperm - 1 Fperm - replicate(n=nperm, anova(lm(sample(Y) ~ F,

Re: [R] Plotting boundary lines from shapefiles overtop a map of Canada

2014-09-23 Thread Ray Brownrigg
On 23/09/2014 3:27 a.m., Alain Dubreuil wrote: Hi. I have a requirement to plot a series of points on a map of Canada along with boundaries defining search and rescue (SAR) regions. I have been successful in plotting the map of Canada (Lambert projection) and the points, but I have been

Re: [R] ANOVA and permutation tests : beware of traps

2014-09-23 Thread Prof Brian Ripley
Beware of the trap of listening to people with no knowledge of basic numerical methods! It really is basic that the results of floating-point computer calculations depends on the order in which they are done (and the compiler can change the order). Using == on such calculations is warned

[R] Copying tables from R to Excel

2014-09-23 Thread Angel Rodriguez
Dear Subscribers, I've found this recommendation to paste an R table to Excel: HTML.matrix( summary(iris), file(clipboard, w), append=F ) # paste into Excel After installing R2HTML and writting that command, I get: Error: could not find function HTML.matrix Any clue? Thank you very much,

Re: [R] Copying tables from R to Excel

2014-09-23 Thread Ivan Calandra
library(R2HTML) ?? Le 23/09/14 15:04, Angel Rodriguez a écrit : Dear Subscribers, I've found this recommendation to paste an R table to Excel: HTML.matrix( summary(iris), file(clipboard, w), append=F ) # paste into Excel After installing R2HTML and writting that command, I get: Error:

Re: [R] Copying tables from R to Excel

2014-09-23 Thread Duncan Murdoch
On 23/09/2014 9:04 AM, Angel Rodriguez wrote: Dear Subscribers, I've found this recommendation to paste an R table to Excel: HTML.matrix( summary(iris), file(clipboard, w), append=F ) # paste into Excel After installing R2HTML and writting that command, I get: Error: could not find

Re: [R] Copying tables from R to Excel

2014-09-23 Thread David L Carlson
If you looked at the documentation for R2HTML you might have noticed that there is no function HTML.matrix. Perhaps your recommendation from an unnamed source is out of date? Assuming you loaded the package with library(R2HTML) as Ivan suggested, the command would be HTML( summary(iris),

[R] division of col by the sum of the col

2014-09-23 Thread carol white
Hi, If I want to divide the column of a matrix by the sum of the column, should I loop over the columns or can I use apply family? Regards, Carol [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

Re: [R] division of col by the sum of the col

2014-09-23 Thread Bert Gunter
Neither. Unless I misjudge, you really really need to do your homework and read some basic R documentation -- e.g. An Intro to R, which ships with R (and also the Posting Guide) -- before posting here further. -- Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not

[R] How to combine character month and year columns into one column

2014-09-23 Thread Kuma Raj
Dear R users, I have a data with month and year columns which are both characters and wanted to create a new column like Jan-1999 with the following code. The result is all NA for the month part. What is wrong with the and what is the right way to combine the two? ddf$MonthDay -

[R] R Inter Process Communication tools/packages ?

2014-09-23 Thread ce
Hello All, Is there any IPC tools like in UNIX/Linux systems in R ? I know there is mmap package but I am looking something more like sockets . Any example appreciated . Thx . __ R-help@r-project.org mailing list

Re: [R] R Inter Process Communication tools/packages ?

2014-09-23 Thread John McKown
On Tue, Sep 23, 2014 at 10:50 AM, ce zadi...@excite.com wrote: Hello All, Is there any IPC tools like in UNIX/Linux systems in R ? I know there is mmap package but I am looking something more like sockets . Any example appreciated . Thx . Try looking at the documentation for

Re: [R] How to combine character month and year columns into one column

2014-09-23 Thread Marc Schwartz
On Sep 23, 2014, at 10:41 AM, Kuma Raj pollar...@gmail.com wrote: Dear R users, I have a data with month and year columns which are both characters and wanted to create a new column like Jan-1999 with the following code. The result is all NA for the month part. What is wrong with the and

Re: [R] Plotting boundary lines from shapefiles overtop a map of Canada

2014-09-23 Thread Alain Dubreuil
Hi all, Based on Ray's suggestions, I have tried the following script: library(mapproj) library(maps) resuPdfFileName=C:/linesTest.pdf pdf(resuPdfFileName) # Create a map of Canada in Lambert projection map(database= worldHires,Canada, ylim=c(39,90), xlim=c(-145,-25), col=alpha(grey90,0.5),

Re: [R] Copying tables from R to Excel

2014-09-23 Thread Bos, Roger
Here is a simple method I saw mentioned on this list a few years ago: toExcel - function(x, tag=FALSE) {write.table(x, clipboard-128, sep=\t, row.names=tag)} *** This message and any attachments are for the named person's use only.

Re: [R] Plotting boundary lines from shapefiles overtop a map of Canada

2014-09-23 Thread William Dunlap
testLines - mapproject(yValue, xValue, proj=lambert, param=c(50,65)) For starters, if you give the x,y values in reverse order of what the mapproject function expects you need to label them: y=yValue, x=xValue. (Also, I would have expected longitudes in the Americas to be negative, but

Re: [R] division of col by the sum of the col

2014-09-23 Thread S Ellison
If I want to divide the column of a matrix by the sum of the column, should I loop over the columns or can I use apply family? Looping's unnecessary. See ?scale or ?sweep, with ?colSums for two non-looping answers; apply() also works if you give it a suitable function argument. S

Re: [R] Plotting boundary lines from shapefiles overtop a map of Canada

2014-09-23 Thread William Dunlap
Try: map(database= worldHires,Canada, ylim=c(39,90), xlim=c(-145,-25), col=grey95, fill=TRUE, projection=lambert, param=c(50,65)) lines(mapproject(y=yValue, x=-xValue)) mapproject does care about the sign of the longitude, but if you incompletely reset the projection it messes things up.

Re: [R] How to combine character month and year columns into one column

2014-09-23 Thread Kuma Raj
Many thanks for your quick answer which has created what I wished. May I ask followup question on the same issue. I failed to convert the new column into date format with this code. The class of MonthDay is still character df$MonthDay - format(df$MonthDay, format=c(%b %Y)) I would appreciate if

Re: [R] How to combine character month and year columns into one column

2014-09-23 Thread Marc Schwartz
Two things: 1. You need to convert the result of the paste() to a Date related class. 2. R's standard Date classes require a full date, so you would have to add in some default day of the month: See ?as.Date NewDate - as.Date(paste(month.abb[as.numeric(ddf$month)], 01, ddf$Year, sep=-),

Re: [R] How to combine character month and year columns into one column

2014-09-23 Thread David Winsemius
Marc; Feature request: Would it make sense to construct month.abb as a named vector so that the operation that was attempted would have succeeded? Adding alphanumeric names c(01, 02, 03, 04, 05, 06, 07, 08, 09, 10, 11, 12) would allow character extraction from substring or regex extracted

Re: [R] How to combine character month and year columns into one column

2014-09-23 Thread Marc Schwartz
Hi David, My initial reaction (not that the decision is mine to make), is that from a technical perspective, obviously indexing by name is common. There are two considerations, off the top of my head: 1. There would be a difference, of course, between: month.abb[1] NA NA and

Re: [R] division of col by the sum of the col

2014-09-23 Thread Rolf Turner
On 24/09/14 03:10, carol white wrote: Hi, If I want to divide the column of a matrix by the sum of the column, should I loop over the columns or can I use apply family? m1 - apply(m,2,function(x){x/sum(x)}) should do what you want IIUYC. cheers, Rolf Turner -- Rolf Turner Technical Editor

Re: [R] division of col by the sum of the col

2014-09-23 Thread peter dalgaard
On 23 Sep 2014, at 23:30 , Rolf Turner r.tur...@auckland.ac.nz wrote: On 24/09/14 03:10, carol white wrote: Hi, If I want to divide the column of a matrix by the sum of the column, should I loop over the columns or can I use apply family? m1 - apply(m,2,function(x){x/sum(x)}) should do

[R] Error Reading from Connection

2014-09-23 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello, I am running Rx64 3.03 under Windows 8 environment. I have been getting the following error. when running some of my old R applications. Below is a mock-up example. Could someone please help me resolve the issue? Thanks, Pradip Muhuri setwd (D:/) #load Rdata file

Re: [R] Error Reading from Connection

2014-09-23 Thread Jeff Newmiller
Insufficient information, and irrelevant information (the second error is a direct consequence of the first). We have no way of knowing based on this input that your file is there. (?list.files). We also don't know if you have read access to that file (?file.access). Since you posted in HTML

Re: [R] Error Reading from Connection

2014-09-23 Thread Muhuri, Pradip (SAMHSA/CBHSQ)
Hello, Thank you so much for your guidance. This time I am providing more information. R Script and R Console are appended below. The list.files() below provides evidence the existence of this file in the temp directory. Please note that the heroin.rdata file was created from the SAS data

[R] taking daily modes from hourly data

2014-09-23 Thread maria cabello
Dear all, I have a data frame (datos) of hourly wind speed and direction with 4columns (1st date, 2nd hour, 3rd wind speed and 4rth wind direction). I have been able to do the daily mean of the wind speed, but when I try to get the more frequent wind direction of every day, it doesn't work. I

[R] Is there a log file on Window keeping track of the history of package installation (when was a package installed and what package was installed)?

2014-09-23 Thread Li, Qingqin [JRDUS]
I'm using a package and need to keep track of the version of the database used. Initially, I was under the impression that the package was querying a remote database live and therefore the data version would be the date of my query. This turned out to be an incorrect assumption, and the

[R] Optometrists and Ophthalmologists dataset

2014-09-23 Thread Tony Parker
Hi, Hope you are doing well. My name is Tony I came across your company website and I could see Optometrists and Ophthalmologists is your one of the targeted specialist, so I thought of asking if you would be interested in acquiring a complete data-set of Optometrists and Ophthalmologists?

[R] Need help with R in Boston area this Friday-Sunday paid gig

2014-09-23 Thread Richard Lerner
I have a project that I have to do this Friday-Sunday. I have 2 dirty excel spreadsheets that I need brought into R, cleaned up, and then some descriptive statistics run. I am very new to R and not having fun. I can pay, but you will need to 1) be expert and 2) be willing to show me how the work

Re: [R] Error Reading from Connection

2014-09-23 Thread Jeff Newmiller
The Value section of the help page describes what the function returns... in this case a vector of 1 named integer element that is zero (success), based on the question you asked (is it readable). Given this input I would suggest that you confirm that the software that produced this file was

[R] Median of streaming data

2014-09-23 Thread Mohan Radhakrishnan
Hi, I have streaming data(1 TB) that can't fit in memory. Is there a way for me to find the median of these streaming integers assuming I can fit only a small part in memory ? This is about the statistical approach to find the median of a large number of values when I can inspect only a