Re: [R] Variable Column Names and Lists

2015-02-27 Thread Brian Trautman
This worked perfectly, thank you! On Fri, Feb 27, 2015 at 10:47 AM, Duncan Murdoch wrote: > On 27/02/2015 1:18 PM, Brian Trautman wrote: > > This should be a simple question, but I am at my wits end. > > > > dt<-data.table(a=rep(1:10, 26), b=1:260, c=rep(1:2, 130))

[R] Variable Column Names and Lists

2015-02-27 Thread Brian Trautman
This should be a simple question, but I am at my wits end. dt<-data.table(a=rep(1:10, 26), b=1:260, c=rep(1:2, 130)) sumvar <- 'mysum' bvar <- 'b' dt_min <- dt[, list(sumvar = sum(get(bvar))), by=list(a)] print(dt_min) I want the function to return two variables, "a" and "mysum". However, it i

[R] Merging Data.Tables on conditions other than equality

2015-02-25 Thread Brian Trautman
I have two tables that I would like to join together in a way equivalent to the following SQL. Note that I'm using a "greater than" statement in my join, rather than checking for equality. require(sqldf) require(data.table) dt <- data.table(num=c(1, 2, 3, 4, 5, 6), char=c('A', 'A', 'A', 'B', 'B

Re: [R] MApply and SubStr

2015-02-11 Thread Brian Trautman
> > On Feb 10, 2015, at 3:58 PM, Brian Trautman wrote: > > > Hi! > > > > I'm trying to write a custom function that applies SubStr to a string, > and > > then depending on the arguments, converts the output to a number. > > > > The substring

[R] MApply and SubStr

2015-02-10 Thread Brian Trautman
Hi! I'm trying to write a custom function that applies SubStr to a string, and then depending on the arguments, converts the output to a number. The substring part of my code works fine, but it's not converting the way I want to -- options('stringsAsFactors'=FALSE) require(data.table) substr_ty

Re: [R] Fixed Width EBCDIC Files in R

2015-02-05 Thread Brian Trautman
McKown wrote: > On Thu, Feb 5, 2015 at 2:08 PM, Brian Trautman > wrote: > >> I'm trying to read some mainframe data encoded as EBCDIC into R, and am at >> a loss. I'd like to avoid using an external program to convert the files, >> since I'm operating in

[R] Fixed Width EBCDIC Files in R

2015-02-05 Thread Brian Trautman
I'm trying to read some mainframe data encoded as EBCDIC into R, and am at a loss. I'd like to avoid using an external program to convert the files, since I'm operating in a corporate environment. You can find the example files at at the link below, with both ASCII and EBCDIC versions. Note that t