[R] stop on rows where !is.na(mydata$ti_all)

2012-09-24 Thread Eric Fail
Dear R experts, I got help to build a loop but there is a bug inside it that causes one part of the mechanism to fail. It should grow once, but if keep growing on rows where $ti_all is not NA. Here is a wall of code that very crudely demonstrates the problem, there is a couple of dim() outputs a

Re: [R] Parsing "back" to API strcuture

2012-09-17 Thread Eric Fail
row.names=FALSE)) out <- paste0(c(l1, l2, ""), collapse="\n") ## Reattach attributes att <- list("`Content-Type`" = structure(c("text/html", "utf-8"), .Names = c("", "charset"))) attrib

Re: [R] Parsing "back" to API strcuture

2012-09-13 Thread Eric Fail
Content-Type`" = structure(c("text/html", "utf-8"), .Names = c("", >> "charset"))) >> x <- read.csv(textConnection(RAW.API), as.is = TRUE) >> x > id event_arm namedob pushed_text pushed_calc complete > 1 1 event_1

[R] Parsing "back" to API strcuture

2012-09-12 Thread Eric Fail
Dear R experts, I'm reading data from an online database via API and it gets delivered in this messy comma separated structure, > RAW.API <- > structure("id,event_arm,name,dob,pushed_text,pushed_calc,complete\n\"01\",\"event_1_arm_1\",\"John\",\"1979-05-01\",\"\",\"\",2\n\"01\",\"event_2_arm_1\

Re: [R] subtract a list of vectors from a list of data.frames in an elegant way

2012-03-31 Thread Eric Fail
be the most elegant solution, but it works. Best, Eric On Thu, Mar 29, 2012 at 4:07 AM, Jim Holtman wrote: > > ?setdiff > > Sent from my iPad > > On Mar 29, 2012, at 4:28, "Eric Fail" wrote: > > > Dear R experts, > > > > I've realized that it mig

[R] subtract a list of vectors from a list of data.frames in an elegant way

2012-03-29 Thread Eric Fail
Dear R experts, I've realized that it might not be possible to define a negative SELCET statement in a SQL call so now I'm looking for the smoothest way to generate a list of what I would like from my large database by first pulling all the names with a query like this "SELECT top 1 * FROM your

Re: [R] Is it possible to de-select with sqlQuery from the RODBC library?

2012-03-28 Thread Eric Fail
Thank you Bart for your idea, the thing is that I have a large number of tables and I would like to avoid having to pull them at all. I currently have a list that I use as a lookup table in a loop with an if else statement to sort between tables I want to sqlFetch (take everything) and tables wher

[R] Is it possible to de-select with sqlQuery from the RODBC library?

2012-03-27 Thread Eric Fail
Dear R-list, I'm queering a M$ Access database with the sqlQuery function from the RODBC library. As I cannot make a working example with a database here is an illustrative example, library(RODBC) mdbConnect<-odbcConnectAccess("S:/data/ ... /databse.mdb") data <- sqlQuery(mdbConnect, "select id

[R] Sankey Diagrams in R

2012-03-18 Thread Eric Fail
Dear R-list, I am trying to visualize where the dropout happens in our patient flow. We are currently using traditional flowcharts and it bothers me that I can't visualize both the percentage and the flow in one diagram. The other day I came across some interesting diagrams doing exactly what I

Re: [R] looping over string of frames when importing with 'sqlFetch' from a Microsoft Access database

2012-02-24 Thread Eric Fail
correction, this is the working R script, forgot '1: ... )', dfn = list(); for (i in 1:length(stringTables)) { dfn[[i]] <- sqlFetch(mdbConnect, stringTables[[i]]) } On Fri, Feb 24, 2012 at 4:48 PM, Eric Fail wrote: > Problem solved thanks to Peter Langfelder's response to

Re: [R] looping over string of frames when importing with 'sqlFetch' from a Microsoft Access database

2012-02-24 Thread Eric Fail
>i<http://piratepad.net/i> ]]) } Thanks, Eric On Fri, Feb 24, 2012 at 3:19 PM, Eric Fail wrote: > Dear R-list, > > I am trying to import (all) frames from a Microsoft Access database as > individual data frames in a fancy loop, but I'm having troubles figuring > out

[R] looping over string of frames when importing with 'sqlFetch' from a Microsoft Access database

2012-02-24 Thread Eric Fail
Dear R-list, I am trying to import (all) frames from a Microsoft Access database as individual data frames in a fancy loop, but I'm having troubles figuring out how to use the 'sqlFetch' from the RODBS package in a loop (mostly because I can't figure out how to loop over elements (I came from s

Re: [R] plotting and coloring longitudinal data with three time points (ggplot2)

2011-12-07 Thread Eric Fail
Thank you for solving my problem, it worked out beautifully. This was exactly what I was looking for, the ggplot2 package keeps impressing me. Thanks, Eric On Wed, Dec 7, 2011 at 6:01 AM, Hadley Wickham wrote: > On Wed, Dec 7, 2011 at 4:02 AM, Eric Fail wrote: >>  Dear list, >>

[R] plotting and coloring longitudinal data with three time points (ggplot2)

2011-12-07 Thread Eric Fail
Dear list, I have been struggling with this for some time now, and for the last hour I have been struggling to make a working example for the list. I hope someone out there have some experience with plotting longitudinal data that they will share. My data is some patient data with three differ

Re: [R] merge with origin information in new variable names

2011-04-25 Thread Eric Fail
N: Basics: ##.#. ##.#. Live Go... > Live: OO#.. Dead: OO#.. Playing > Research Engineer (Solar/Batteries O.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > --- > Sent from my phone

[R] merge with origin information in new variable names

2011-04-24 Thread Eric Fail
Dear R-list, Here is my simple question, I have n data frames that I would like to merge, but I can't figure out how to add information about the origin of the variable(s). Here is my problem, DF.wave.1 <- data.frame(id=1:10,var.A=sample(letters[1:4],10,TRUE)) DF.wave.2 <- data.frame(id=1:10,va

Re: [R] Parsing question, partly comma separated partly underscore separated string

2011-03-07 Thread Eric Fail
s4 <- gsub("_", ",", s3) s5 <- read.table(textConnection(s4[1]), sep = ",") DF <- read.table(textConnection(s4), skip = 1, sep = ",", as.is = TRUE) DF$block <- head(cumsum(c("", DF$V8) == "BLOCK")+1, -1) DF$run <- ave(DF$bloc

[R] Parsing question, partly comma separated partly underscore separated string

2011-03-06 Thread Eric Fail
Dear R-list, I have a partly comma separated partly underscore separated string that I am trying to parse into R. Furthermore I have a bunch of them, and they are quite long. I have now spent most of my Sunday trying to figure this out and thought I would try the list to see if someone here wo

Re: [R] ggplot2, 'se' variable in geom_errorbar's limits?

2011-02-19 Thread Eric Fail
me know if not. The example I sent > earlier was just for simplicity. > Scott > > On Saturday, February 19, 2011 at 4:58 PM, Eric Fail wrote: > > Hi Scott, > > Thank you for taking the time to look at my problem! > > I played around with your example and realized that i

Re: [R] ggplot2, 'se' variable in geom_errorbar's limits?

2011-02-19 Thread Eric Fail
> > ggplot(diamonds_df, aes(x = cut, y = mean_price)) + > > geom_point() + > > geom_errorbar(limits, width=0.2) > > Sincerely, > > Scott Chamberlain > > Rice University, EEB Dept. > > On Saturday, February 19, 2011 at 3:12 PM, Eric Fail wrote: > > Can'

Re: [R] ggplot2, 'se' variable in geom_errorbar's limits?

2011-02-19 Thread Eric Fail
Can't anybody give me a hint on how to solve this? I even bought the ggplot2-book, so you could also give a page (or a series of pages). Thanks, Eric On Thu, Feb 17, 2011 at 10:19 AM, Eric Fail wrote: > > Dear R-list > > I'm working with with geom_errorbar; spec

[R] ggplot2, 'se' variable in geom_errorbar's limits?

2011-02-17 Thread Eric Fail
Dear R-list I'm working with with geom_errorbar; specifically I'm trying to reproduce the example Hadley Wickham have on http://had.co.nz/ggplot2/geom_errorbar.html (all in the button of the page) where he makes an nice plot with errorbars and then draw lines between the points. What confuses me

[R] wildcard operator

2010-05-26 Thread Eric Fail
Hi Ruser As so usual I'm trying to replicate some SAS code. I wold like to know if there is a wildcard operators, as " : " in SAS, in R? When running: lm(y ~ x1 + x2 + x3 + x4 + x5 + x6 x9860, data=mydata) I would like to be able to get around it by just writing something like this:

[R] big panel: filehash, bigmemory or other

2010-02-22 Thread Eric Fail
Dear R-list I'm on my way to start a new project on a rather big panel, consisting of approximately 8 million observations in 30 waves of data and about 15 variables. I have a similar data set that is approximately 7 gigabytes in size. Until now I have done my data management in SAS, and

Re: [R] ggplot2: ... seem to be overwriting each other

2010-01-31 Thread Eric Fail
scale_x_continuous(breaks = NA) > plot + geom_line() + > geom_smooth(aes(group = male, colour = male), size = 1.2, > se = FALSE) + > scale_x_continuous(breaks = c(10, 12, 13, 15)) + > scale_colour_hue("gender") > > The last line changes

[R] ggplot2: ... seem to be overwriting each other

2010-01-31 Thread Eric Fail
Dear list A week ago Dennis Murphy helped me out by showing me some nice ggplot2 tricks . Now I got stuck in a new problem that I can't solve (I have ordered the ggplot2-book). My problem is that I can't add my spline (or geom_smooth) and at the same time control the grid (using scale_x_c

Re: [R] add spline to longitudinal data - preferably similar to SAS's 'I=SM50S' routine

2010-01-18 Thread Eric Fail
ndividual spaghetti plots, and by default, a confidence envelope > around it. To get rid > of the envelope, include se = FALSE as an argument to geom_smooth(); > to change the > color, add the argument colour = 'red', for example. > > HTH, > Dennis > > On Mon, Jan

[R] add spline to longitudinal data - preferably similar to SAS's 'I=SM50S' routine

2010-01-18 Thread Eric Fail
Hi Ruser I'm trying to replicate some SAS code. I have to add a spline to my longitudinal spaghetti plot. I have the plot, but I can't add the spline, a overall trend line. In the SAS code they use the command 'I=SM50S' and I would prefer something similar. I’m using R 2.10.1 on windows

[R] linear trend line and a quadratic trend line.

2009-11-08 Thread Eric Fail
Dear list users How is it possible to visualise both a linear trend line and a quadratic trend line on a plot of two variables? Here my almost working exsample. data(Duncan) attach(Duncan) plot(prestige ~ income) abline(lm(prestige ~ income), col=2, lwd=2) Now I would like to add