Re: [R] Character position command

2007-08-25 Thread Prof Brian Ripley
On Sat, 25 Aug 2007, Mitchell Hoffman wrote:

> This is a very simple question, so I apologize I couldn't find it online:
>
> I want to shorten the string 'apples.pears' to 'apples'.
>
> string='apples.pears'
> string1=substr(string,0,x)
>
> For x above, I would like to have a command like charAt(string,"."), i.e.
> the position of the period in the word, but I can't seem to find a charAt
> command in R.

See ?regexpr

But a simpler solution is sub("\\..*", "", string).


-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch 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] How can I interpret this test hypothesis test

2007-08-25 Thread Lord Tyranus
Hello wizards,
First of all, I'm a physicist and therefore I'm not much used to use
statistics. So, please forgive me if this is a FAQ or stupid, but I
failed to find the answer by myself.

I have used "runs.test" (Package tseries)  for computes the runs test
for randomness , but I get this result:

Runs test
-1.8732   P-value = 0.0610

Alternative Hypothesis : Two sided

How can I interpret this result ?
Generally, one rejects the null hypothesis if the p-value is smaller
than or equal to the significance level,but I have examined the
documentation but I don't find the significance level.

Thanks in advance.

-- 
Web Page
http://geocities.com/lord_tyranus_96/

__
R-help@stat.math.ethz.ch 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] Character position command

2007-08-25 Thread Gabor Grothendieck
See ?regexpr to get the position; however, using sub we could remove
the dot and everything after it in one go.  See ?regexp and ?sub .
Also there are some links to info on regular expressions in the Links
box on this page:
http://gsubfn.googlecode.com

> n <- regexpr(".", "apples.pears", fixed = TRUE)
> substr("apples.pear", 1, n-1)
[1] "apples"


> sub("[.].*", "", "apples.pears")
[1] "apples"


On 8/25/07, Mitchell Hoffman <[EMAIL PROTECTED]> wrote:
> This is a very simple question, so I apologize I couldn't find it online:
>
> I want to shorten the string 'apples.pears' to 'apples'.
>
> string='apples.pears'
> string1=substr(string,0,x)
>
> For x above, I would like to have a command like charAt(string,"."), i.e.
> the position of the period in the word, but I can't seem to find a charAt
> command in R.
>
> Thank you.
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] Character position command

2007-08-25 Thread Mitchell Hoffman
This is a very simple question, so I apologize I couldn't find it online:

I want to shorten the string 'apples.pears' to 'apples'.

string='apples.pears'
string1=substr(string,0,x)

For x above, I would like to have a command like charAt(string,"."), i.e.
the position of the period in the word, but I can't seem to find a charAt
command in R.

Thank you.

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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] Variable Importance - Random Forest

2007-08-25 Thread Henric Nilsson (Public)
Den 2007-08-24 21:13, Mathe, Ewy (NIH/NCI) [F] skrev:
> Hello,
> 
>  
> 
> I am trying to explore the use of random forests for classification and
> am certain about the interpretation of the importance measurements.

In case you haven't already done so, you probably want to read

@ARTICLE{Strobl+Boulesteix+Zeileis+Hothorn:2007,
   author = {Carolin Strobl and Anne-Laure Boulesteix and Achim Zeileis 
   and Torsten Hothorn},
   title = {Bias in Random Forest Variable Importance Measures: 
Illustrations,
   Sources and a Solution},
   journal = {{BMC} Bioinformatics},
   year = {2007},
   volume = {8},
   number = {25},
   url = {http://www.biomedcentral.com/1471-2105/8/25/}
}


HTH,
Henric



> 
>  
> 
> When having the option "importance = T" in the randomForest call, the
> resulting 'importance' element matrix has four columns with the
> following headings:
> 
> 0 - mean raw importance score of variable x for class 0 (where
> importance is the difference between the permutated data error and the
> original test set error)
> 
> 1 - mean raw importance score of variable x for class 1
> 
> MeanDecreaseAccuracy : average lowering of the margin across all cases
> (where margin is the proportion of votes for the true class - the
> maximum proportion of votes for the other classes)
> 
> MeanDecreaseGini : summation of the gini decreases over all trees in the
> forest
> 
>  
> 
> Are these definitions correct?  Why is the raw importance score
> calculated for each class?  Could one just average the raw importance
> scores for class 0 and 1 to get a composite importance score?
> 
>  
> 
> Now, when having the option "importance = F" in the randomForest call,
> the 'importance' element is now a vector.  What values are those?
> 
>  
> 
> Thank you in advance for any input you may have.
> 
>  
> 
> Best,
> 
> Ewy
> 
>  
> 
>  
> 
>  
> 
>  
> 
> Ewy Mathe, Ph. D.
> 
> Laboratory of Human Carcinogenesis
> 
> National Cancer Institute, NIH
> 
> 37 Convent Drive
> 
> Building 37, Room 3068
> 
> Bethesda, MD  20892-4255
> 
> Tel: 301-496-5835
> 
> Fax: 301-496-0497
> 
>  
> 
> 
>   [[alternative HTML version deleted]]
> 
> __
> R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] perception of graphical data

2007-08-25 Thread Henric Nilsson (Public)
Den 2007-08-25 00:42, hadley wickham skrev:
> Hi Richard,
> 
>> I apologize that this is off-topic.  I am seeking information on
>> perception of graphical data, in an effort to improve the plots I
>> produce.  Would anyone point me to literature reviews in this area?  (Or
>> keywords to try on google?)  Is this located somewhere near cognitive
>> science, psychology, human factors research?
> 
> Probably the best place to start on these general issues, are a couple
> of papers by Cleveland:
> 
> @article{cleveland:1987,
> Author = {Cleveland, William and McGill, Robert},
> Journal = {Journal of the Royal Statistical Society. Series A
> (General)},
> Number = {3},
> Pages = {192-229},
> Title = {Graphical Perception: The Visual Decoding of Quantitative
> Information on Graphical Displays of Data},
> Volume = {150},
> Year = {1987}}
> 
> @article{cleveland:1984,
> Author = {Cleveland, William S. and McGill, M. E.},
> Journal = {Journal of the American Statistical Association},
> Number = 387,
> Pages = {531-554},
> Title = {Graphical Perception: Theory, Experimentation and
> Application to the Development of Graphical Methods.},
> Volume = 79,
> Year = 1984}
> 
> For colour in particular, I like Ross Ihaka's introduction to the subject:
> 
> 
> @inproceedings{ihaka:2003,
> Author = {Ihaka, Ross},
> Booktitle = {Proceedings of the 3rd International Workshop on
> Distributed Statistical Computing (DSC 2003)},
> Title = {Colour for Presentation Graphics},
> Year = {2003}}
> 
> 
> and also see colorbrewer.org

In addition, I've found the following one really useful

@TECHREPORT{Zeileis+Hornik:2006,
   author = {Achim Zeileis and Kurt Hornik},
   title = {Choosing Color Palettes for Statistical Graphics},
   institution = {Department of Statistics and Mathematics,
  Wirtschaftsuniversit\"at Wien,
 Research Report Series},
   year = {2006},
   type = {Report},
   number = {41},
   month = {October},
   url = 
{http://epub.wu-wien.ac.at/dyn/openURL?id=oai:epub.wu-wien.ac.at:epub-wu-01_abd}
}


HTH,
Henric



> 
>> Scatter plots of microarray data often attempt to represent thousands or
>> tens of thousands of points, but all I read from them are density and
>> distribution --- the gene names cannot be shown.  At what point, would a
>> sunflowerplot-like display or a smooth gradient be better?  When two
>> data points drawn as 50% gray disks are small and tangent, are they
>> perceptually equivalent to a single, 100% black disk?  Or a 50% gray
>> disk with twice the area?  What problems are known about plotting with
>> disks --- do viewers use the area or the diameter (or neither) to gauge
>> weight?
> 
> I think many of these are still research topics.  Two (of many) places
> to start are:
> 
> 
> @article{huang:1997,
> Author = {Huang, Chisheng and McDonald, John Alan and Stuetzle, 
> Werner},
> Journal = {Journal of Computational and Graphical Statistics},
> Pages = {383--396},
> Title = {Variable resolution bivariate plots},
> Volume = {6},
> Year = {1997}}
> 
> @article{carr:1987,
> Author = {Carr, D. B. and Littlefield, R. J. and Nicholson, W. L. and
> Littlefield, J. S.},
> Journal = {Journal of the American Statistical Association},
> Number = {398},
> Pages = {424-436},
> Title = {Scatterplot Matrix Techniques for Large N},
> Volume = {82},
> Year = {1987}}
> 
> 
> 
>> As you can tell, I'm a non-expert, mixing issues of data interpretation,
>> visual perception, graphic representation.  Previously, I didn't have
>> the flexibility of R's graphics, so I didn't need to think so much.
>> I've read some of Edward S. Tufte's books, but found them more
>> qualitative than quantitative.
> 
> More quantitative approaches are Cleveland's, Bertin's and Wilkinson's:
> 
> 
> @book{cleveland:1993,
> Author = {Cleveland, William},
> Publisher = {Hobart Press},
> Title = {Visualizing data},
> Year = {1993}}
> 
> @book{cleveland:1994,
> Author = {Cleveland, William},
> Publisher = {Hobart Press},
> Title = {The Elements of Graphing Data},
> Year = {1994}}
> 
> @book{chambers:1983,
> Author = {Chambers, John and Cleveland, William and Kleiner, Beat and
> Tukey, Paul},
> Publisher = {Wadsworth},
> Title = {Graphical methods for data analysis},
> Year = {1983}}
> 
> 
> @book{bertin:1983,
> Address = {Madison, WI},
> Author = {Bertin, Jacques},
> Publisher = {University of Wisconsin Press},
> Title = {Semiology of Graphics},
> Year = {1983}}
> 
> 
> @book{wilkinson:2006,
> Author = {Wilkinson, Leland},
> Publisher = {Springer},
> Series = {Statistics and Computing},
> Title = {The Gramm

Re: [R] How to shade vertical bands in a graph?

2007-08-25 Thread del pes

Thank you all for your answers, the rect function with seq (to do regular 
rectangles) worked perfectly

fakedat<-0.985+rnorm(80)/100
plot(fakedat,main="My Striped Plot",type="n")
rect(seq(5,75,by=10),par("usr")[3],seq(10,80,by=10),par("usr")[4],
col="yellow")
points(fakedat,type="b")
abline(h=0.98)

Very nice presentation coming out in no time, R is the best!

Delfina





> Date: Fri, 24 Aug 2007 20:26:53 +1000
> From: [EMAIL PROTECTED]
> To: [EMAIL PROTECTED]
> CC: r-help@stat.math.ethz.ch
> Subject: Re: [R] How to shade vertical bands in a graph?
> 
> del pes wrote:
> > Hello,
> > 
> > I would like to draw vertical yellow bands in my graph, but could not find 
> > how to do that in the documentation.
> > 
> > I set up a page to show what I would like to achieve: 
> > http://rstudent.blogg.de/eintrag.php?id=1 (the first picture was manually 
> > colored with the Gimp).
> > 
> Hi Delfina,
> For a one-off, I would use the rect function.
> 
> fakedat<-0.985+rnorm(80)/100
> plot(fakedat,main="My Striped Plot",type="n")
> rect(seq(5,75,by=10),par("usr")[3],seq(10,80,by=10),par("usr")[4],
>   col="yellow")
> points(fakedat,type="b")
> abline(h=0.98)
> 
> Jim

_
[[replacing trailing spam]]

__
R-help@stat.math.ethz.ch 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] fill circles

2007-08-25 Thread jim holtman
Here is a function that will generate a color sequence for an input
vector,  You can specify the colors to use, the range and the number
of color steps:

# specify the colors and the number of increments you want for a specified
# range.  It will return the colors for the input vector
# specify the colors and the number of increments you want for a specified
# range.  It will return the colors for the input vector
f.color <-
function(input, # input vector
 colors=c('green','yellow','red'),  # desired colors
 input.range=c(0,0.01),  # range of input to create colors
 input.steps=10)  # number of increments
{
myColors <- colorRampPalette(colors)(input.steps)  # generate colors
myColors[cut(input, seq(input.range[1], input.range[2],
length=input.steps+1),
labels=FALSE, include.lowest=TRUE)]
}
# generate a legend to show colors
plot.new()  # create blank plot
x <- round(runif(15), 3)
legend('topleft', legend=x, fill=f.color(x, input.range=c(0,1)))
legend('topright', legend=x, fill=f.color(x, input.range=c(0,1),
colors=c('purple','red','blue','orange')))
legend('top', legend=x, fill=f.color(x, input.range=c(0,1),
colors=c('red','yellow','green')))

So you should be able to use something like this.

On 8/25/07, Cristian cristian <[EMAIL PROTECTED]> wrote:
> Hi all,
> I'm an R newbie,
> I did this script to create a scatterplot using the "tree" matrix from
> "datasets" package:
>
> library('datasets')
> with(trees,
> {
> plot(Height, Volume, pch=3, xlab="Height", ylab="Volume")
> symbols(Height, Volume, circles=Girth/12, fg="grey", inches=FALSE,
> add=FALSE)
> }
> )
>
> I'd like to use the column Named "Height" to fill the circles with colors
> (ex.: the small numbers in green then yellow and the high numbers in red).
> I'd like to have a legend for the size and the colors too.
> I did it manually using a script like that:
> color[(x>=0.001)&(x<0.002)]<-"#41FF41"
> color[(x>=0.002)&(x<0.003)]<-"#2BFF2B"
> color[(x>=0.003)&(x<0.004)]<-"#09FF09"
> color[(x>=0.004)&(x<0.005)]<-"#00FE00"
> color[(x>=0.005)&(x<0.006)]<-"#00F700"
> color[(x>=0.006)&(x<0.007)]<-"#00E400"
> color[(x>=0.007)&(x<0.008)]<-"#00D600"
> color[(x>=0.008)&(x<0.009)]<-"#00C300" and so on but I don't like to do it
> manually... do know a solution...
> Thank you very much
> chris
>
>[[alternative HTML version deleted]]
>
> __
> R-help@stat.math.ethz.ch 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.
>


-- 
Jim Holtman
Cincinnati, OH
+1 513 646 9390

What is the problem you are trying to solve?

__
R-help@stat.math.ethz.ch 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] fill circles

2007-08-25 Thread Cristian cristian
Hi all,
I'm an R newbie,
I did this script to create a scatterplot using the "tree" matrix from
"datasets" package:

library('datasets')
with(trees,
{
plot(Height, Volume, pch=3, xlab="Height", ylab="Volume")
symbols(Height, Volume, circles=Girth/12, fg="grey", inches=FALSE,
add=FALSE)
}
)

I'd like to use the column Named "Height" to fill the circles with colors
(ex.: the small numbers in green then yellow and the high numbers in red).
I'd like to have a legend for the size and the colors too.
I did it manually using a script like that:
color[(x>=0.001)&(x<0.002)]<-"#41FF41"
color[(x>=0.002)&(x<0.003)]<-"#2BFF2B"
color[(x>=0.003)&(x<0.004)]<-"#09FF09"
color[(x>=0.004)&(x<0.005)]<-"#00FE00"
color[(x>=0.005)&(x<0.006)]<-"#00F700"
color[(x>=0.006)&(x<0.007)]<-"#00E400"
color[(x>=0.007)&(x<0.008)]<-"#00D600"
color[(x>=0.008)&(x<0.009)]<-"#00C300" and so on but I don't like to do it
manually... do know a solution...
Thank you very much
chris

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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 compute a probability distribution?

2007-08-25 Thread Antonio, Fabio Di Narzo
prob <- function(x,ranks,dereg)
 mean(dereg %in% ranks[seq_len(x)])

2007/8/25, Naxerova, Kamila <[EMAIL PROTECTED]>:
> Hello!
>
> I have a piece of slow code and I am wondering if I am missing some obvious 
> way
> to make it faster -- or if there is some predefined function I should be using
> instead.
>
> I have a list (ranks), for which I would like to compute the probability of a
> bunch of values (dereg) being contained in ranks[1:i]
>
> prob=function(x,ranks,dereg){
>
> revranks=ranks[1:x]
> p=length(which(dereg %in% revranks))/length(dereg)
> return(p)
> }
>
> probdist=lapply(c(2:5166),prob,ranks=r,dereg=list)
>
> Takes a long time... too long to do a meaningful number of permutations.
>
> Thanks!!!
> --Kamila
>
>
> The information transmitted in this electronic communication...{{dropped}}
>
> __
> R-help@stat.math.ethz.ch 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.
>


-- 
Antonio, Fabio Di Narzo
Ph.D. student at
Department of Statistical Sciences
University of Bologna, Italy

__
R-help@stat.math.ethz.ch 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] efficient way to compute a probability distribution?

2007-08-25 Thread Naxerova, Kamila
Hello!

I have a piece of slow code and I am wondering if I am missing some obvious way
to make it faster -- or if there is some predefined function I should be using
instead.

I have a list (ranks), for which I would like to compute the probability of a
bunch of values (dereg) being contained in ranks[1:i]

prob=function(x,ranks,dereg){

revranks=ranks[1:x]
p=length(which(dereg %in% revranks))/length(dereg)
return(p)
}

probdist=lapply(c(2:5166),prob,ranks=r,dereg=list)

Takes a long time... too long to do a meaningful number of permutations.

Thanks!!!
--Kamila


The information transmitted in this electronic communication...{{dropped}}

__
R-help@stat.math.ethz.ch 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 provide argument when opening RGui from an external application

2007-08-25 Thread Prof Brian Ripley
Look into Rscript.exe (on Windows), which is a flexible way to run 
scripts.  Neither using a GUI nor using source() are recommended.


On Fri, 24 Aug 2007, Sébastien wrote:


Dear R-users,

I have written a small application (in visual basic) that automatically
generate some R scripts. I would like to execute these scripts when my
application is being closed.
My problem is that I don't know how to pass the
'source(c:/.../myscript.r)' instruction when I programmatically start
RGui. Tinn-R is capable of doing such things, so I guess there must be a
way to pass arguments to RGui.

Any advice or link to relevant references would be greatly appreciated.

Sebastien


--
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595__
R-help@stat.math.ethz.ch 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] How to provide argument when opening RGui from an external application

2007-08-25 Thread Sébastien
Dear R-users,

I have written a small application (in visual basic) that automatically 
generate some R scripts. I would like to execute these scripts when my 
application is being closed.
My problem is that I don't know how to pass the 
'source(c:/.../myscript.r)' instruction when I programmatically start 
RGui. Tinn-R is capable of doing such things, so I guess there must be a 
way to pass arguments to RGui.

Any advice or link to relevant references would be greatly appreciated.

Sebastien

__
R-help@stat.math.ethz.ch 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] Extracting a range of elements from a vector

2007-08-25 Thread Gabor Grothendieck
See ?embed

On 8/25/07, Otis Laws <[EMAIL PROTECTED]> wrote:
> Dear R users
>
> I am R newbie creating a function that implements the poker test to test
> pseudo random bit generators.
> Iam reading the bits from a text file (1 bit per line),  which causes
> each bit to be stored in an element of a numeric vector.
>
> What Iam trying to do is to extract a "block" of bits of arbitray size
> from the original vector into a smaller numeric vector and then count
> this binary number
>  (and keep repeating this until the end of the vector, so that I get a
> vector containing the number of times each binary number has occured) e.g.
>
> original vector:
> "0", "1","1","0","0","1","0","1","1"
>
> using a block size of 3 bits the first smaller vector becomes:
> "0", "1", "1"
>
> At the momemt I do this by iterating through the original vector and set
> the ith element of the smaller vector.
> I have looked at using the subset() function but it seems to operate on
> a vector's content rather than index.
>
> This causes the following two main questions:
> 1. Is there a way to specify a range of vector elements?
> 2. Is this the most efficient method, since this could be extremly time
> consuming when used to test millions of bits?
>
>
> Thanks very much in advance
>
> Otis Laws
>
> __
> R-help@stat.math.ethz.ch 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-help@stat.math.ethz.ch 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] Extracting a range of elements from a vector

2007-08-25 Thread Otis Laws
Dear R users

I am R newbie creating a function that implements the poker test to test 
pseudo random bit generators.
Iam reading the bits from a text file (1 bit per line),  which causes 
each bit to be stored in an element of a numeric vector.

What Iam trying to do is to extract a "block" of bits of arbitray size 
from the original vector into a smaller numeric vector and then count 
this binary number
 (and keep repeating this until the end of the vector, so that I get a 
vector containing the number of times each binary number has occured) e.g.

original vector:
"0", "1","1","0","0","1","0","1","1"

using a block size of 3 bits the first smaller vector becomes:
"0", "1", "1"

At the momemt I do this by iterating through the original vector and set 
the ith element of the smaller vector.
I have looked at using the subset() function but it seems to operate on 
a vector's content rather than index.

This causes the following two main questions:
1. Is there a way to specify a range of vector elements? 
2. Is this the most efficient method, since this could be extremly time 
consuming when used to test millions of bits?


Thanks very much in advance

Otis Laws

__
R-help@stat.math.ethz.ch 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 can i inhibit this work "Please select a CRAN mirror for use in this session "?

2007-08-25 Thread Prof Brian Ripley
On Sat, 25 Aug 2007, zhijie zhang wrote:

> Dear Rusers,
>  When i start R, there always the following work to do first, how should i
> cancel it?
> *--- Please select a CRAN mirror for use in this session ---*
>  I don't know why it does so, maybe i have done something unintentionally.

You certainly have.  Try starting R with --vanilla and it should go away.
If so, see ?Startup and look at the various files it mentions.  Do you 
have a .Rprofile?  Have you changed Rprofile.site ... ?

The message comes from contrib.url(): most likely you have a call to 
update.packages() in a startup file.

-- 
Brian D. Ripley,  [EMAIL PROTECTED]
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford, Tel:  +44 1865 272861 (self)
1 South Parks Road, +44 1865 272866 (PA)
Oxford OX1 3TG, UKFax:  +44 1865 272595

__
R-help@stat.math.ethz.ch 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] How can i inhibit this work "Please select a CRAN mirror for use in this session "?

2007-08-25 Thread zhijie zhang
Dear Rusers,
  When i start R, there always the following work to do first, how should i
cancel it?
*--- Please select a CRAN mirror for use in this session ---*
  I don't know why it does so, maybe i have done something unintentionally.
  Thanks.

-- 
With Kind Regards,

oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:
[***]
Zhi Jie,Zhang ,PHD
Tel:86-21-54237149
Dept. of Epidemiology,School of Public Health,Fudan University
Address:No. 138 Yi Xue Yuan Road,Shanghai,China
Postcode:200032
Email:[EMAIL PROTECTED]
Website: www.statABC.com
[***]
oooO:
(..):
:\.(:::Oooo::
::\_)::(..)::
:::)./:::
::(_/
:

[[alternative HTML version deleted]]

__
R-help@stat.math.ethz.ch 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.