[R] XML - ampersand escaped

2009-12-03 Thread Ido M. Tamir
Hi,
I create some DOM with XML and would like to include
cap; in the text of an element. The library automatically
escapses it to amp;cap;.
unescaping \\cap; does not help.

any ideas?
My current plan is to go through the output and replace it
with gsub, but maybe there is a better way?

thanks,
ido

 library(XML)
 xml - xmlTree(tree)
Warning message:
In xmlRoot.XMLInternalDocument(currentNodes[[1]]) : empty XML document
 xml$addNode(test,a cap; b)
 xml$addNode(test,a \\cap; b)


 xml$value()
?xml version=1.0?
tree
  testa amp;cap; b/test
  testa \amp;cap; b/test
/tree

__
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] dev2bitmap: extra missing

2008-11-03 Thread Ido M. Tamir
Hi,
I don't know if I am the first one to report the problem:
in 2.8.0 dev2bitmap gained aa support, but extra is null
if neither taa nor naa is specified.

 dev2bitmap(plot.pdf,type=pdfwrite)
Error in paste(shQuote(gsexe),  -dNOPAUSE -dBATCH -q -sDEVICE=, type,  : 
  object extra not found
 dev2bitmap(plot.pdf,type=pdfwrite,taa=4)
 

I guess a useful default for extra is missing:

   if (!is.na(taa))
extra - paste( -dTextAlphaBits=, taa, sep = )
if (!is.na(gaa))
extra - paste(extra,  -dGraphicsAlphaBits=, gaa, sep = )
cmd - paste(shQuote(gsexe),  -dNOPAUSE -dBATCH -q -sDEVICE=,
type,  -r, res, -dAutoRotatePages=/None,  -g, ceiling(res *
width), x, ceiling(res * height), extra,  -sOutputFile=,
shQuote(file),  , tmp, sep = )

best wishes,
ido


 R.Version()
$platform
[1] x86_64-redhat-linux-gnu

$arch
[1] x86_64

$os
[1] linux-gnu

$system
[1] x86_64, linux-gnu

$status
[1] 

$major
[1] 2

$minor
[1] 8.0

$year
[1] 2008

$month
[1] 10

$day
[1] 20

$`svn rev`
[1] 46754

$language
[1] R

$version.string
[1] R version 2.8.0 (2008-10-20)

__
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] 2.7.0 breaks read.table

2008-06-30 Thread Ido M. Tamir
Hi,
yes a bold statement, but I get different behaviour
from 2.6.2 and 2.7.0 in read.table, and I don't find
any documentation in http://cran.r-project.org/src/base/NEWS.

A file like (space delimited):
foo +   .
bar -   .

2.7.0:
 tab - read.table(test.txt,as.is=TRUE)
 tab
V1 V2 V3
1 foom  0  0
2  bar  0  0

while until now and on 2.6.2
 tab - read.table(test.txt,as.is=TRUE)
 tab
V1 V2 V3
1 foom  +  .
2  bar  -  .

the really strange thing I just saw when
preparing the simplified test case - I normally use
tab delimited files (biological gff files by the way
where +/- and . have some meaning).

on 2.7.0:
tab - read.table(test.txt,sep=\t, as.is=TRUE)
 tab
V1
1 foom + .
2  bar - .

so specifying the wrong separator brings up the
old correct behaviour.

best wishes,
ido

PS:
I hope I cancelled the first non-member mailing list post in time - I forgot 
the system:
 R.Version()
$platform
[1] x86_64-redhat-linux-gnu

$arch
[1] x86_64

$os
[1] linux-gnu

$system
[1] x86_64, linux-gnu

$status
[1] 

$major
[1] 2

$minor
[1] 7.0

$year
[1] 2008

$month
[1] 04

$day
[1] 22

$`svn rev`
[1] 45424

$language
[1] R

$version.string
[1] R version 2.7.0 (2008-04-22)

__
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] paste data

2008-06-18 Thread Ido M. Tamir
I want to do very similar things with all the dataframes and their structure 
is also the same.
Is there a way to write a loop? (so that I don't have to write the same 18 
times)
I tried things like that:
for (x in 1:length(plot))
{
   plot(paste(auto.,plot[x],sep=)[,1],
   paste(auto.,plot[x],sep=)[,2],col=...) 
}

you need to get() the data frames.


for (x in 1:length(plot))
{
df  - get(plot[x])
plot(df[,1],df[,2],col=...)
}


HTH,
ido

__
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] Rscript on OSX

2008-01-09 Thread Ido M. Tamir
Hi,

I directed somebody to install R (2.6.1) on his OSX computer,
following instructions from http://cran.r-project.org/bin/macosx.
She can run R from the console.
But plot(1:10) doesn't produce any output or open a window (as I am
used to from linux).

More importantly:
Rscript is not in the path (minor problem ln -s is hopefully doable). I tried 
to put a hardcoded path to Rscript into the shebang line but this fails. And 
when I try to invoke it directly:

-bash: ./Rscript: cannot execute binary file

On linux this works.

I would like to send her some Rscripts, but how can we make them
run on her system?



thank you very much,
ido



imaclab3:/Library/Frameworks/R.framework/Resources/bin ru$ ls -l 

total 1008
-rwxrwxr-x   1 root  admin    1654 Nov 26 17:36 BATCH
-rwxrwxr-x   1 root  admin    2188 Nov 26 17:36 COMPILE
-rwxrwxr-x   1 root  admin   34391 Nov 26 17:36 INSTALL
-rwxrwxr-x   1 root  admin    1593 Nov 26 17:36 LINK
-rwxrwxr-x   1 root  admin    7210 Nov 26 17:37 R
-rwxrwxr-x   1 root  admin    7210 Nov 26 17:37 R.orig
-rw-rw-r--   1 root  admin     655 Nov 26 17:37 R.rej
-rwxrwxr-x   1 root  admin    2244 Nov 26 17:36 REMOVE
-rwxrwxr-x   1 root  admin     928 Nov 26 17:36 Rcmd
-rwxrwxr-x   1 root  admin    9523 Nov 26 17:36 Rd2dvi
-rwxrwxr-x   1 root  admin     842 Nov 26 17:36 Rd2txt
-rwxrwxr-x   1 root  admin    3237 Nov 26 17:36 Rdconv
-rwxrwxr-x   1 root  admin    1320 Nov 26 17:36 Rdiff
-rwxrwxr-x   1 root  admin    2854 Nov 26 17:36 Rprof
-rwxrwxr-x   1 root  admin   18084 Nov 26 17:36 Rscript
-rwxrwxr-x   1 root  admin    4656 Nov 26 17:36 SHLIB
-rwxrwxr-x   1 root  admin   16129 Nov 26 17:36 Sd2Rd
-rwxrwxr-x   1 root  admin     730 Nov 26 17:36 Stangle
-rwxrwxr-x   1 root  admin     726 Nov 26 17:36 Sweave
-rwxrwxr-x   1 root  admin   21715 Nov 26 17:36 build
-rwxrwxr-x   1 root  admin   78570 Nov 26 17:36 check
-rwxrwxr-x   1 root  admin    6927 Nov 26 17:36 config
drwxrwxr-x   4 root  admin     136 Nov 26 17:36 exec
-rwxrwxr-x   1 root  admin    3613 Nov 26 17:36 f77_f2c
-rwxrwxr-x   1 root  admin   10720 Nov 26 17:36 javareconf
-rwxrwxr-x   1 root  admin  215101 Nov 26 17:36 libtool
-rwxrwxr-x   1 root  admin    3495 Nov 26 17:36 mkinstalldirs
-rwxrwxr-x   1 root  admin     413 Nov 26 17:36 pager

__
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] Efficient way to substract all entries in two vectors from each other

2008-01-07 Thread Ido M. Tamir
Johannes Graumann wrote:

 Hi all,
 
 I'm to inexperienced to come up with the matrix solution elusively
 appearing on the horizon for the following problem and would appreciate if
 you could give me a nudge ...
 I have two vectors a, and b and need to find the closest match for each
 value of a in b.
 How to do that efficiently?

I am not sure if I understood your problem correctly, 
but maybe this is of help.
However its not memory efficient.

 a - c(3,10,50,100)
 b - c(7,8,300)
 b[apply(abs(outer(a,b,-)),1,which.min)]
[1] 7 8 8 8

In Biobase there is the matchpt function doing this
efficiently.

best wishes,
ido

__
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] get rid of format padding

2007-11-30 Thread Ido M. Tamir
Dear readers,

I need to prevent the output of very large
integers in scientific format.
So I use format, but now the integers in the
resulting tab delimited output file are padded.

I tried justify=none or left, width=0 but nothing
helps.

1\tA\t1\t1
2\ta\t1\t1
^^^

thank you very much for your suggestions,

ido

 vals - c(1,1)
 df - data.frame(c(A,b),format(vals),vals)
 write.table(df,test.tab,sep=\t,header=FALSE,quote=FALSE)
 df - data.frame(c(A,b),format(vals,just=none),vals)

__
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 with talking to R from Java (on Window)

2007-11-20 Thread Ido M. Tamir
Does anybody know any alternative ways to be able to call R from Java? 

JRI
http://rosuda.org/JRI/
now contained in rJava
http://www.rforge.net/rJava/

and new is this one which
I think provides something on top of rJava maybe
Rserve:

http://www.ebi.ac.uk/microarray-srv/frontendapp/BIOCEP_README.txt

best wishes
ido

__
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.