[R] Small xlsReadWritePro update

2008-06-30 Thread Hans-Peter
A small update for xlsReadWritePro is available.
(This is the shareware version of the free xlsReadWrite package, still
windows only)

= Changes in version 1.4.0 =

 * Added 'default.' prefix for colClasses argument
(proposed by John Hathaway)
 * Images - which have been added manually - can be listed and deleted.
(proposed by Ian Seow)
 * Bugfixes:
 ** xls.image didn't work with files (only xls-obj)
 ** xls.range do.
 ** in some (not widely published) versions images deletion gave an
error under certain circumstances

= Downloads =

 * For current R (2.7.1):
http://treetron.googlepages.com/xlsReadWritePro_1.4.0.zip
 * Older R-versions (remove the prefix; version above works but
displays warning):
 ** http://treetron.googlepages.com/__R2.6.2__xlsReadWritePro_1.4.0.zip
 * Testcript: http://treetron.googlepages.com/xlsReadWritePro_TestData_1.4.0.zip
 * Brochure: http://treetron.googlepages.com/xlsReadWrite_Pro_Datasheet.pdf


Best regards,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Importing an Excel spreadsheet

2008-03-21 Thread Hans-Peter
>> I am trying to import an *.xls spreadsheet into R. I am doing this as
[snip]

> Very steep learning curve ... so appreciate your help.


By looking at http://www.R-project.org/posting-guide.html ->
http://cran.r-project.org/doc/manuals/R-data.pdf -> Chapter 8 Reading Excel
spreadsheets -> you can also find my package xlsReadWrite which natively
reads Excel files (Windows only).

Using *.csv file is probably the more common/recommended way but be careful
with 'cutted decimal places'.

-- 
Regards,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading Excel file

2008-03-25 Thread Hans-Peter
>
> But what can I do in case I don't know the number of columns in my
> file??
>
 I mean is there any way I can specify the colClass of only third column
> and for other columns it can take the default classes??


Not supported, sorry (I put it on the list).

x = read.xls( "D:\\file.xls", colClasses = c( rep( NA , 2 ),"isodate", rep(
NA, 9 ) ) ) should work. But you still have to know the total number of
columns. (The pro version does have a xls.info command and/or you could read
in just the first row and check its content).

-- 
Regards,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading Excel file

2008-03-26 Thread Hans-Peter
yet another possibility...

if you look at 'help(package=xlsReadWrite)' you'll find a function
'dateTimeToStr' by which you can convert your date-numbers from column 3
into a string. Something along (untested):

myRead <- function( fn ) {
  dat <- read.xls( file = fn, dateTimeAs = "numeric" )
  dat[,3] <- dateTimeToStr( dat[,3] )  # or any other conversion function
  dat
}

'dateTimeAs' argument is (probably) needed to retrieve plain numbers and
override the default conversion to date string.

-- 
Regards,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] publish R on gotAPI ?

2008-04-09 Thread Hans-Peter
I recently stumbled across www.gotAPI.com which is a really nice site to
lookup infos of many different languages. - Wouldn't it be a good idea to
submit a request to add R?

-- 
Regards,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Update xlsReadWritePro v1.3.2

2008-01-07 Thread Hans-Peter
xlsReadWritePro natively reads and writes Excelfiles (v97 - 2003) on
Windows. I have uploaded a small bugfix update thereof. Fixes:

• error with dimnames in 1-dimensional arrays
• misleading error (assertion) messages with wrong from/to arguments.

Download package: http://treetron.googlepages.com/xlsReadWritePro_1.3.2.zip
Download Test-/Demoscripts:
http://treetron.googlepages.com/xlsReadWritePro_TestData_1.3.2.zip

Browse (shortened) help files: http://treetron.googlepages.com/00Index.html
Download brochure:
http://treetron.googlepages.com/xlsReadWrite_Pro_Datasheet.pdf

The pro version can be tested by everyone during a free trial of 30 days. It
is more powerful than the (also capable) free version, but beeing a small
company, we are glad if people support our development and maintenance
effort (more than expected have done, thanks). A gratis version is available
for people who need/want it. Otherwise there is always our free xlsReadWrite
version (where our own code is free (GPLv2).

Best regards,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Hiding a function

2008-02-23 Thread Hans-Peter
>
> After some private email with some high level programmer (Gabor), I have

  
shouldn't that rather be: high in knowledge but low in level?

Best,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] R data Export to Excel

2008-03-02 Thread Hans-Peter
>
> it doesn't seem indicate any installation instruction.
> http://cran.r-project.org/web/packages/xlsReadWrite/index.html


As  Wensui Liu already mentioned, installation is the same as with other
packages: In the RGui menu select Packages->Install Packages...->(Select a
CRAN mirror)->(Select the package)->done.

Best regards,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Export csv data

2008-03-04 Thread Hans-Peter
>
> now i ended up with only 1. The 1 is fine but when i export to
> excel, it is missing the probeID. Here are my code and examples.
>
> library(xlsReadWrite)
> ...
> write.xls(cbind(data[1],
> Variance=apply(data[,y],1,var)),file='c://variance.csv')


If you use write.xls you will get a binary xls-file and shouldn't use '
variance.csv' as filename (which make people expect a comma-delimited plain
text file. If you want this you can use one of the functions write.table,
write.csv or write.csv2.

I was not able to run the code and don't know why ProbeID is missing.
Personally I mostly calculate the data first and do output it afterwards,
e.g.

  mydat <- cbind( data[1], Variance = apply( data[,y], 1, var ) )
  write.xls( mydat, file = "c://variance.xls" )

Thus it is more clear if the problem is with the data or with the writing.
If you provide me a small mydat dataset I could probably help better.

Best,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Reading microsoft .xls format and openoffice OpenDocument files

2008-03-11 Thread Hans-Peter
>
> I looked at the package (it's
> http://cran.r-project.org/web/packages/xlsReadWrite/index.html) but
> it's windows only. So no joy yet.


which platform would you need it?

Regards,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Read in date fomat while colClasses="character"

2007-10-09 Thread Hans-Peter
>
> I am using xlsReadWrite to read a particular excel file. In one of the
> columns I have dates ( say col=5). Now date column is read by default as
> numeric. So I used dateTimeAs= "isodatetime". This enables reading in
> the date format.


dateTimeAs= "isodatetime" reads and converts the dates into a character
representation. You could also read the dates as numeric values and convert
them later to strings with the functions "dateTimeToStr" or
"dateTimeToIsoStr".

However in the earlier column (say col=1) I have data
> which however starts from row 10. So to read data from column one I use
> colClasses="character". But this overrules the isodatetime.


another possibility would be to give a vector for the colClasses argument,
e.g.
   colClasses = c( "character", "character",  "double", "double",
"isodatetime" )


-- 
Regards,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Download old R-2.5.1 version?

2007-10-15 Thread Hans-Peter
Is it possible to download somewhere the former 2.5.1 windows bin version of
R? (Need it for testing).

Thanks,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Import from excel 2007

2007-10-17 Thread Hans-Peter
>
> The best way to read or write Excel files is with the RExcel package.  The


Well, I'd argue, that often 'the best way' is to use the xlsReadWrite
package, but I am biased...

There are some precondition:
- you have to be on windows (but my new soon-to-arrive notebook will be a
Mac, therefore...)
- it reads and write in the Excel 97-2003 xls format (BIFF8).
  (With Excel 2007 you'd have to choose the compatibility mode for now and
thus fall back to the 65536 rows and 256 columns limit).

Regards,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to make own function load automatically on startup

2007-10-29 Thread Hans-Peter
>
> My code contains following snippet: "xlsReadWrite::read.xls", this is
> because another package I load masks read.xls function and :: help me
> to select correct read.xls. I guessed this use of :: but I would
> really like to know what :: is and where can I read more about this
> function?


> help("::")

-- 
Regards,
Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [offtopic] nice R related domains to give away

2015-02-23 Thread Hans-Peter Suter
Since some years I have the following domains which I don't need any longer
(and in fact never used despite some plans)

  - developr.org
  - editr.org
  - helpr.org

It makes no sense to hoard domains and I plan to give them away for a 'good
cause'. I'd like to have a small fee for the costs but this is not a
precondition. My email: gchappi, and then gmail.com.

Cheers, Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Any reason not to use RUnit any longer?

2017-03-06 Thread Hans-Peter Suter
Hello,

I see that quite some packages nowadays use testthat and that RUnit doesn't
have recent updates. On the other hand Rccp, fTrading and others (still)
test with RUnit.

My old code uses RUnit and I would prefer to keep it that way unless there
is an important reason to switch to testthat. If it makes a difference, I
do _not_ use roxygen and stay close to R-exts standards (ok, a testing
framework I'd like to have).

Thanks for any advise / opinions,

Hans-Peter

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Any reason not to use RUnit any longer?

2017-03-07 Thread Hans-Peter Suter
Thanks a lot for the feedback, Dirk and Mehmet,

My (large) test-code is in RUnit and so I'm glad to hear that it is fine.
RUnit worked very well for me and I do not have a reason to switch.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Editor for Mac

2008-07-23 Thread Hans-Peter Suter
> Thanks for the answers,
> but I'm looking for an editor like Tinn-R.

What about VM Fusion and continue to use Tinn-R then?

-- 
Regards,
Hans-Peter

PS: I use TextMate (and like it)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] PowerCut Killed R - is my code retrievable?

2009-08-20 Thread Hans-Peter Suter
>> Also - is there a better way for the future?  I know some people use IDE's
>> but is that for serious programming or for building a small function and
>> tweaking it?

What about a version control system to (locally) save the different
stages of your script files?
(I use git but Subversion (SVN) may be easier and do the job).

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Failed install of package xlsReadWrite

2010-02-13 Thread Hans-Peter Suter
2010/2/11  :
> Does anyone have a work-around for a failed installation of this package?
>> library(xlsReadWrite)
...
> xls.getshlib()
>
> However, the xls.getshlib() command fails with this error:

(For the record) It probably was a corporate firewall problem.

Apart from info on www.swissr.org (thanks for pointing this out) you
can always download the file directly. The full listing is here:
http://dl.dropbox.com/u/2602516/swissrpkg/listing.html

Direct links to the current (R2.10.x/1.5.1 pkg) version, either:
- download the zipped dll:
http://dl.dropbox.com/u/2602516/swissrpkg/bin/win32/shlib/xlsReadWrite_1.5.1_dll.zip
and manually replace xlsReadWrite.dll (in e.g.
'C:\Programme\R\R-2.10.1\library\xlsReadWrite\libs') or
- download the full package:
http://dl.dropbox.com/u/2602516/swissrpkg/bin/win32/2.10/xlsReadWrite_1.5.1.zip
and re-install.

Note: 0.0.0-versions are development versions. They will be updated
when there is something 'fixworthy' while a new official version is
'in wait mode'. Currently 0.0.0 fixes a bug with non-absolute file
paths in 1.5.1.

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Failed install of package xlsReadWrite

2010-03-11 Thread Hans-Peter Suter
> Hi, all. I too got this error, and when I went to register the correct DLL
> (thinking the one downloaded but not installed might have been the
> development version) I got an error that the registration had failed.
>
> What I typed:
>
> C:\Program Files\R\R-2.10.0\library\xlsReadWrite\libs>regsvr32
> xlsReadWrite.dll

Executing regsvr32 is absolutely _not_ necessary. It suffice to copy
the dll to the correct place (C:\Program
Files\R\R-2.10.0\library\xlsReadWrite\libs).

Unfortunately there is/was a bug in xlsReadWrite 1.5.1 such that with
a custom R_Libs path the existing dll was not replaced (iirc). This
and the relative-path bug has been fixed in the devel version.

If you download the full version, the package is supposed to work
right away. I currently still use XP (but don't know of any problems
related with Windows 7 or Vista).

Links (full, i.e. non-cran version, R2.10.x):
1.5.1: 
http://dl.dropbox.com/u/2602516/swissrpkg/bin/win32/2.10/xlsReadWrite_1.5.1.zip
devel: 
http://dl.dropbox.com/u/2602516/swissrpkg/bin/win32/2.10/xlsReadWrite_0.0.0.zip

Hope this helps!
(Otherwise feel free to contact me by email (gchappi  gmail), this
really must work).

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help exporting to excel via xlsReadWritePro

2009-07-02 Thread Hans-Peter Suter
> I’m trying to export a file from R to excel using the xlsReadWritePro 
> function and I keep getting the error below.

POSIXt is not currently supported (neither in data.frames nor vectors)
and must be converted to other types (see ?write.xls). I almost never
use POSIXlt/ct myself but it would probably be a good idea to provide
support (I've added it as a request). Code:

dates <- c( "2009-07-02 19:30:00", "2009-07-02 19:31:15", "2009-07-02
20:12:42" )
write.xls( data.frame( as.POSIXlt( dates ) ), "anothertestfile.xls" )
# gives error
write.xls( as.POSIXlt( dates ), "anothertestfile.xls" )
 # do.l

> [snip] Also is there anyway to export different datasets to  multiple sheets 
> similar to the ods function in SAS?

Here is an example:

  # setup
library( "xlsReadWritePro" )
dates <- c( "2009-07-02 19:30:00", "2009-07-02 19:31:15", "2009-07-02
20:12:42" )
mydat <- data.frame( idt = as.character( as.POSIXlt( dates ) ),
 odt1 = isoStrToDateTime( dates ),
 odt2 = isoStrToDateTime( dates ),
 val = c( 1, 2, 3 ),
 stringsAsFactors = FALSE )
class( mydat[,1] ) <- "isodatetime" # required
('character' is not currently accepted as isodatetime column (will be
fixed))
class( mydat[,2] ) <- "oledatetime" # optional
('numeric' will be accepted as oledatetime column)

  # write data (note: FALSE is necessary to keep the data.frame)
xls <- xls.new ( "testfile.xls" )   # create new
spreadsheet and keep in memory
write.xls( mydat[,1,FALSE], xls, sheet = 1, cols = 1 )  # write
write.xls( mydat[,2, FALSE], xls, sheet = 1, cols = 2 ) # do.
write.xls( mydat[,3, FALSE], xls, sheet = 1, cols = 3, colClasses =
"oledatetime" ) # do.
write.xls( mydat[,4], xls, sheet = 2 )  # do. in sheet 2
xls.sheet( xls, 'select', 1 )   # first sheet
shall be active when spreadsheet is opened
xls.close( xls )# save and
close memory represention

Hope this helps/clarifies things. Otherwise feel free to ask again (PM
prefered as it's probably better not to use the r-help mailling list
for questions about a non-free library). Btw, there will be a forum
some time later.

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] what happened to the xlsReadWrite package

2009-07-05 Thread Hans-Peter Suter
> what happened to the xlsReadWrite package?
[snip]
> Are there any plans for it be available again?

Yes. (I do have a halfway finished version but then had much work on
my regular job, my 'free-programming-time' got eaten by a e-texteditor
plugin (http://github.com/swissr/rmate.tmbundle/tree/master) which
took longer than expected and now was/will be again holiday time..).

Sorry for being so slow but at least and as it was mentioned (thanks)
the package can be downloaded here:
http://treetron.googlepages.com/xlsReadWrite_1.3.3.zip. It has been
tested with R2.9.0 and the recent 2.9.1.

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Export data to Multiple Sheets in Excel via xlsReadWritePro

2009-07-05 Thread Hans-Peter Suter
2009/7/2 Chris Anderson :
> Is there a way to export multiple datasets into multiple excel spreadsheets 
> using xlsReadWritePro or with xlsReadWrite?

I have answered the question in your other thread. See:
http://thread.gmane.org/gmane.comp.lang.r.general/154614/focus=154752

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] emacs: reformat \items paragraph in .Rd

2010-03-27 Thread Hans-Peter Suter
(emacs newb here)

After having made some changes in an \items paragraph of \arguments
the lines are no longer nicely wrapped. I was looking for a command to
reindent/rewrap/reformat the whole \items paragraph but couldn't find
anything.

The only way, I found, was to go to the end of the first line, do
'c-j'  (or RET) which wraps *this* line nicely, but now there is a
hard line-break to the next line. So I go back with 'c-p', delete the
gap to the next line with 'c-k' and some 'c-d' s. Then got to the end
of this line and start again with 'c-j', ...

There certainly must be some easier way to reformat a paragraph?
(I tried 'm-c-q' (not defined) and 'm-c-\' (but was not able to input
the backslash); I'm on GNU Emacs 23.1.1 (i386-mingw-nt5.1.2600).

Thanks for your help!

Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] emacs: reformat \items paragraph in .Rd

2010-04-01 Thread Hans-Peter Suter
Many thanks!  The missing empty line was the problem, and M-q works great.

Hans-Peter

> Esc-q or M-q will wrap a whole paragraph. The only problem is that you need
> to make sure the paragraph you want to wrap is separated from other

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Image into Excel file from R

2010-04-25 Thread Hans-Peter Suter
> I am aware of the various packages (xlsReadWrite, RODBC) to get data
> frames into R, but I would like to copy images too.

The xlsReadWritePro version could do it (see code below). It's a
shareware package, but if people need/ask for a gratis license I send
it (please download and check ?xls.lic first; www.swissr.org). I'm
just finishing 'some' :-) RUnit tests and a new version will be
released tomorrow or after tomorrow.

Cheers,
Hans-Peter

rfile.img <- sub("origData", "origImage", rfile, fixed = TRUE)
wfile.img <- sub("tmpWriteData", "tmpWriteImage", wfile, fixed = TRUE)
pics <- c("pic1.jpeg", "pic2.png", "pic3.bmp", "pic4.emf", "pic5.wmf",
"pic.jpg")
fpics <-  file.path(dirname(rfile), pics)


### test: image
### !!! tests have to be executed in sequencial order !!!

test.proImage.1write <- function() {
exc <- xls.open(rfile.img)
xls.image(exc, "set", fpics[1], "Pic1")
xls.image(exc, "set", fpics[2], "Pic2")
xls.image(exc, "set", fpics[3], "Pic3")
xls.image(exc, "set", fpics[4], "Pic4")
xls.image(exc, "set", fpics[5], "Pic5")
xls.image(exc, "set", fpics[6], c(17, 7, 20, 8))
xls.close( exc, file = wfile.img)

res <- xls.image(wfile.img, "list")
checkIdentical(res, c("Grafik 1", fpics))
}

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Do you keep an archive of "useful" R code? and if so - how?

2009-11-22 Thread Hans-Peter Suter
> Marc -
> I thank you for the links and ideas. Thanks to your advice I will look more
> into SVN in the future, although it sounds on the surface to require some
> learning curve, so It could take me some time to start using it.

If you consider investing time to learn a version control system, I
would recommend looking into a distributed one. - Personally I use
git. http://git-scm.com/ is a good start, http://www.github.com can be
used to store code 'in the cloud'.

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Excel-Export

2009-11-24 Thread Hans-Peter Suter
Jens,

2009/11/23 koj :
> library(xlsReadWrite)
> Everything is fine, but the format of the export is not the best. For
> example, I every time have to adjust the column width. Furthermore there is
> no possibility to highlight some cell or make them colourful.

Auto-col is supported by the underlying library and should be doable
easily. Formatting probably only in the pro version, but in any case I
intend to work on crossplatform support first (for both versions).

Feel free to submit a feature request here:
https://redmine.swissr.org/projects/xlsreadwrite
username: traveleR, password: namaste
(sha1 fingerprint: A4:28:1D:3A:C3:96:01:4B:8F:4C:FC:AD:E7:B5:B7:84:B1:6B:7A:E7)

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Excel-Export

2009-11-24 Thread Hans-Peter Suter
2009/11/24 Kevin Wright :
> If had done a little searching before posting, you surely would have found
> this link
> https://stat.ethz.ch/pipermail/r-help/2008-July/169149.html
> which describes how to create .xls files that are customized any way that
> you desire.

Manually convert to html, then manually hack around with a
texteditor..., not a good idea, imho. RDCOM is better.

Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Re ad & name multiple excel sheets using RODBC

2009-05-28 Thread Hans-Peter Suter
2009/5/28 Dieter Menne :
> If you only have the sheet names, you should use package xlsReadWrite which
> is rather fast, but has some limitations in the non-commercial version.

what limitations, i.e. features do you miss?

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Most used R editors

2009-06-03 Thread Hans-Peter Suter
>> I am a little lonely as R users in my group. So, I would like to know which 
>> editor is the most used in the R community.

I think Emacs+ESS is most used and the most capable (if you are
willing to invest the time to learn it properly).

Personally I mostly use TextMate with the R bundle (or RMate, own
variant thereof). On Windows I use E-Texteditor, TM's cousin. Albeit
there are some bugs & issues, E-Texteditor is quite a decent editor
and with the RMate bundle (will publish it sometime) lines can be sent
to RGui and info/help pops up. Wouldn't go back to TinnR...

Cheers,
Hans-Peter


--
emacs - “a great operating system, lacking only a decent editor”.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to convert blanks to NA

2009-06-03 Thread Hans-Peter Suter
2009/6/2 Mark Na :
> library(xlsReadWrite)
> data <- read.xls(data,colClasses=c("character"))
>
> and this results in all of the empty (blank) cells in the imported
> Excel file also being empty (blank) in the resulting dataframe.

The pro version has an 'naStrings' argument. But this is something
that should be supported since longtime also in the normal
xlsReadWrite. Thanks for reminding me  :-)  and it's now - at least -
in my Redmine tracker.

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [Ann] RMate, a bundle for TextMate and E-Texteditor

2009-06-11 Thread Hans-Peter Suter
I have uploaded RMate to Github. From the readme:

RMate is a [TextMate](http://macromates.com/) bundle for
[R](http://www.r-project.org/about.html). It is based on the [R/R
Console/Rdaemon](http://svn.textmate.org/trunk/Bundles) bundles and is
focused on:

- easy to use, clear interface/menu
- support for Windows ([E-Texteditor](http://www.e-texteditor.com/))
- editing code, R/Rd snippets and getting help/info
- connect to the standard R frontends (R.app and RGui)

Install via git:
INSTDIR=~/"Library/Application Support/TextMate/Bundles"
cd "$INSTDIR"
git clone git://github.com/swissr/rmate.tmbundle.git rmate.tmbundle
osascript -e 'tell app "TextMate" to reload bundles'


or by hand:
- download
  - the [master](http://github.com/swissr/rmate.tmbundle/zipball/master)
(i.e. most recent) version or
  - choose the (latest) tagged version
[here](http://github.com/swissr/rmate.tmbundle/downloads)
- unzip and rename to 'rmate.tmbundle' (i.e. remove swissr- and -hash)
- double click to import into TextMate'



Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] fix for RMate (TextMate/E-Texteditor bundle)

2009-06-12 Thread Hans-Peter Suter
Arg, I already needed to fix the bundle. If anyone downloaded it
yesterday, please update, the help index building was broken (on
Macs). Should work now.

Repo/Infos: http://github.com/swissr/rmate.tmbundle/tree/master

-- 
Regards,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading Excel file

2009-06-16 Thread Hans-Peter Suter
> I was using older version of R (installed early). I install new version of R 
> (R.2.9.0) but i could not find package "xlsReadWrite" to read Excel file.

As others have pointed out (thanks) you can find it here:
http://treetron.googlepages.com/.
It runs fine in 2.9.0.

> Is there any alternatives to read Excel file ?

RODBC, RExcel, gdata, use COM (search this forum for code).

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xlsReadWrite library

2009-03-23 Thread Hans-Peter Suter
2009/3/19 Pascal Candolfi :
> Any idea why this library was removed and where could I find it for Windows
> (only Unix in the Archive) ?

As indicated it was for for the binary (non FOSS) component.

Yesterday I checked the existing packages (xlsReadWrite(Pro) on
http://treetron.googlepages.com) if they run on 'R 2.9.0 under
development'. They do fine (well apart from two or three known _small_
bugs ;-).

I made a fully OSS and C-based version meanwhile which downloads (or
gives instruction how to compile for yourself) the necessary DLL from
a non-CRAN source.

However as I wanted to make sure that this 'packaging' still counts as
a 'binary distribution' I explicitely asked the developer from the 3rd
library (Flexcel) if this is ok. Last Friday I got his approval, so at
least technically/legally it is possibled.

When I'm happy with the new RUnit tests, adapted build scripts, etc.,
I'll ask again if 'xlsReadWrite' will be accepted on CRAN in this new
source-only form. I hope so, but if not then there are other
possibilities. In any case I intend to put the repo at some public
space (most probably github).

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Environments

2009-04-02 Thread Hans-Peter Suter
>> rename(x,"C","Z")

> x <- rename(x,"C","Z")
> x
A B Z D
1 2 3 4


-- 
Regards,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Surface for R outside of R

2009-05-04 Thread Hans-Peter Suter
> want an analysis. The best case were a surface of e.g. 8 Buttons, each click
> leads to start a specific R file. My outputs are JPEG or CSV, so I don`t
> need the output inside of R. Could anyone can give me some recommendations,
> what could be a solution (e. g. Java)? Is such a solution possible?

 What about batch scripts which would be called by your GUI? (maybe
you could even skip the gui...)
(see ?Rscript (unix alike) or Windows FAQ, 2.12)

--
Regards,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Fix for xlsReadWrite 1.5.2 running in R2.12.0 (32-bit) on a Win7 64-bit platform

2010-10-19 Thread Hans-Peter Suter
Argh, just now I saw a scrambled start-up message when running
xlsReadWrite1.5.2 in R2.12.0 (32-bit) on a Win7 64-bit platform. If
you have this situation and use xlsReadWrite 1.5.2 (probably all
earlier versions also) you can download a quick fix, see below. I
don't know if this also affects Vista/XP 64 bit. - Probably on the
weekend I'll have time to release a proper new 1.5.3 version.

This problem does _not_ occur on my Windows XP 32-bit and it also does
not occur when running earlier R versions (2.11, 2.10) on Win7 64bit.
No action is needed.

Problem description: as it seems, windows line endings (crlf) no
longer work in the above mentioned situation (at least in the startup
message, maybe also for other console messages). Unix line endings
(lf) seem to work fine, no more scrambling and the unit tests pass (of
course).

Fix (as mentioned only needed for R2.12 users on Win7 64 bit):
- you can download a fixed dll from the normal swissr dropbox:
http://dl.dropbox.com/u/2602516/swissrpkg/bin/win32/shlib/xlsReadWrite_1.5.2_dll.zip
(md5 value: 192e045ba939d78d5097863959b020bd). Just replace the
existing dll.
- another way would be to delete the xlsReadWrite package locally and
re-download from CRAN. The 'xls.getshlib()' command will fetch the
updated dll
- (I have removed the regular xlsReadWrite 1.5.2 package from the
dropbox bin/win32/2.12 branch as it contains a dll with the above
mentioned problem (unfortunately my make environment is broken for
R2.12 building atm))

When executing 'library(xlsReadWrite)' with the updated dll, the
startup message will read '..version 1.5.2 (sha1:
)'. Changes have been pushed as
http://github.com/swissr/xlsreadwrite/commit/17a8d1c076b622f842cae443ebff00b1bb254bbe.

Cheers,
Hans-Peter
(author of xlsReadWrite)

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Updates for xlsReadWrite (1.5.3) and xlsReadWritePro (1.6.1/3)

2010-11-29 Thread Hans-Peter Suter
m Excel)
  - NEW ARGUMENT 'checkNames' to optionally treat colnames with 'make.names'
  - NEW ARGUMENT 'strictArea'
- background: when the library opens an Excel file it determines
the area which
  is containing data (see variables sheet.nrow and sheet.ncol from
xls.info)).
- arguments:
  - NA (default): rows/cols must be inside Excel data area,
to/from can be outside
  - TRUE: rows/cols/to/from must all be inside Excel data area
  - FALSE: rows/cols/to/from are allowed to be outside the Excel data area
  - values which cannot be converted become NA (for double it was NaN before)
o write.xls
  - naStrings the DEFAULT CHANGES from NA to '', i.e. cells will be cleared
o read.xls/write.xls
  - rows/cols arguments can be used together. This is kind of subsetting Excel:
'ExcelSheet[, ]', i.e. 'ExcelSheet[c(3, 4, 6), c(2, 4)]'
  - colNames
- supports scalar number to denote row to be used for column names
- several default related changes 'X', 'X.1', 'V1' (see ?read.xls)
  - rowNames: character scalars do no longer select a column (use
numbers instead)
  - colnames/rowNames: number value may be a double (and not only integer)
  - NaN will be written as 'NaN' (instead of 2.69653970229347E+308)
and can be re-read
  - support empty objects (without data but with column names)
  - area-arguments (except 'cell') always include rowname/colnames
(slightly inconsistent before)
o xls.image:
  - support for vector images (wmf, emf)
  - new 'export' action to save an Excel pictures to a file
o xls.close always attempts to save a modified Excel object (use xls.cancel to
  discard changes and close object)
o xls.cancel: 'what' argument removed (use 'obj = NA' to cancel all objects)
o xls.info
  - 'onlyFileInfo', 'what' arguments dropped (always provide full info)
  - SOME LIST ELEMENT names have been RENAMED/ADDED
  - some double types have become integers
o date time helper functions:
  - properly initialize format settings (with GetUserDefaultLangID, it probably
incorrectly defaulted to US settings on some systems before)
  - isodatetime format: some time formats added
  - yesterday() and tomorrow() give back dates instead of oledatetimes
o misc. other bugfixes (writing RUnit tests exposes glitches, ahem...)

--- 'technical' ---

o move from Subversion to git
o quite substancial code refactoring


Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] ReadWrite.xls problem

2010-12-10 Thread Hans-Peter Suter
Toby, haruo0409,

2010/12/8 tkdweber :
> This is my Error-Message in its German original:
> Fehler in .Call("ReadXls", file, colNames, sheet, type, from, rowNames,  :
>  Falsche Anzahl von Argumenten (11), erwarte 10 für ReadXls

There was a wrong DLL for a short while in the old 1.5.2 version (I
fixed a R2.12.0 related issue and unfortunately introduced this
error). If you delete the old xlsReadWrite package and re-install the
package (either from CRAN or see www.swissr.org/download) it really
should work.

2010/12/10 haruo0409 :
> I'm also annoyed at same problem.
> I installed xlsReadWriter today and entered
>  x <- read.xls("data.xls",sheet=1)
> But I got Error Message:
>  以下にエラー .Call("ReadXls", file, colNames, sheet, type, from, rowNames,  :
>   引数の個数(11)が不正です。10 個が ReadXls に対しては必要です
> (It's Japanese.Its English translation is the same as yours)

What's the 'library(xlsReadWrite)' startup message? For the current
version it should be: 'xlsReadWrite version 1.5.3 (0b78c1)'. Could you
please give more details about 'I installed xlsReadWriter today'
(which CRAN mirror, 'R.version' and '.Platform' output, is there only
one 'xlsReadWrite.dll' file on your system). It is supposed to work
and I am unable to find any problem. Thanks a lot!

2010/12/8 tkdweber :
>Without being able to read data, the
> programme renders pointless for me :-(

There are many ways to read/write data in R:
* Other than load/save you could use read.table/write.table (see R
Data Import/Export).
* Using Excel files is not the recommended way. However when you
want/need it, there are several options (see
http://rwiki.sciviews.org/doku.php?id=tips:data-io:ms_windows)

Cheers,
Hans-Peter

PS. not that I mind to discuss things here, but as these are package
specific problems I'd suggest to switch to the xlsReadWrite forum
(http://dev.swissr.org/projects/xlsreadwrite/boards). You also can
create an issue
(http://dev.swissr.org/projects/xlsreadwrite/issues/new) or just send
an email to 'support' at 'swissr.org').

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] xlsReadWrite 1.5.4 and xlsReadWritePro 1.6.4 released

2011-01-25 Thread Hans-Peter Suter
The xlsReadWrite[Pro] package allows to natively read and write Excel
files (.xls) on the Win 32-bit platform.

Changes:

o fix bug with integer conversion (http://dev.swissr.org/issues/113)

  PROBLEM: values outside the integer range (i.e. 12345678901) didn't give an NA
   (and a warning message) but have been converted to a wrong value
  WHERE:
- free/pro: reading an Excel sheet and explicitely defining:
'colClasses = "integer"'
  or 'type = "integer". It's assumed that only very few people do this.
- pro: when (auto) detecting a data.frame column type for numeric
values the type becomes
  an 'integer' in some situations. This probably affects more
people than above
  SOLUTION:
- an error will be raised for too large/small values (same as in read.table)
- numeric data.frame column types default to 'double' (as in the
free version)

o adapt RUnit tests to new behaviour
o some small cosmetic changes

Credits to Gyorgy Ottucsak who found the problem in xlsReadWritePro
and send us a report (incl. testfile). Thanks a lot!

The new xlsReadWrite version will be submitted to CRAN in a moment.
Both updated packages are available now from www.swissr.org/download
or - full listing - here:
http://dl.dropbox.com/u/2602516/swissrpkg/index.html.

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] reading dates in Excel into R

2010-07-31 Thread Hans-Peter Suter
2010/7/30 Dimitri Liakhovitski :
> I've wasted a lot of time trying to read in dates from Excel. Even
> importing .csv files has not guarantees and often produces garbage
> instead of dates.
> What I found works best is saving the Excel data base as a
> tab-delimited file .txt (after having formatted the dates in the
> format you need, e.g., mm/dd/). And then you can read it
> (including dates) into R no problems.

If you are on windows and (can) use .xls files, my xlsReadWrite
package should work well with dates.

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Need to read an Excel File

2010-07-31 Thread Hans-Peter Suter
2010/7/30 rajibshibly :
>
> I am trying to read an Excel file using the following:
> a<-read.xls("mydata.xls", sheet=1)
[snip]
> Error in findPerl(verbose = verbose) :
>  perl executable not found. Use perl= argument to specify the correct path.
> Error in file.exists(tfn) : invalid 'file' argument

The 'read.xls' function in the the xlsReadWrite package (Win32 only)
doesn't have external dependencies. Might be an option as well.

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help

2010-08-13 Thread Hans-Peter Suter
or

library(xlsReadWrite)
write.xls(tab, "somefile.xls")  # not .xlsx

or  lots of other possibilities (e.g. RODBC, RExcel, gdata, WriteXLS)
you would have found searching the mailling list archive or looking in
the R import/export manual or the R wiki...

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] [R-pkgs] xlsReadWrite v1.5.2

2010-09-07 Thread Hans-Peter Suter
Natively read and write Excel (.xls) files. Supports Windows 32-bit only (atm).

A new version has been released:

-- changes --

o read.xls
  - new arguments 'checkNames'
  - recognize NA values according to a new 'naStrings' argument
  - recognize NaN values
  - recognize 'true', 'false' (not case-sensitive) as logical when
determing a class for data.frame column;
when the value in the first cell is an integer, a numeric will be
assumed nevertheless
  - colnames are more consistent with R usage (X, X.1, V1, etc.)
  - matrices always have rownames (as in data.frame). With FALSE
rownames become (integer) 1:length(rows)
  - duplicated rownames no longer accepted
  - allow data with one row which is defined as being the colnames
(i.e. no 'real' data row)
  - colNames/colClasses can optionally contain an entry for the column
used for the rownames
o write.xls
  - error (instead of warning) when length of character colnames
doesn't fit data
  - write NA values according to the 'naStrings' (scalar) argument
  - write NaN values as 'NaN' string (instead of ending as #ZAHL!)
  - colNames can optionally contain an entry for the column used for
the rownames
o template location moved
  - new: R_HOME/library/xlsReadWrite/template/TemplateNew.xls
  - (old/erronous: R_HOME/library/xlsReadWrite/libs/template, reported
by B. Ripley)
o RUnit tests extended, loading simplified
o improve examples and run them on the regular version, polish docu

-- bugfixes --

o file: path may be absolute or relative to the current working directory.
  The 'relative' part was broken (feedback from several people)
o xls.getshlib: sometimes existing dll could not be replaced. Now uses path
  of loaded dll instead of lib.loc and path (reported by G. Grothendieck)
o use .Platform$r_arch for shlib path and R.version$platform in xls.getshlib
  to make pkg compatible with R2.12dev (reported and tips by B. Ripley)
o several fixes related to row/colnames in special cases (without data)

-- 'ecosystem' --

o issue tracking (developer) link change:
  - http://dev.swissr.org (was: https://redmine.swissr.org)
  - allow guest login and directly mention credentials


Cheers,
Hans-Peter

___
R-packages mailing list
r-packa...@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-packages

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Free license for xlsReadWritePro

2011-03-26 Thread Hans-Peter Suter
Some years ago I travelled through Libya and it's with much emotion
that I follow the news.

The license below is dedicated to Mohammed Nabbous and will let you
run xlsReadWritePro for free (Windows, R 32-bit):

library( "xlsReadWritePro" )
xls.lic( action = "register",
 miscData = list(
User = "R.I.P. Mohammed Nabbous",
Company = "Let's hope that Libya will become free",
Product = "xlsReadWritePro",
Date = "2011-03-19",
LicenseType = "SingleUser",
Count = 1,
Key = "76991137f5f554a288e8cee343a24722",
WhereToStore = "ProgramFolder" ) )

Info/download at http://swissr.org. Direct download links at
http://dl.dropbox.com/u/2602516/swissrpkg/index.html. Support
(tracker) at http://dev.swissr.org/.

Let's hope that Libya will become free,

Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help to ... import the data from Excel

2011-11-15 Thread Hans-Peter Suter
Jim,

2011/10/15 jim holtman :
> You might also want to consider the XLConnect package.  I have had
> better luck reading/writing Excel files than with xlsReadWrite.

XLConnect looks good but - as the xlsReadWrite author and planing to
release a xlsx/64 bit successor - I'd be interested to learn what you
mean with "better luck reading/writing". Thanks a lot and

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] help to ... import the data from Excel

2011-11-28 Thread Hans-Peter Suter
2011/11/15 jim holtman :
> Part of my problem has to do with getting through the corporate
> firewall to access the other program I have to download to use it.  I
> just tried today and this is what I got:
>
>> xls.getshlib()
> Loading required package: tools
> --- xls.getshlib running... ---
>  - download.file from
> 'http://dl.dropbox.com/u/2602516/swissrpkg/bin/win32/shlib/xlsReadWrite_1.5.4_dll.zip'
> (timeout: 60)
> Error in copyOrDownload(url) :
>  downloading 
> 'http://dl.dropbox.com/u/2602516/swissrpkg/bin/win32/shlib/xlsReadWrite_1.5.4_dll.zip'
> to 'C:\DOCUME~1\kon9407\LOCALS~1\Temp\RtmpQR6rWi/xlsReadWrite.zip' failed
> In addition: Warning message:
> In download.file(url, fpzip.temp, method = "internal", quiet = TRUE,  :
>  cannot open: HTTP status was '403 Forbidden'

Yes unfortunately quite some people had problems downloading the shlib
because dropbox (where I host the file) is being blocked b/c of
corporate policies. I am working on a successor, xlReadWrite (which
supports xlsx, 64 bit and probably Macs) where I try to find a better
solution (probably a mirror on my own server).

> I think when I was using it in the past, I had some problem with
> writing to multiple output sheets so I could create tabs on the
> workbook, but not really sure what was happening at the time.  I have
> had better luck with XLConnect in creating tabbed workbooks.

Writing multiple tabs was never supported in the free version (only in
Pro). XLConnect certainly looks good and also has the advantage that
it is FOSS, something I cannot do because of the usage of a
proprietary library.

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Building binary package fails because of missing dependent package

2008-09-22 Thread Hans-Peter Suter
On an (Intel Leopard) Mac I try to build a package (mxFinance) which
depends on another package (mxGraphics). The dependendy is 1) a
'Depends:' in DESCRIPTION and 2) an import in NAMESPACE.

- The build fails if the dependent package (mxGraphics) is not
installed in the R.framework

Do I need to have installed all packages which are required by
packages to be built binary (source builds are ok)?

Cheers,
Hans-Peter


---
Macintosh:mxFinance chappi$ R CMD BUILD --binary mxFinance
* checking for file 'mxFinance/DESCRIPTION' ... OK
* preparing 'mxFinance':
* checking DESCRIPTION meta-information ... OK
* cleaning src
* removing junk files
* checking for LF line-endings in source and make files
* checking for empty or unneeded directories
* building binary distribution
* Installing *source* package 'mxFinance' ...
** libs
** arch - i386
gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4 -std=gnu99
-I/Library/Frameworks/R.framework/Resources/include
-I/Library/Frameworks/R.framework/Resources/include/i386  -msse3
-fPIC  -g -O2 -march=nocona -c init.c -o init.o
gcc -arch i386 -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4 -std=gnu99 -dynamiclib
-Wl,-headerpad_max_install_names -mmacosx-version-min=10.4 -undefined
dynamic_lookup -single_module -multiply_defined suppress
-L/usr/local/lib -o mxFinance.so init.o
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
-Wl,CoreFoundation
ld: warning, duplicate dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.1.dylib
** arch - ppc
gcc -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4 -std=gnu99
-I/Library/Frameworks/R.framework/Resources/include
-I/Library/Frameworks/R.framework/Resources/include/ppc
-I/usr/local/include-fPIC  -g -O2 -c init.c -o init.o
gcc -arch ppc -isysroot /Developer/SDKs/MacOSX10.4u.sdk
-mmacosx-version-min=10.4 -std=gnu99 -dynamiclib
-Wl,-headerpad_max_install_names -mmacosx-version-min=10.4 -undefined
dynamic_lookup -single_module -multiply_defined suppress
-L/usr/local/lib -o mxFinance.so init.o
-F/Library/Frameworks/R.framework/.. -framework R -Wl,-framework
-Wl,CoreFoundation
ld: warning, duplicate dylib
/Developer/SDKs/MacOSX10.4u.sdk/usr/local/lib/libgcc_s.1.dylib
** R
** data
** preparing package for lazy loading
Loading required package: mxGraphics
Warning in library(pkg, character.only = TRUE, logical.return = TRUE,
lib.loc = lib.loc) :
  there is no package called 'mxGraphics'
Error: package 'mxGraphics' could not be loaded
Execution halted
ERROR: lazy loading failed for package 'mxFinance'
** Removing 
'/var/folders/xr/xr01D7JAEtGe4S5uaDQSgTI/-Tmp-/Rinst881133514/mxFinance'
 ERROR
* installation failed

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] problem with writing data to *.xls file

2009-01-23 Thread Hans-Peter Suter
> I read data from *.xls file and i did some caliculations on that data and
> now i have to create a column in the same .xls file

> i tried it with *write.xls() *but the thing is it deleted all the columns
> previously presented in that file and it created a column and inserted data
> can any one suggest what to do for this

You cannot insert a column in the sheet but you can write a data
matrix/frame which contains the newly calculated column.

myfile <- "test.xls"

  # read data
#dat <- read.xls( myfile )
dat <- cbind( 1:4, rep(41,4), rep(43,4) )

  # calculate and prepare full data to write
calc <- dat[,2] + 1
dat <- cbind( dat[,1], dat[,2], calc, dat[,3] )

  # write (sheet will be overwritten with new data)
#write.xls( dat, myfile )


-- 
Regards,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Dates and times from Excel

2009-02-23 Thread Hans-Peter Suter
> Excel stores times of the day as fractions of a day so I wrote a function to
> convert the fraction to a number of seconds, extract the hours, minutes and
> seconds and output it in ISO standard format (%H:%M:%S).

What about the 'colClasses' or 'dateTimeAs' argument in 'read.xls'
which gives back an iso-date-time character string. Or you could use
the 'dateTimeToStr' function to convert the date number to a character
string formatted as indicated.

As a question: would additional entries (e.g.) 'posixctdatetime'
and/or 'chrondatetime' for the 'colClasses' argument be useful?

-- 
Regards,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] xlsReadWrite package repository for Ubuntu

2009-03-03 Thread Hans-Peter Suter
2009/3/2 Prof Brian Ripley :
> The CRAN Windows ones.  It is a windows-only package, see
> http://cran.r-project.org/web/packages/xlsReadWrite/index.html
> (incidentally to you: it seems no longer maintained and does not build under
> R-devel on Windows, see
> http://cran.r-project.org/bin/windows/contrib/2.9/check/xlsReadWrite-check.log
> The maintainer has not responded to requests for a fix.)

I didn't get a request (my email was ' instead of
). I'll look into the issue this weekend.

However there might be a problem because the package contains binary
code and maybe xlsReadWrite has to be put on a place other than CRAN
(I'll ask Rcore about this in a separate email). In any case I
absolutely intend to maintain the package also in future. AFAIK it
works well (apart from a small rowname bug which surfaced recently ;-)
and provides a pragmatic alternative to the OSS R packages gdata and
RODBC)

2009/3/3 Marc Schwartz :
> You perhaps missed the key point in Uwe's response, which is that the
> package is only available under Windows, as it depends upon Windows
> specific functionality (MS Office API via a third party library which is
> available for Windows only) to natively read and write Excel files.

It's correct that xlsReadWrite is currently only available for
Windows. However it doesn't use the MS Office API but  works directly
with the file format (BIFF8), i.e. Excel is _not_ required. True is,
that it uses a third party library (Flexcel, TMSSoftware). This
library supports FreePascal which means that theoretically
xlsReadWrite could be compiled for Linux/Mac (tried once, didn't
succeed, will try again later (now also using Macs and
Debian/Ubuntu)).

-- 
Regards,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] Creating an Excel file with multiple spreadsheets

2009-03-11 Thread Hans-Peter Suter
2009/3/9 Phil Spector :
> The xlsReadWrite package provides write.xls for Windows,

but it cannot write _multiple_ spreadsheets

-- 
Regards,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] read.xls question

2009-03-16 Thread Hans-Peter Suter
2009/3/15 David Scott :
> On Sat, 14 Mar 2009, Mathew, Abraham T wrote:
> [snip]
> Just checking on CRAN xlsReadWrite is not currently available. There is an
> archived version available however.

Thanks for mentioning.

The reason is that CRAN is strict(er) now with binary submissions
(which is not a bad thing) and the build also broke technically with
R-2.9 because I used a private build variable which is no longer
supported. I adapted the package to use C code and download the
necessary 3rd party binary code from an external e.g. non-CRAN site.
Now I am waiting to get the ok from the 3rd party library provider
before submitting it again and see what is possible.

Besides from the archive you can get the xlsReadWrite package here:
http://treetron.googlepages.com/ (direct link:
http://treetron.googlepages.com/xlsReadWrite_1.3.3.zip). - As an R
newbie (OP) it is maybe better to use something more standard,e.g.
RODBC package, eventually (it's good but you need Perl!) the gdata
package or use plain old .csv files (but watch out fro dropped decimal
places!) .

2009/3/15 Rodrigo Aluizio :
> [snip]
> A better alternative to this package is RODBC, which also read excel 2007
> files. Take a look on it at the CRAN web site.

If you mean better because of Excel 2007 then I disagree: xls files
work well with Excel 2007, the format is widely in use and if you
reach their limit (65536 rows by 256 columns) you'd better choose a
database (and use RODBC) imho. Reading natively without depending on
additional layers (driver, perl, COM) benefits too. - If you mean
'more R standard' or OSS then I agree.

Cheers,
Hans-Peter

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.