Re: [R] matrix manipulation question

2015-03-27 Thread peter dalgaard
On 27 Mar 2015, at 09:58 , Stéphane Adamowicz stephane.adamow...@avignon.inra.fr wrote: data_no_NA - data[, complete.cases(t(data))==T] Ouch! logical == TRUE is bad, logical == T is worse: data[, complete.cases(t(data))] -- Peter Dalgaard, Professor, Center for Statistics, Copenhagen

Re: [R] matrix manipulation question

2015-03-27 Thread PIKAL Petr
Very, very, very bad solution. as.matrix can change silently your data to unwanted format, complete.cases()==T is silly as Peter already pointed out. I use head(airquality[ ,colSums(is.na(airquality))==0]) Wind Temp Month Day 1 7.4 67 5 1 2 8.0 72 5 2 3 12.6 74 5 3

Re: [R] matrix manipulation question

2015-03-27 Thread Stéphane Adamowicz
Well, it seems to work with me. Y - as.matrix(airquality) head(Y, n=8) Ozone Solar.R Wind Temp Month Day [1,]41 190 7.4 67 5 1 [2,]36 118 8.0 72 5 2 [3,]12 149 12.6 74 5 3 [4,]18 313 11.5 62 5 4 [5,]NA NA 14.3 56

Re: [R] matrix manipulation question

2015-03-27 Thread Stéphane Adamowicz
Why not use complete.cases() ? data_no_NA - data[, complete.cases(t(data))==T] Le 27 mars 2015 à 06:13, Jatin Kala jatin.kala...@gmail.com a écrit : Hi, I've got a rather large matrix of about 800 rows and 60 columns. Each column is a time-series 800 long. Out of these 60 time

Re: [R] Why can't I access this type?

2015-03-27 Thread Patrick Connolly
On Thu, 26-Mar-2015 at 04:58PM -0400, yoursurrogate...@gmail.com wrote: [...] | I agree with you on the indexing approach. But even after using | within, I still get the same error. You leave us to guess just what you tried, but if you did this: all.states -

Re: [R] Vennerable Plots for Publications

2015-03-27 Thread Jim Lemon
HI Dario, Have you tried creating a larger PNG image and then shrinking the result with an image manipulation program (e.g. GIMP)? Jim On Fri, Mar 27, 2015 at 4:00 PM, Dario Strbenac dstr7...@uni.sydney.edu.au wrote: Does anyone make Venn diagrams for publication using Vennerable ? I found

Re: [R] matrix manipulation question

2015-03-27 Thread Stéphane Adamowicz
Le 27 mars 2015 à 12:34, PIKAL Petr petr.pi...@precheza.cz a écrit : Very, very, very bad solution. as.matrix can change silently your data to unwanted format, complete.cases()==T is silly as Peter already pointed out. Perhaps, but it happens that in the original message, the

Re: [R] matrix manipulation question

2015-03-27 Thread PIKAL Petr
Hi -Original Message- From: Stéphane Adamowicz [mailto:stephane.adamow...@avignon.inra.fr] Sent: Friday, March 27, 2015 1:26 PM To: PIKAL Petr Cc: peter dalgaard; r-help@r-project.org Subject: Re: [R] matrix manipulation question Le 27 mars 2015 à 12:34, PIKAL Petr

Re: [R] matrix manipulation question

2015-03-27 Thread Stéphane Adamowicz
example. Furthermore in my example no unwanted format occurred. You can Yes because data.frame was (luckily) numeric. Luck has nothing to do with this. I Chose this example on purpose … Stéphane __ R-help@r-project.org mailing list -- To

[R] Calculating area of polygons created from a spatial intersect

2015-03-27 Thread Walter Anderson
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Hello all, I am attempting to automate an analysis that I developed with ArcInfo using R and the gdal and geos packages (or any other) if possible. Here is the basic process I have a shape file (lines) that defines the limits of all of the projects

[R] Problem with download.file ?

2015-03-27 Thread Giles Crane
# download.file() Seems to put the xlsx file onto hard drive. download.file(http://www.udel.edu/johnmack/data_library/zipcode_centroids.xlsx;, zipcode_centroids.xlsx) trying URL 'http://www.udel.edu/johnmack/data_library/zipcode_centroids.xlsx' Content type

Re: [R] Problem with download.file ?

2015-03-27 Thread William Dunlap
Add the argument mode=wb to your call to download.file(). On Windows this means to use 'binary' format - do not change line endings. Bill Dunlap TIBCO Software wdunlap tibco.com On Fri, Mar 27, 2015 at 7:25 AM, Giles Crane gilescr...@verizon.net wrote: # download.file() Seems to put the xlsx

Re: [R] matrix manipulation question

2015-03-27 Thread David Winsemius
On Mar 27, 2015, at 3:41 AM, Stéphane Adamowicz wrote: Well, it seems to work with me. No one is doubting that it worked for you in this instance. What Peter D. was criticizing was the construction : complete.cases(t(Y))==T ... and it was on two bases that it is wrong. The first is that

Re: [R] Calculating area of polygons created from a spatial intersect

2015-03-27 Thread MacQueen, Don
Suggest (strongly) that you move this question to r-sig-geo. Much more appropriate there, and more people there are more familiar with this kind of work. But ... I suspect you want gIntersection(), not gIntersects(). -Don -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave.,

Re: [R] Having trouble with gdata read in

2015-03-27 Thread Benjamin Baker
Anthony, XLSX won’t read an XLS file. Additionally, the legacy Java that is required for the xlsx package really effs up my computer. Have to reinstall my OS to fix it. — Sent from Mailbox On Wed, Mar 25, 2015 at 3:51 PM, Anthony Damico ajdam...@gmail.com wrote: maybe library(xlsx)

[R] Categorizing by month

2015-03-27 Thread lychang
Hi everyone, I'm trying to categorize by month in R. How can I do this if my dates are in date/month/year form? Thanks, Lois -- View this message in context: http://r.789695.n4.nabble.com/Categorizing-by-month-tp4705173.html Sent from the R help mailing list archive at Nabble.com.

[R] vif in package car: there are aliased coefficients in the model

2015-03-27 Thread Rodolfo Pelinson
Hello. I'm trying to use the function vif from package car in a lm. However it returns the following error: Error in vif.default(lm(MDescores.sitescores ~ hidroperiodo + localizacao + : there are aliased coefficients in the model When I exclude any predictor from the model, it returns this

Re: [R] matrix manipulation question

2015-03-27 Thread Henric Winell
On 2015-03-27 11:41, Stéphane Adamowicz wrote: Well, it seems to work with me. Y - as.matrix(airquality) head(Y, n=8) Ozone Solar.R Wind Temp Month Day [1,]41 190 7.4 67 5 1 [2,]36 118 8.0 72 5 2 [3,]12 149 12.6 74 5 3 [4,]18 313

Re: [R] Having trouble with gdata read in

2015-03-27 Thread Benjamin Baker
Jim, Thanks, XLConnect with proper syntax works great for both types of files. — Sent from Mailbox On Thu, Mar 26, 2015 at 5:15 AM, jim holtman jholt...@gmail.com wrote: My suggestion is to use XLConnect to read the file: x -

Re: [R] matrix manipulation question

2015-03-27 Thread Jatin Kala
Thanks Richard, This works, rather obvious now that i think of it! =) On 27/03/2015 4:30 pm, Richard M. Heiberger wrote: just reverse what you did before. newdata - data newdata[] - NA newdata[,!apply(is.na(data), 2, any)] - myfunction(data_no_NA) On Fri, Mar 27, 2015 at 1:13 AM, Jatin Kala

Re: [R] Why can't I access this type?

2015-03-27 Thread Henric Winell
On 2015-03-27 09:19, Patrick Connolly wrote: [...] On Sun, 22-Mar-2015 at 08:06AM -0800, John Kane wrote: | Well, first off, you have no variable called Name. You have lost | the state names as they are rownames in the matrix state.x77 and | not a variable. If you did this: all.states -

Re: [R] Using and abusing %% (was Re: Why can't I access this type?)

2015-03-27 Thread Henric Winell
On 2015-03-26 07:48, Patrick Connolly wrote: On Wed, 25-Mar-2015 at 03:14PM +0100, Henric Winell wrote: ... | Well... Opinions may perhaps differ, but apart from '%%' being | butt-ugly it's also fairly slow: Beauty, it is said, is in the eye of the beholder. I'm impressed by the way using

Re: [R] Having trouble with gdata read in

2015-03-27 Thread Benjamin Baker
Jim, I’m not seeing the command f.readXLSheet in the documentation, nor is it executing in my code. — Sent from Mailbox On Thursday, Mar 26, 2015 at 5:15 AM, jim holtman jholt...@gmail.com, wrote: My suggestion is to use XLConnect to read the file: x -

[R] hash - extract key values

2015-03-27 Thread Brian Smith
Hi, I was trying to use hash, but can't seem to get the keys from the hash. According to the hash documentation ('hash' package pdf, the following should work: hx - hash( c('a','b','c'), 1:3 ) class(hx) [1] hash attr(,package) [1] hash hx$a [1] 1 keys(hx) Error in (function (classes, fdef,

Re: [R] Categorizing by month

2015-03-27 Thread Ben Tupper
Hi, On Mar 27, 2015, at 12:06 PM, lychang lych...@emory.edu wrote: Hi everyone, I'm trying to categorize by month in R. How can I do this if my dates are in date/month/year form? I'm not sure about the date form you describe, but if you have the dates as POSIXct you can extract the

Re: [R] Having trouble with gdata read in

2015-03-27 Thread jim holtman
pardon me it was my function which is just a call to readWorksheetFromFile Jim Holtman Data Munger Guru What is the problem that you are trying to solve? Tell me what you want to do, not how you want to do it. On Fri, Mar 27, 2015 at 3:52 PM, Benjamin Baker bba...@reed.edu wrote: Jim, I’m

Re: [R] hash - extract key values

2015-03-27 Thread Boris Steipe
Works for me : library(hash) hash-2.2.6 provided by Decision Patterns hx - hash( c('a','b','c'), 1:3 ) class(hx) [1] hash attr(,package) [1] hash hx$a [1] 1 keys(hx) [1] a b c Maybe restart your session? Clear your workspace? Upgrade? B. On Mar 27, 2015, at 7:39 PM, Brian Smith

Re: [R] vif in package car: there are aliased coefficients in the model

2015-03-27 Thread John Fox
Dear Rodolfo, It's apparently the case that at least one of the columns of the model matrix for your model is perfectly collinear with others. There's not nearly enough information here to figure out exactly what the problem is, and the information that you provided certainly falls short of

Re: [R] Using and abusing %% (was Re: Why can't I access this type?)

2015-03-27 Thread Hadley Wickham
I didn't dispute whether '%%' may be useful -- I just pointed out that it is slow. However, it is only part of the problem: 'filter()' and 'select()', although aesthetically pleasing, also seem to be slow: all.states - data.frame(state.x77, Name = rownames(state.x77)) f1 - function() +