Re: [R] Reading sas7bdat files directly

2010-03-02 Thread Chris Long
The dsread output is little-endian, as that's the native format for floats on the Wintel platform. The byte order should stay the same if converting directly to a float, using a data structure like (C/C++): union { char bytes[8]; double value; } If reading the values with a SAS HEX i

Re: [R] Reading sas7bdat files directly

2010-03-01 Thread Chris Long
dsread (http://www.oview.co.uk/dsread) was updated yesterday, to include various new features as suggested here and elsewhere. Of particular interest might be: - you can now use the /c and /v options together to get dataset contents in CSV format for easier importing; - there is now a /l option

Re: [R] Reading sas7bdat files directly

2010-02-24 Thread Chris Long
No problem, Frank, I'm glad that you think it will be useful. I will be making changes to dsread in the coming weeks so you may want to hold off with your helper function in case my changes break it (the formatting of the variable metadata listing may well change). Re: the metadata, feel free to

Re: [R] Reading sas7bdat files directly

2010-02-24 Thread Chris Long
I suppose a link would have added usefulness: http://www.oview.co.uk/dsread Chris. -- View this message in context: http://n4.nabble.com/Reading-sas7bdat-files-directly-tp1469515p1567256.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Reading sas7bdat files directly

2010-02-24 Thread Chris Long
Hi Alex, 'm not an R user but I found your question during a general Google search re: SAS7BDAT files. You might like to try my free 'dsread' utility which will convert most Windows-format SAS7BDAT files to CSV. It's command-line based so can easily be called from other code with relevant param

[R] Replacing NA values when building matrix using tapply

2007-10-05 Thread Chris Long
Hi, I'm building a matrix m from a data frame d which includes the matrix row, column and value. This works well enough: m <- tapply(d[,"value"],d[,c("row","column")],c) However, I'd like to replace any missing values with 0, not NA. The obvious doesn't work, however: m <- tapply(d[,"value"],