From aragorn168b at gmail.com Mon Aug 4 01:57:50 2014 From: aragorn168b at gmail.com (Arunkumar Srinivasan) Date: Mon, 4 Aug 2014 01:57:50 +0200 Subject: [datatable-help] lapply without anonymous function In-Reply-To: References: Message-ID: GSee and List, With commit 1336, this now works: require(data.table) L = list(as.data.table(BOD), as.data.table(BOD)) lapply(L, "[", Time == 3L) Please write back if you come across any issues. Arun From:?G See Reply:?G See > Date:?November 11, 2013 at 3:40:46 PM To:?Gabor Grothendieck > Cc:?datatable-help at lists.r-forge.r-project.org > Subject:? Re: [datatable-help] lapply without anonymous function heh, after all my efforts to avoid subset(), it can be useful after all. :) Bug report filed, per Eduard's suggestion. On Mon, Nov 11, 2013 at 8:06 AM, Gabor Grothendieck wrote: > On Sun, Nov 10, 2013 at 2:39 PM, G See wrote: >> Hi, >> >> I have a list of data.tables and I am trying to extract a subset from >> each of them. I can achieve what I want with this: >> >>> L <- list(data.table(BOD), data.table(BOD)) >>> lapply(L, function(x) x[Time==3L]) >> [[1]] >> Time demand >> 1: 3 19 >> >> [[2]] >> Time demand >> 1: 3 19 >> >> However, I'd rather not type have to create an anonymous function. I >> tried the below, but `[.data.frame` is being dispatched. >> >>> lapply(L, "[", Time==3L) >> Error in `[.data.frame`(x, i) : object 'Time' not found >> >> Even if I am explicit, `[.data.table` does not get dispatched: >> >>> lapply(L, data.table:::`[.data.table`, Time==3L) >> Error in `[.data.frame`(x, i) : object 'Time' not found >> >> I'm guessing this is due to where evaluation takes place. Is there an >> alternate syntax I should use? >> > > subset works: > >> lapply(L, subset, Time == 3L) > [[1]] > Time demand > 1: 3 19 > > [[2]] > Time demand > 1: 3 19 > > > > -- > Statistics & Software Consulting > GKX Group, GKX Associates Inc. > tel: 1-877-GKX-GROUP > email: ggrothendieck at gmail.com _______________________________________________ datatable-help mailing list datatable-help at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -------------- next part -------------- An HTML attachment was scrubbed... URL: From thomas.harrop at ird.fr Mon Aug 4 13:40:20 2014 From: thomas.harrop at ird.fr (Tom Harrop) Date: Mon, 04 Aug 2014 13:40:20 +0200 Subject: [datatable-help] Unexpected behaviour using fast grouping Message-ID: <53DF7124.20904@ird.fr> Hello, I'm trying to group a data.table that has duplicate keys, aggregating the values in another column by the value of the key. There is a question and answer on the same topic on StackOverflow (http://stackoverflow.com/a/17033371/3017012), but when I follow the accepted answer I get different results: > library(data.table) data.table 1.9.2 For help type: help("data.table") > dt = data.table(user_id = c(1,2,2,3), advertiser_id = c(1:4)) > dt[,list(list(advertiser_id)), by = user_id] user_id V1 1: 1 4,3 2: 2 4,3 3: 3 4,3 Where I expect: user_id V1 1: 1 1 2: 2 2,3 3: 3 4 I can get the expected results (as above) using: > dt[,paste(advertiser_id, collapse = ","), by = user_id] Have I missed something? I'm on R 3.1.1 in case the behaviour has changed recently. Many thanks, Tom From aragorn168b at gmail.com Mon Aug 4 13:44:22 2014 From: aragorn168b at gmail.com (Arunkumar Srinivasan) Date: Mon, 4 Aug 2014 13:44:22 +0200 Subject: [datatable-help] Unexpected behaviour using fast grouping In-Reply-To: <53DF7124.20904@ird.fr> References: <53DF7124.20904@ird.fr> Message-ID: Hi Tom, It has been fixed in 1.9.3, bug#481. You can scroll down the project page on instructions for installation.. Best, Arun From:?Tom Harrop Reply:?Tom Harrop > Date:?August 4, 2014 at 1:40:32 PM To:?datatable-help at lists.r-forge.r-project.org > Subject:? [datatable-help] Unexpected behaviour using fast grouping Hello, I'm trying to group a data.table that has duplicate keys, aggregating the values in another column by the value of the key. There is a question and answer on the same topic on StackOverflow (http://stackoverflow.com/a/17033371/3017012), but when I follow the accepted answer I get different results: > library(data.table) data.table 1.9.2 For help type: help("data.table") > dt = data.table(user_id = c(1,2,2,3), advertiser_id = c(1:4)) > dt[,list(list(advertiser_id)), by = user_id] user_id V1 1: 1 4,3 2: 2 4,3 3: 3 4,3 Where I expect: user_id V1 1: 1 1 2: 2 2,3 3: 3 4 I can get the expected results (as above) using: > dt[,paste(advertiser_id, collapse = ","), by = user_id] Have I missed something? I'm on R 3.1.1 in case the behaviour has changed recently. Many thanks, Tom _______________________________________________ datatable-help mailing list datatable-help at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -------------- next part -------------- An HTML attachment was scrubbed... URL: From iruckaE at mail2world.com Wed Aug 6 20:38:42 2014 From: iruckaE at mail2world.com (iembry) Date: Wed, 6 Aug 2014 11:38:42 -0700 (PDT) Subject: [datatable-help] operations (+, -, /, *) on unequal-sized data.table - Question from Stack Overflow Message-ID: <1407350322075-4695146.post@n4.nabble.com> Hi everyone, I posted my original question (it has been simplified since then) on Stack Overflow (http://stackoverflow.com/questions/24940246/operations-on-unequal-sized-data-table) on 24 July and I haven't received any answers yet; however, I have received a few comments. Will anyone here be willing to provide me with some assistance? Thank you for your time and consideration. -- View this message in context: http://r.789695.n4.nabble.com/operations-on-unequal-sized-data-table-Question-from-Stack-Overflow-tp4695146.html Sent from the datatable-help mailing list archive at Nabble.com. From alanpaulkwan at gmail.com Tue Aug 19 22:03:17 2014 From: alanpaulkwan at gmail.com (Alan Kwan) Date: Tue, 19 Aug 2014 16:03:17 -0400 Subject: [datatable-help] fread for bin file? Message-ID: I hope this isn't a bone-headed question in either sense of what or how I am asking, but would it be in principle possible to adapt fread to read fixed record binary .bin files? I guess this is more of a feature request, although it's a help request if someone's figured it out already. TAQ bin files would be a major usage case, for instance. These are 60 gig files that are usually 30-33 characters * 600M rows long. An example would be reading a fixed record length, so imagine something like bidsiz<-readBin(qin,what='integer',size=4,n=1,endian='little') ofrsiz<-readBin(qin,what='integer',size=4,n=1,endian='little') mode<-readBin(qin,what='integer',size=2,n=1,endian='little') ex<-readBin(qin, what='character',size=1,n=1,endian='little') - Alan -------------- next part -------------- An HTML attachment was scrubbed... URL: From michael.gahan at gmail.com Thu Aug 21 15:42:20 2014 From: michael.gahan at gmail.com (Mike.Gahan) Date: Thu, 21 Aug 2014 06:42:20 -0700 (PDT) Subject: [datatable-help] Extracting specific values from a matrix In-Reply-To: <1408582386386-4695768.post@n4.nabble.com> References: <1408582386386-4695768.post@n4.nabble.com> Message-ID: <1408628540569-4695793.post@n4.nabble.com> Here is one way to approach this problem (there are lots of ways) #Convert to model matrix to account for factor variables iris <- model.matrix(~.-1,data=iris) #Convert to data.table iris <- data.table(iris) candidates <- names(iris) #Setup interaction variables for every combination all.interactions <- as.data.table(t(combn(candidates,2))) all.interactions[ , interaction := paste(V1,V2,sep="__")] all.interactions[ , multiplier := paste(V1,V2,sep="*")] #Add interactions to data for (x in 1:nrow(all.interactions)) iris[ , paste0(all.interactions$interaction[x]) := eval(parse(text=all.interactions$multiplier[x]))] -- View this message in context: http://r.789695.n4.nabble.com/Extracting-specific-values-from-a-matrix-tp4695768p4695793.html Sent from the datatable-help mailing list archive at Nabble.com. From michael.gahan at gmail.com Thu Aug 21 19:19:06 2014 From: michael.gahan at gmail.com (Mike.Gahan) Date: Thu, 21 Aug 2014 10:19:06 -0700 (PDT) Subject: [datatable-help] Extracting specific values from a matrix In-Reply-To: <1408582386386-4695768.post@n4.nabble.com> References: <1408582386386-4695768.post@n4.nabble.com> Message-ID: <1408641546668-4695818.post@n4.nabble.com> This is one method that might work. #Melt matrix and then convert to data.table object yourmatrix <- melt(yourmatrix)[melt(upper.tri(yourmatrix))$value,] names(yourmatrix) <- c("v1", "v2", "value") yourmatrix <- data.table(yourmatrix) #Setkeys and reference quickly setkey(yourmatrix,v1,v2) yourmatrix[J("B","C")] -- View this message in context: http://r.789695.n4.nabble.com/Extracting-specific-values-from-a-matrix-tp4695768p4695818.html Sent from the datatable-help mailing list archive at Nabble.com. From alanpaulkwan at gmail.com Thu Aug 21 21:49:11 2014 From: alanpaulkwan at gmail.com (Alan Kwan) Date: Thu, 21 Aug 2014 15:49:11 -0400 Subject: [datatable-help] (1.9.2) data.table crash when assign N values to N<1 rows Message-ID: Despite a few minutes of Googling I am unsure of whether this has been reported, but if it hasn't the following reliably crashes R "seg fault", on, if it matters, my Linux box sample=data.table(a=1:50,b='N') sample[50,b:=c(1,2,3)] I don't know the guts of data.table to know whether it'd be easy to error check without sacrificing performance. At the very least maybe some helpful output? -------------- next part -------------- An HTML attachment was scrubbed... URL: From aragorn168b at gmail.com Thu Aug 21 22:18:43 2014 From: aragorn168b at gmail.com (Arunkumar Srinivasan) Date: Thu, 21 Aug 2014 22:18:43 +0200 Subject: [datatable-help] (1.9.2) data.table crash when assign N values to N<1 rows In-Reply-To: References: Message-ID: Hi Alan, Could you please try it on 1.9.3:?https://github.com/Rdatatable/data.table?From what I vaguely recall, this has been fixed.. Arun From:?Alan Kwan Reply:?Alan Kwan > Date:?August 21, 2014 at 9:49:44 PM To:?datatable-help > Subject:? [datatable-help] (1.9.2) data.table crash when assign N values to N<1 rows Despite a few minutes of Googling I am unsure of whether this has been reported, but if it hasn't the following reliably crashes R "seg fault", on, if it matters, my Linux box sample=data.table(a=1:50,b='N') sample[50,b:=c(1,2,3)] I don't know the guts of data.table to know whether it'd be easy to error check without sacrificing performance. At the very least maybe some helpful output? _______________________________________________ datatable-help mailing list datatable-help at lists.r-forge.r-project.org https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help -------------- next part -------------- An HTML attachment was scrubbed... URL: From fjbuch at gmail.com Sat Aug 23 16:08:23 2014 From: fjbuch at gmail.com (Farrel Buchinsky) Date: Sat, 23 Aug 2014 14:08:23 +0000 (UTC) Subject: [datatable-help] I'd like to add you to my professional network on LinkedIn Message-ID: <1679926256.10463241.1408802903712.JavaMail.app@ela4-app4978.prod> Hi, I'd like to add you to my professional network on LinkedIn. - Farrel Accept: http://www.linkedin.com/blink?simpleRedirect=3gQdjwUdPcUej8Qd3sQejwMejkZh4BKrSBQonhFtCVF9Dlat70VqDxVfnBBiShBsC5EsOpQsSlRpRZBt6BSrCAZqSkConhzbmlQqnpKqiRQsSlRpORIrmkZpSVFqSdxsDgCpnhFtCV9pSlipn9Mfm4Cdz8JqPpGtj0TuCwJu79QsS5LbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I7730064537_1&markAsRead= You are receiving Invitation emails. Unsubscribe here: http://www.linkedin.com/blink?simpleRedirect=t655cylzokkO9mVBqnsJtnt5cylBpT9LpyROc3gBs6NBq2RBr69xt65QomgZr6BxrmkCt6JGoP5DrzdGoDkMoShCfmhFoioNdz0MczRAqioNbjRAqmQCdz8JqPpGtj0TuCwJu79QsS5LbjRAqmkCt7dBtmtvpnhFtCVFfmJB9Clyqn9zsS9RsSVRbmlQqnpKqiRQsSlRpORIrmkZpSVFqSdxsDgCkjoPp4l7q5p6sCR6kk4ZrClHrRhAqmQCsSVRfngCdz8JqPpGtj0TuCwJu79QsS5LbjRBfP9SbSkLrmZzbCVFp6lHrCBIbDtTtOYLeDdMt7hE&msgID=I7730064537_1&markAsRead= Learn why we included this at the following link: http://www.linkedin.com/blink?simpleRedirect=e3wTd3RAimlIoSBQsC4Ct7dBtmtvpnhFtCVFfmJB9CNOlmlzqnpOpldOpmRLt7dRoPRx9zoObmISqDkMdTFEbnxOt7dxrOQZpjYOtyZBbSRLoOVKqmhBqSVFr2VTtTsLbPFMt7hE&msgID=I7730064537_1&markAsRead= © 2014, LinkedIn Corporation. 2029 Stierlin Ct. Mountain View, CA 94043, USA -------------- next part -------------- An HTML attachment was scrubbed... URL: