Re: [R] foreach {parallel} nested with for loop to update data.frame column

2016-08-08 Thread Alexander.Herr
Actually, you'll need to identify the values of the foreach loop in the for loop for it to work... require(doParallel) require(foreach) set.seed(666) xyz<-as.data.frame(cbind(x=rep(rpois(5,10),2)+1, y=rep(rpois(5,10),2)+1,z=round(runif(10, min=-3, max=40),2))) xyz$mins<-rep(NA,

Re: [R] Help with big data and parallel computing: 500, 000 x 4 linear models

2016-08-08 Thread Charles C. Berry
On Mon, 8 Aug 2016, Ellis, Alicia M wrote: I have a large dataset with ~500,000 columns and 1264 rows. Each column represents the percent methylation at a given location in the genome. I need to run 500,000 linear models for each of 4 predictors of interest in the form of:

Re: [R] Visualising multiple temporal periods each with an associated value

2016-08-08 Thread Jim Lemon
Hi Loris, If I understand what you want, it seems to be a combination of a Gantt chart and a sizetree. The Gantt chart provides the horizontal extent of the rectangles and the sizetree the vertical extent by assigning relative heights to the initial rectangles and dividing these into subsets as

Re: [R] Visualising multiple temporal periods each with an associated value

2016-08-08 Thread Jim Lemon
Hi Loris, This looks a lot like a Gantt chart with variable bar widths. I'll check it when I have a bit of time and repost. JIm On Mon, Aug 8, 2016 at 6:12 PM, Loris Bennett wrote: > Hi, > > I want to visualise temporal events as rectangles, one side of the >

Re: [R] Help with big data and parallel computing: 500, 000 x 4 linear models

2016-08-08 Thread Aaron Mackey
Don't run 500K separate models. Use the limma package to fit one model that can learn the variance parameters jointly. Run it on your laptop. And don't use %methylation as your Y variable, use logit(percent), i.e. the Beta value. -Aaron On Mon, Aug 8, 2016 at 2:49 PM, Ellis, Alicia M

Re: [R] changing x and y ranges in a PCA plot created by library(labdsv)

2016-08-08 Thread David Winsemius
> On Aug 8, 2016, at 12:48 AM, Mohsen Sharafatmandrad > wrote: > > I want to change x and y ranges in a PCA plot created by library(labdsv). > When I run "plot(o.pca, xlim=c(-2, 3), ylim=c(-2, 4))", nothing will > change. Script is as fallow: > > > > raw<-

[R] Help with big data and parallel computing: 500, 000 x 4 linear models

2016-08-08 Thread Ellis, Alicia M
I have a large dataset with ~500,000 columns and 1264 rows. Each column represents the percent methylation at a given location in the genome. I need to run 500,000 linear models for each of 4 predictors of interest in the form of: Methylation.stie1 ~ predictor1 + covariate1+ covariate2 + ...

Re: [R] interaction between clusterMap(), read.csv() and try() - try does not catch error

2016-08-08 Thread Strunk, Jacob (DNR)
Ok - got it, I can handle that. Thank you Luke! Jacob L Strunk ___ From: luke-tier...@uiowa.edu [luke-tier...@uiowa.edu] Sent: Monday, August 08, 2016 12:17 PM To: Strunk, Jacob (DNR) Cc: r-help@r-project.org Subject: Re: [R] interaction between clusterMap(),

[R] Revolutions blog: July 2016 roundup

2016-08-08 Thread David Smith via R-help
Since 2008, Microsoft (formerly Revolution Analytics) staff and guests have written about R every weekday at the Revolutions blog: http://blog.revolutionanalytics.com and every month I post a summary of articles from the previous month of particular interest to readers of r-help. And in case

Re: [R] Extracting dates to create a new variable

2016-08-08 Thread Ulrik Stervbo
Getting the dates of the departments CC, DD, FF can be done with subset(df, deps %in% c("CC", "DD", "FF")) I am not sure how you intend to match these identified dates with other departments? From your example you sometimes replace earlier dates, sometimes later dates. HTH Ulrik On Mon, 8 Aug

Re: [R] interaction between clusterMap(), read.csv() and try() - try does not catch error

2016-08-08 Thread luke-tierney
try is working fine. The problem is that your remote function is returning the try-error result, which the parallel infrastructure is interpreting as an error on the remote node, since the remote calling infrastructure is using try as well. This could be implemented more robustly, but it would

[R] Extracting dates to create a new variable

2016-08-08 Thread Farnoosh Sheikhi via R-help
Hi there,  I have a data set like below and wanted to create a new date variable by extracting the dates for specific departments.I want to extract the dates for departments CC, DD, FF,  put it in a new column and repeat it for other unique IDs. Subject<- c("2", "2", "2", "3", "3", "3", "4",

[R] interaction between clusterMap(), read.csv() and try() - try does not catch error

2016-08-08 Thread Strunk, Jacob (DNR)
Hello I am attempting to process a list of csv files in parallel, some of which may be empty and fail with read.csv. I tend to use clusterMap as my go-to parallel function but have run into an interesting behavior. The behavior is that try(read.csv(x)) does not catch read errors resulting from

[R] [R-pkgs] New package: ggghost 0.1.0 - Capture the spirit of your ggplot2 calls

2016-08-08 Thread Jonathan Carroll
Greetings, R users! I am pleased to announce the release of my first CRAN package: ggghost. https://cran.r-project.org/web/packages/ggghost https://github.com/jonocarroll/ggghost Features: - Minimal user-space overhead for implementation; p %g<% ggplot(dat, aes(x,y)) - ggplot2 components

[R] changing x and y ranges in a PCA plot created by library(labdsv)

2016-08-08 Thread Mohsen Sharafatmandrad
I want to change x and y ranges in a PCA plot created by library(labdsv). When I run "plot(o.pca, xlim=c(-2, 3), ylim=c(-2, 4))", nothing will change. Script is as fallow: raw<- matrix(c(1,2,2.5,2.5,1,0.5,0,1,2,4,3,1),nrow=6) colnames(raw)<- c("s1","s2") rownames(raw)<-

Re: [R] Conditionally remove rows with logic

2016-08-08 Thread MacQueen, Don
Assuming that within each ID the data is sorted by increasing TIME, and that LABEL==1 occours only once within each ID. Then I would try something like this. Suppose that your data is in a data frame named "df". df.keep <- logical() for (id in unique(df$ID)) { df.tmp <- subset(df, df$ID==id)

[R] How to create marginal effects tables in R?

2016-08-08 Thread Faradj Koliev
Hi everyone, I have three ordered regression models where the ordered dependent variable ranges from 0 to 2. What I want to do is create marginal effects tables (not a plot) at each level (0, 1, and 2) for all three models. So, three tables with each showing the marginal effects at level 0,

[R] Update to the xtractomatic package

2016-08-08 Thread Roy Mendelssohn - NOAA Federal
xtractomatic is an R package developed to subset and extract satellite and other oceanographic related data from a remote server. The program can extract data for a moving point in time along a user-supplied set of longitude, latitude and time points; in a 3D bounding box; or within a polygon

Re: [R] Three way correspondence analyses?

2016-08-08 Thread David L Carlson
Your code runs without errors so there is no issue with R. The function you are using is for [Partial] [Constrained] Correspondence Analysis. You have not defined 3-way correspondence analysis, but my understanding is that it involves correspondence analysis of a 3-way crosstabulation array.

Re: [R] No "number of days" format for 'difftime'?

2016-08-08 Thread Loris Bennett
Martin Maechler writes: >> Loris Bennett >> on Mon, 8 Aug 2016 14:12:47 +0200 writes: > > > Loris Bennett writes: > >> Thanks for the link, John. However, there is a hyphen missing. It >

Re: [R] No "number of days" format for 'difftime'?

2016-08-08 Thread Martin Maechler
> Loris Bennett > on Mon, 8 Aug 2016 14:12:47 +0200 writes: > Loris Bennett writes: >> Thanks for the link, John. However, there is a hyphen missing. It >> should be: >> >>

Re: [R] No "number of days" format for 'difftime'?

2016-08-08 Thread Loris Bennett
Loris Bennett writes: > Thanks for the link, John. However, there is a hyphen missing. It > should be: > > > http://www.dummies.com/how-to/content/how-to-read-errors-and-warnings-in-r.html > > Appropriately, with the correct URL we find the too often forgotten >

Re: [R] metaprop

2016-08-08 Thread Michael Dewey
Dear Carlos If you use functions from a contributed package it is best to tell us which package. There are nearly 9000 of them. On 07/08/2016 17:13, Carlos Javier Rincon Rodriguez wrote: hi, i am using the funtion metaprop but when i try to save the proportion estimation by subgrup using

Re: [R] No "number of days" format for 'difftime'?

2016-08-08 Thread Loris Bennett
Thanks for the link, John. However, there is a hyphen missing. It should be: http://www.dummies.com/how-to/content/how-to-read-errors-and-warnings-in-r.html Appropriately, with the correct URL we find the too often forgotten pearl of wisdom: "Chances are, you just typed something wrong

Re: [R] No "number of days" format for 'difftime'?

2016-08-08 Thread John Kane
http://www.dummies.com/how-to/content/how-to-read-errors and-warnings-in-r.html If something goes wrong with your code, R tells you. We have to admit it: These error messages can range from mildly confusing to completely incomprehensible if you’re not used to them. fortune(350) regarding the

Re: [R] No "number of days" format for 'difftime'?

2016-08-08 Thread Loris Bennett
Hi, I was probably misled by the, to my mind, esoteric error message into thinking the error was more subtle. Something like "unmatched quotes" might have helped me recognise that I was just being dopey. Thanks to John and Rui. Loris writes: > Hello, > > You're missing

Re: [R] No "number of days" format for 'difftime'?

2016-08-08 Thread ruipbarradas
Hello, You're missing a double quotes. Right after format= Hope this helps, Rui Barradas   Citando Loris Bennett : > Hi, > > When I try > > d <- as.difftime("6-08:18:33",format=%d-%H:%M:%S") > > I get: > > Error: unexpected SPECIAL in

Re: [R] No "number of days" format for 'difftime'?

2016-08-08 Thread John Kane
Try d <- as.difftime("6-08:18:33","%d-%H:%M:%S") John Kane Kingston ON Canada > -Original Message- > From: loris.benn...@fu-berlin.de > Sent: Mon, 8 Aug 2016 11:37:33 +0200 > To: r-h...@stat.math.ethz.ch > Subject: [R] No "number of days" format for 'difftime'? > > Hi, > > When I try

[R] No "number of days" format for 'difftime'?

2016-08-08 Thread Loris Bennett
Hi, When I try d <- as.difftime("6-08:18:33",format=%d-%H:%M:%S") I get: Error: unexpected SPECIAL in "as.difftime("6-08:18:33",format=%d-%" Am I correct in thinking that it is not possible to do something like this, because there is no character string for the format which corresponds to

[R] Visualising multiple temporal periods each with an associated value

2016-08-08 Thread Loris Bennett
Hi, I want to visualise temporal events as rectangles, one side of the rectangle being the length of the event, the other being the size of an integer variable. The position of the rectangle along the time axis would be determined by the time of the even, the position on the other axis is

[R] pgmm - how to properly specify lag term?

2016-08-08 Thread Striessnig, Erich
Dear R-users, I want to reproduce "a dynamic panel data model, autoregressive of order 1, with fixed effects" that was originally estimated with 2-step GMM in STATA. Reproducing the model in R shouldn't be a big deal, however, unfortunately I don't have the original STATA code and the lagged

Re: [R] Conditionally remove rows with logic

2016-08-08 Thread Jim Lemon
Hi Jennifer, A very pedestrian method, but I think it does what you want. remove_rows_after_1<-function(x) { nrows<-dim(x)[1] rtr<-NA rtrcount<-1 got1<-FALSE thisID<-x$ID[1] for(i in 1:nrows) { if(x$ID[i] == thisID && got1) { rtr[rtrcount]<-i rtrcount<-rtrcount+1 } if(x$ID[i] !=

[R] Conditionally remove rows with logic

2016-08-08 Thread Jennifer Sheng
Dear all, I need to remove any rows AFTER the label becomes 1. For example, for ID 1, the two rows with TIME of 15 & 18 should be removed; for ID 2, any rows after time 6, i.e., rows of time 9-18, should be removed. Any suggestions? Thank you very much! The current dataset looks like the

Re: [R] Creating Dummy Var in R for regression?

2016-08-08 Thread Fredrik Karlsson
Hi, please also have a look at the 'cut' function.Very handa function for these types of situations. Best, Fredrik On Sun, Aug 7, 2016 at 8:10 PM, Shivi Bhatia wrote: > Thank you Jeremiah and all others for the assistance. This really helped. > > On Sat, Aug 6, 2016 at

Re: [R] SAS file

2016-08-08 Thread Daniel Nordlund
On 8/7/2016 7:49 AM, John Kane wrote: As Jim says the file did not arrive. R-help is very fussy about what kind of files it accepts. If you are still having a problem it would be a good idea to upload it to file-sharing place such as Dropbox or Mediafire and just post the link here. John