Re: [R] sqrt(-x) vs. -x^0.5

2012-03-21 Thread Mike Williamson
Thanks Sarah, All, I guess I never thought of a negative sign as an "operation", but knowing that it is considered an operation explains everything nicely. Somewhere in it's underbelly, I suppose -4 is represented as "0 - 4"? Either way, I'm glad it is consistent & accurate, so that I didn't

[R] sqrt(-x) vs. -x^0.5

2012-03-21 Thread Mike Williamson
Hi Everyone, I did a search through the archives and did not find an answer, although I must admit it is a hard search to do ( ^0.5 is tough to explicitly search for ). I am sure there is some mathematically accurate reason to explain the following, but I guess I either never learned it o

Re: [R] any updates w.r.t. lapply, sapply, apply retaining classes

2011-11-03 Thread Mike Williamson
t familiar with numPy so I do not know how it handles new > classes, but with some tweaks to my workflow, I do not find myself > running into problems with how R handles them. I definitely > appreciate your position because I have been there...as I became more > familiar with R, classe

[R] any updates w.r.t. lapply, sapply, apply retaining classes

2011-11-03 Thread Mike Williamson
Hi All, I don't have a "I need help" question, so much as a query into any update whether 'R' has made any progress with some of the core functions retaining classes. As an example, because it's one of the cases that most egregiously impacts me & my work and keeps pushing me away from 'R' and

Re: [R] any way to convert back to DateTime class when "accidental" conversion to numeric?

2011-10-06 Thread Mike Williamson
argument if you need to restore the timezone. > > > On Wed, 5 Oct 2011, jim holtman wrote: > > Here is what I use: >> >> unix2POSIXct(1317857320) >> [1] "2011-10-05 19:28:40 EDT" >> >> >> unix2POSIXct <- function (time) structure

[R] any way to convert back to DateTime class when "accidental" conversion to numeric?

2011-10-05 Thread Mike Williamson
Hi, In short, I would like to know if there is any way to convert a numeric into a date, similar to how strptime() can convert a string to a date time class? There are some functions, etc. which don't work well with dates, and tend to force them into numerics. I understand that the numbe

Re: [R] S4 classes, some help with the basics

2011-08-09 Thread Mike Williamson
Thanks Duncan, Martin, You both provided exactly what I needed! Regards, Mike --- XKCD <http://www.xkcd.com> On Mon, Aug 8, 2011 at 5:21 PM, Duncan Murdoch wrote: > On 08/08/2011 8:04 PM, Mike Williamson wrote: > >> H

[R] S4 classes, some help with the basics

2011-08-08 Thread Mike Williamson
Hi All, I have tried to find an answer within documentation, but I cannot: o How can call a class "slot" without knowing the name a priori? E.g., let's say I use the "pcaMethods" library to create a "pcaRes" object. How can I call parts of that object without using the specific names of

Re: [R] manipulating the Date & Time classes

2011-02-08 Thread Mike Williamson
gt;> > [1] "2010-12-14 20:25:40 PST" "2010-12-10 08:15:20 PST" > [3] "2010-10-05 05:12:10 PDT" > > That is, just force the class back to POSIXct, don't use as.POSIXct. > > Hope this helps. >- Phil Spector >

[R] manipulating the Date & Time classes

2011-02-08 Thread Mike Williamson
Hello, This is mostly to developers, but in case I missed something in my literature search, I am sending this to the broader audience. - Are there any plans in the works to make "time" classes a bit more friendly to the rest of the "R" world? I am not suggesting to allow for fancy

Re: [R] syntax for extending a line in a script??

2011-01-12 Thread Mike Williamson
ic score, Minard's Napoleanic war: The most exciting frontier is charting what's already here." -- xkcd -- Help protect Wikipedia. Donate now: http://wikimediafoundation.org/wiki/Support_Wikipedia/en On Wed, Jan 12, 2011 at 6:08 PM, Brian Diggs wrote: > On 1/12/2011 2:46 PM, M

[R] syntax for extending a line in a script??

2011-01-12 Thread Mike Williamson
Hello, A hopefully simple question. I use 'R' through emacs, but I suspect the following would occur with any manner of text editor: - my editor has a normally quite handy feature where it will automatically indent to the appropriate level when I start a new line. However, this occa

[R] ideas, modeling highly discrete time-series data

2010-12-20 Thread Mike Williamson
Hello all, First of all, thanks so those of you who helped me a week or so ago managing a time series with varying gaps between the data series in 'R'. (My final preferred solution was to use "its" function & then forecast(Arima( ) ). ) My next question is a general statistical question

[R] how to convert "sloppy data" into a time series?

2010-12-16 Thread Mike Williamson
Hi All, First let me state that I did search for a while on r-help, google, and using the "sos" package inside of 'R', without much luck. I want to know how to create a univariate time series from a set of data that will have huge time gaps in it. For instance, here is a snapshot of a piece

Re: [R] How to get 'R' to talk BACK to other languages / scripts??

2010-12-06 Thread Mike Williamson
? > > #!/bin/bash > myTest=$(Rscript testing.R.r) > echo "myTest contains" > echo $myTest > > Note that testing.R.r will have to cat() or print() myResult (e.g, my > testing.R.r contains > > myResult <- paste("Hello World") > cat(myResult) > &g

[R] How to get 'R' to talk BACK to other languages / scripts??

2010-12-03 Thread Mike Williamson
Hey everyone, I know that I can call 'R' from other scripts, and that I can make command calls from 'R' (e.g., using system() ). But how can I get 'R' to RETURN values to the script that called it. E.g., I would like to be able to do something like the following (as a simpler example) from a

Re: [R] trouble with RODBC -- chopping off part of column names

2010-10-04 Thread Mike Williamson
rd's Napoleanic war: The most exciting frontier is charting what's already here." -- xkcd -- Help protect Wikipedia. Donate now: http://wikimediafoundation.org/wiki/Support_Wikipedia/en On Sat, Oct 2, 2010 at 6:31 AM, Marc Schwartz wrote: > On Oct 1, 2010, at 6:26 PM, Mike Wil

[R] trouble with RODBC -- chopping off part of column names

2010-10-01 Thread Mike Williamson
Hello all, I have a strange / interesting problem that might be 'R' settings themselves, or it might be something with the OS. I am using the RODBC library. I have a script that goes out and, before making a query for a big data set, will first query for the column names of the data set.

[R] odd behavior of "summary" function

2010-08-24 Thread Mike Williamson
Hello All, Using the standard "summary" function in 'R', I ran across some odd behavior that I cannot understand. Easy to reproduce: Typing: summary(c(6,207936)) Yields:: Min. *1st Qu. MedianMean 3rd Qu.Max.* 6 *51990 104000 104000 156000 207900* None of t

[R] some helpful tips on using RODBC

2010-08-13 Thread Mike Williamson
Hey everyone, I don't have a question. Instead some helpful advice with things I've learned from trying to connect 'R' to databases using RODBC. ROBDC is a very handy tool that, once you have everything fixed up nicely, is a great way to have scripts run fairly autonomously, safe in the

[R] ggplot2 histograms... a subtle error found

2010-07-28 Thread Mike Williamson
Hello all, I have a peculiar and particular bug that I stumbled across with ggplot2. I cannot seem to replicate it with anything other than my specific data set. Here is the problem: - when I try to plot a histogram, allowing for ggplot2 to decide the binwidths itself, I get the f

[R] question regarding "varImpPlot" results vs. model$importance data on package "RandomForest"

2010-07-13 Thread Mike Williamson
Hi everyone, I have another "Random Forest" package question: - my (presumably incorrect) understanding of the varImpPlot is that it should plot the "% increase in MSE" and "IncNodePurity" exactly as can be found from the "importance" section of the model results. - However, th

Re: [R] anyone know why package "RandomForest" na.roughfix is so slow??

2010-07-01 Thread Mike Williamson
.default(x[!missing]) > } else if (is.factor(x)) { >freq <- table(x) >x[missing] <- names(freq)[which.max(freq)] > } else { >stop("na.roughfix only works for numeric or factor") > } > x > } > > I'm cheating a bit because as.data.fram

Re: [R] anyone know why package "RandomForest" na.roughfix is so slow??

2010-07-01 Thread Mike Williamson
gt; system.time(x.fixed <- na.roughfix(x)) >user system elapsed >8.440.398.85 > R 2.11.1, randomForest 4.5-35, Windows XP (32-bit), Thinkpad T61 with 2GB > ram. > > Andy > > -- > *From:* Mike Williamson [mailto:this.is..

Re: [R] anyone know why package "RandomForest" na.roughfix is so slow??

2010-07-01 Thread Mike Williamson
gt; randomForest(myroughfixed[list.of.predictor.columns], > myroughfixed[[myresponse]],...) > > HTH, > Andy > > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] > On Behalf Of Mike Williamson > Sent: Wednesday, June 30,

[R] anyone know why package "RandomForest" na.roughfix is so slow??

2010-06-30 Thread Mike Williamson
Hi all, I am using the package "random forest" for random forest predictions. I like the package. However, I have fairly large data sets, and it can often take *hours* just to go through the "na.roughfix" call, which simply goes through and cleans up any NA values to either the median (numer

Re: [R] how can I evaluate a formula passed as a string?

2010-06-24 Thread Mike Williamson
rontier is charting what's already here." -- xkcd -- Help protect Wikipedia. Donate now: http://wikimediafoundation.org/wiki/Support_Wikipedia/en On Thu, Jun 24, 2010 at 10:29 AM, Peter Langfelder < peter.langfel...@gmail.com> wrote: > On Thu, Jun 24, 2010 at 10:16 AM, Mike Williams

[R] how can I evaluate a formula passed as a string?

2010-06-24 Thread Mike Williamson
Hey everyone, I've been using 'R' long enough that I should have some idea of what the heck either expression() or eval() are really ever useful for. I come across another instance where I WISH they would be useful, but I cannot get them to work. Here is the crux of what I would like

[R] trouble with Vista & reading files

2009-08-20 Thread Mike Williamson
All, I am having trouble with a "read.table()" function that is inside of another function. But if I call the function by itself, it works fine. Moreover, if I run the script on a Mac OS X (with the default Mac OS X version of R installed, rev 2.8), it works fine. But it does not work if I r

[R] How to get legend outside of plot?

2009-01-13 Thread Mike Williamson
I am creating a CDF plot function more user-friendly than any default r function. Depending upon the bimodality of the data (it is often bimodal), or any other strange data trends, the points can end up gathering in just about any corner of the plot. So, when I add a legend, whether I choose

Re: [R] How to capture multiple graph pages to .png ?

2009-01-05 Thread Mike Williamson
. Regardless, with it shown in 2 locations, clearly I was off my rocker... Mike On Mon, Jan 5, 2009 at 5:08 PM, Deepayan Sarkar wrote: > On Mon, Jan 5, 2009 at 4:57 PM, Mike Williamson > wrote: > > Greg, others, > > > >Thanks for the info! I sus

Re: [R] How to capture multiple graph pages to .png ?

2009-01-05 Thread Mike Williamson
t; > Hope this helps, > > -- > Gregory (Greg) L. Snow Ph.D. > Statistical Data Center > Intermountain Healthcare > greg.s...@imail.org > 801.408.8111 > > > > -Original Message- > > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- >

Re: [R] How to capture multiple graph pages to .png ?

2009-01-03 Thread Mike Williamson
gards, Mike On Sat, Jan 3, 2009 at 8:36 AM, jim holtman wrote: > W.R.T. multiple pages, the HELP page says to use a filename like this: > > png(filename = "Rplot%03d.png", > > where %03d is an incremented value for each page. > > On Fri, Jan 2, 2009

[R] How to capture multiple graph pages to .png ?

2009-01-03 Thread Mike Williamson
Hello all and thanks in advance for any help, There are really two issues that I am having, both related to saving graphs: 1) It seems that the "dev...()" functions are unstable when using higher level graphs (specifically I was using levelplot) 2) I have a large grid of levelplot graphs that

Re: [R] How to make a smooth ( linear ) CDF plot? -- Thanks!

2008-12-18 Thread Mike Williamson
> On Mon, Dec 15, 2008 at 9:48 PM, Mike Williamson wrote: > >>I want to make some simple CDF (cumulative distribution function) plots >> to check whether distributions are Gaussian / normal. > > > qqnorm() > > >>As long as I am asking: I also want to pl

[R] How to make a smooth ( linear ) CDF plot?

2008-12-15 Thread Mike Williamson
the same graph, where each factor has it's own cdf line. Any ideas for this? THanks in advance! Mike Williamson [[alternative HTML version deleted]] __ R-help@r-project.or

[R] What editors can I get R in Mac OS X to talk to?

2008-10-23 Thread Mike Williamson
All, Apologies if this was already answered... I couldn't find an answer that specifically addressed Mac OS instead of either windows or linux. I use "aquamacs emacs" as my text editor. It is essentially Xemacs with a GUI that looks closer to standard Mac GUIs, as far as I can tell. I insta