[datatable-help] there is no package called ‘xts’

Michael Nelson michael.nelson at sydney.edu.au
Fri Apr 26 00:46:37 CEST 2013


Indeed. Although I prefer .()  to J()  to be inline with the future implementation of ..() as well.

frame[.(unique(id)), mult = "last"]

the relevant section from the NEWS


New DT[.(...)] syntax (in the style of package plyr) is identical to         DT[list(...)], DT[J(...)] and DT[data.table(...)]. We plan to add ..(), too, so         that .() and ..() are analogous to the file system's ./ and ../; i.e., .()         evaluates within the frame of DT and ..() in the parent scope.


From: datatable-help-bounces at lists.r-forge.r-project.org [datatable-help-bounces at lists.r-forge.r-project.org] on behalf of Eduard Antonyan [eduard.antonyan at gmail.com]
 Sent: Thursday, 25 April 2013 12:47 AM
 To: datatable-help at lists.r-forge.r-project.org
 Subject: Re: [datatable-help] there is no package called ‘xts’
@Michael, in the last expression, you probably forgot a J: 
frame[J(unique(id)), mult = "last"]  
On Tue, Apr 23, 2013 at 7:41 PM, Michael Nelson  michael.nelson at sydney.edu.au wrote:


>From the help for data.table::last



 If x is a data.table, the last row as a one row data.table. Otherwise, whatever xts::last returns.





calling lapply(.SD, last) will call last on each column in .SD. Columns within a data.table aren't  data.tables thus `xts::last` is called.  xts is on the suggests list for data.table,



you could use



install.packages('data.table, dependencies = 'Suggests')



or manually installed xts.



OR



frame[, last(.SD), by = id]



would work without needing xts



as would



frame[, .SD[.N], by = id]



or without having to construct .SD (which is time consuming)



frame[frame[, .I[.N],by = id]$V1]



or



setkey(frame, id)



frame[unique(id), mult = 'last']



________________________________________

From: 
datatable-help-bounces at lists.r-forge.r-project.org [datatable-help-bounces at lists.r-forge.r-project.org]
 on behalf of Sam Steingold [sds at gnu.org]

Sent: Wednesday, 24 April 2013 7:57 AM

To: 
datatable-help at lists.r-forge.r-project.org

Subject: [datatable-help] there is no package called ‘xts’



Hi,

I got this:



> dt <- frame[, lapply(.SD, last) ,by=id]

Finding groups (bysameorder=TRUE) ... done in 0.126secs. bysameorder=TRUE and o__ is length 0

Optimized j from 'lapply(.SD, last)' to 'list(last(country), last(language), last(browser), last(platform), last(uatype), last(behavior))'

Starting dogroups ... Error in loadNamespace(name) : there is no package called ‘xts’

Calls: [ -> [.data.table -> last -> :: -> getExportedValue -> asNamespace -> getNamespace -> tryCatch -> tryCatchList -> tryCatchOne -> <Anonymous>

>



the help for last does mention xts, but I don't have it installed.

do I need to?



--

Sam Steingold (http://sds.podval.org/) on Ubuntu 12.10 (quantal) X 11.0.11300000

http://www.childpsy.net/

http://ffii.org 
http://think-israel.org

http://mideasttruth.com

http://memri.org 
http://camera.org

Ernqvat guvf ivbyngrf QZPN.

_______________________________________________

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

_______________________________________________

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




More information about the datatable-help mailing list