[R] Problem with Tinn-R communicating with REvolution R

2010-04-27 Thread Mike White
I have been using Tinn-R with R without any problems but when I try to use it 
with REvolution R I get the following error message when Tinn-R runs the 
configuration script and gets to the trDDEInstall() function:

## Start DDE
trDDEInstall()
 trDDEInstall()
Error in structure(.External(dotTcl, ..., PACKAGE = tcltk), class = 
tclObj) :
  [tcl] invalid command name dde.
In addition: Warning message:
In tclRequire(dde, warn = TRUE) : Tcl package 'dde' not found

I have not found anything about this on the Tinn-R forum and have had no 
repsonse from the REvolution R forum.
I have checked other R-Help queries but these relate to adding the code for 
.trPaths which I already have.
Does anyone know how to solve this problem?

[[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] Tinn-R RGui Send problem

2010-05-06 Thread Mike White
A possible work around would be to append the selection.r file to the .RHistory 
file and then reload the history, e.g.
file.append(.Rhistory, .trPaths[5])
loadhistory(file= .Rhistory)
You can then access the code on the console, skipping the last 2 lines.
[[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] Tinn-R RGui Send problem

2010-05-07 Thread Mike White
A possible work around would be to append the selection.r file to the .Rhistory 
file and then reload the history, e.g.
file.append(.Rhistory, .trPaths[5])
loadhistory(file= .Rhistory)
You can then access the code on the console, skipping the last 2 lines.
[[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] Fwd: R apply() help -urgent

2010-05-11 Thread Mike White
Set up a function for the fisher.test on a 2x2 table and then include 
this in the apply function for columns as in the example below. The 
result is a list with names A to Z


# set up a dummy data set with 100 rows
Cat-LETTERS[sample(1:6,100, replace=T)]
GL-sample(1:6, 100, replace=T)
dat-matrix(sample(c(0,1),100*27, replace=T), nrow=100)
colnames(dat)-c(LETTERS[1:26],pLoss)
data1-data.frame(Cat, GL, dat)

# define function fro fisher.test
ff-function(x,y){
fisher.test(table(x,y))
}

# apply function to columns A to Z
results-apply(data1[,LETTERS[1:26]],2, ff, y=data1[,pLoss])
# the results are in the form of a list with names A to Z
results$C


On 19:59, Venkatesh Patel wrote:

-- Forwarded message --
From: Dr. Venkateshdrve...@liv.ac.uk
Date: Sun, May 9, 2010 at 4:55 AM
Subject: R apply() help -urgent
To: r-help@r-project.org


I have a file with 4873 rows of 1s or 0s and has 26 alphabets (A-Z) as
columns. the 27th column also has 1s and 0s but stands for a different
variable (pLoss). columns 1 and 2 are not significant and hence lets ignore
them for now.

here is how the file looks

CatGL  A   B   C   D   E   F   G   H   I   J   K   L   M   N   O   P   Q
   R   S   T   U   V   W   X   Y   Z pLoss
H  5   0   0   0   0   0   0   0   1   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0 1
E  5   0   0   0   0   1   0   0   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0 1
P  6   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   0
   0   0   0   0   0   0   0   0   0 1
P  5   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   1   0
   0   0   0   0   0   0   0   0   0 1
F  6   0   0   0   0   0   1   0   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0 1
E  4   0   0   0   0   1   0   0   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0 1
H  5   0   0   0   0   0   0   0   1   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0 1
J  4   0   0   0   0   0   0   0   0   0   1   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0 1
J  4   0   0   0   0   0   0   0   0   0   1   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0 1
E  5   0   0   0   0   1   0   0   0   0   0   0   0   0   0   0   0   0
   0   0   0   0   0   0   0   0   0 1
S  6   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0   0
   0   1   0   0   0   0   0   0   0 1
..
..
..
..
..
..

Alphabets A-Z stand for different categories of protein families and pLoss
stands for their presence or absence in an animal.

I intend to do Fisher's test for 26 individual 2X2 tables constructed from
each of these alphabets vs pLoss.

For example, here is what I did for alphabet A and then B and then C so
on. (I have attached R-input.csv for your perusal)

   

data1- read.table(R_input.csv, header = T)
datatable- table(data1$A, data1$pLoss) #create a new datatable2 or 3
 

with table(data1$B.. or  (data1$C.. and so on
   

datatable
 

01
   0   31 4821
   10   21

now run the Fisher's test for these datatables one by one for the 26
alphabets :(

fisher.test(datatable), ... fisher.test(datatable2)...

in this case, the task is just for 26 columns.. so I can do it manually.

But I would like to do an automated extraction and fisher's test for all the
columns.

I tried reading the tutorials and trying a few examples. Cant really come up
with anything sensible.

How can I use apply() in this regard? or is there any other way, a loop may
be? to solve this issue.

Please help.

Thanks a million in advance,

Dr Venkatesh Patel
School of Biological Sciences
University of Liverpool
United Kingdom





__
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] Problem with Sweave not recognising \Sexpr{}

2010-05-25 Thread Mike White
I am trying to run the Sweave example at 
http://www.stat.uni-muenchen.de/~leisch/Sweave/Sweave-Rnews-2002-3.pdf
However, the \Sexpr{} code is not being evaluated, although the actual R 
code within the {} runs ok in R.
Below is part of the resulting .tex file.  Can anyone help identify the 
cause? I am using R 2.10.1 on Windows XP.


Consider the \texttt{cats} regression example from Venables \ Ripley
(1997). The data frame contains measurements of heart and body weight
of \Sexpr{nrow(cats)} cats (\Sexpr{sum(cats$Sex==F)} female,
\Sexpr{sum(cats$Sex==M)} male).

Thanks
Mike White

__
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 Sweave not recognising \Sexpr{}

2010-05-25 Thread Mike White
I think I have solved the problem. In the Sweave manual it mentions that 
problems may occur after loading the R2HTML package.  I have not 
recently loaded this package but the proposed solution to problems 
caused by R2HTML also solves my problem with the evaluation of R code in 
\Sexpr. It seems that it is necessary to set the syntax option in the 
Sweave function as follows

Sweave(..., syntax=SweaveSyntaxNoweb)
 although I am not sure why this is required.
Mike

On 19:59, Mike White wrote:
I am trying to run the Sweave example at 
http://www.stat.uni-muenchen.de/~leisch/Sweave/Sweave-Rnews-2002-3.pdf
However, the \Sexpr{} code is not being evaluated, although the actual 
R code within the {} runs ok in R.
Below is part of the resulting .tex file.  Can anyone help identify 
the cause? I am using R 2.10.1 on Windows XP.


Consider the \texttt{cats} regression example from Venables \ Ripley
(1997). The data frame contains measurements of heart and body weight
of \Sexpr{nrow(cats)} cats (\Sexpr{sum(cats$Sex==F)} female,
\Sexpr{sum(cats$Sex==M)} male).

Thanks
Mike White




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