Not neccessary to do this as you can specify which column in the two
datases to use as common using the arguments by.x and by.y in merge().
Morassa Mohseni wrote:
> Thanks!
> Ill give this a try. I forgot to mention that the SNP.ID is not named the
> same in both files, even though they contain
First, note that functions in R match named arguments first, followed by
the position of the arguments in the call.
Second, have a look at how mean and max are defined
mean <- function (x, trim = 0, na.rm = FALSE, ...){
max <- function (..., na.rm = FALSE){
It's the difference in the p
You probably got some missing or undefined values.
Either eyeball the data or use sum(is.na(x)), sum(is.nan(x)),
sum(is.infinite(x)) to find out if you have such data. You may want to
use which() to find out where they are.
Regards, Adai
Bricklemyer, Ross S wrote:
> I am attempting to run pri
The name of the table should give you the "value". And if you have a
matrix, you just need to convert it into a vector first.
> m <- matrix( LETTERS[ c(1:3, 3:5, 2:4) ], nc=3 )
> m
[,1] [,2] [,3]
[1,] "A" "C" "B"
[2,] "B" "D" "C"
[3,] "C" "E" "D"
> tb <- table( as.vector(m) )
> tb
You can achieve this by cbind.data.frame()
Christophe Pallier wrote:
> Beware: you are not working with data.frames but with a vector and a
> matrice.
> (see ?cbind)
>
> Solution: convert 'res' to data.frame.
>
> Christophe
>
> On 7/14/07, Zhang Jian <[EMAIL PROTECTED]> wrote:
>> If I do not ad
Try
sapply( Lst, function(m) m[1,1] )
Also note that to subset a list, you just need Lst[ 1:10 ] and not
Lst[[ 1:10 ]] (note the double square brackets).
Regards, Adai
Forest Floor wrote:
> Hi,
>
> I would love an easy way to extract elements from a list.
>
> For example, if I want the f
Sorry, this sounds like a fairly basic question that can be resolved by
which() and possible ifelse(). There is no details in your email.
I am afraid you have to learn the basics of R or ask question with more
details (e.g. example data).
Or ask someone locally.
Regards, Adai
Johannes Graum
See help(legend) and help(identify).
Ajay Singh wrote:
> Hi,
>
> I have two problems in R.
>
> 1. I need 10 cdfs on a graph, the graph needs to have legend. Can you let
> me know how to get legend on the graph?
>
> 2. In ecdf plot, I need to know the x and y co-ordinates. I have to get
> corr
How about
revLag <- function(x, shift=1) rev( Lag(rev(x), shift) )
x <- 1:5
revLag(x, shift=2)
As a matter of fact, here is a generalized version of Lag to include
negative shifts.
myLag <- function (x, shift = 1){
xLen <- length(x)
ret <- as.vector(character(xLen), mode = st
This is the R-help mailing list. See help(BATCH).
You will need to write the required R commands in a separate script, say
script.R and then execute it as
R --no-save < script.R > logfile
You may need to augment the code above to include directory paths etc.
There are other useful documentat
m <- matrix( rnorm(300), nc=3 )
pairs(m, pch=20)
or pairs(m, pch=".")
See help(par) for more details.
livia wrote:
> Hi, I would like to use the function pairs() to plot a matrix of
> scatterplots. For each scatterplot, the data are plotted in circles, can I
> add some argument to change the ci
I don't fully understand what your objective here, but I would try a
combination of cut and grep in a shell to see if it works. For example,
if your data was saved as a tab-delimited file and you have some
predefined patterns you seek, then try the untested code below
cut -f3-6 | gsub 's/ //g
Lets assume your zcta data looks like this
set.seed(12345) ## temporary for reproducibility
zcta <- data.frame( zipcode=LETTERS[1:5], prop=runif(5) )
zcta
zipcode prop
1 A 0.7209039
2 B 0.8757732
3 C 0.7609823
4 D 0.8861246
5 E 0.4564810
This say
See help(dim) and please read the manuals before asking basic questions
like this. Thank you.
elyakhlifi mustapha wrote:
> hello,
> are there functions giving the columns number and the rows number of a matrix?
> thanks.
>
>
>
> __
You need to basically use table on factors with fixed pre-specified
levels. For example:
x <- c(runif(100,10,40), runif(100,43,55))
y <- c(runif(100,7,35), runif(100,37,50))
z <- c(runif(100,10,42), runif(100,45,52))
xx <- ceiling(x); yy <- ceiling(y); zz <- ceiling(z)
mylevels <-
I cannot find the venn package (searched the author's page and googled)
despite some posts referring to it, so I cannot help you. But I can
suggest you check out the varpart in vegan package, vennDiagram in limma
package or http://finzi.psych.upenn.edu/R/Rhelp02a/archive/14637.html
Regards, Ada
Perhaps the use of as.character() like following might help?
data.whole$Analyte.Values <- data.whole$as.character(analyte)
Junnila, Jouni wrote:
> Hello all,
>
> I'm having a problem concerning choosing columns from a dataset in a
> function.
>
> I'm writing a function for data input etc., w
I am not sure if R can read formulas and if it does, it probably as
characters. I would suggest you Copy and Paste Special (as values) onto
a new sheet and save it a tab delimited files.
elyakhlifi mustapha wrote:
> good morning,
> I have some SAS code to translate in R code and when I export d
Assuming the R packages have been downloaded locally and end with
tar.gz, then how about simply changing to where the files are located
and typing the following command?
ls *.tar.gz | while read x; do echo "R CMD INSTALL $x"; done | bash
Alternatively, you can use the install.packages() func
You want to select two subplots for each DL value. Try:
df <- data.frame( DL=gl(3,4), subplot=rep(1:4,3) )
df$index <- 1:nrow(df)
ind <- tapply( df$index, df$DL, function(x) sample(x,2) )
df[ unlist(ind), ]
You could also have used rownames(df) instead of creating df$index.
OR
tmp <
merge()
javier garcia-pintado wrote:
> Hi all,
> Let's say I have a long data frame and a short one, both with three
> colums: $east, $north, $value
> And I need to fill in the short$value, extracting the corresponding
> value from long$value, for coinciding $east and $north in both tables.
> I k
I presume you want to generate normally or t-distributed values ? If so
either have a look mvrnorm in the MASS package or the mvtnorm package.
Dimitri Liakhovitski wrote:
> Hi!
> I was wondering if there is a package in R that allows one to create a
> multivariate data set with pre-specified in
Can you provide an simple example of what you want the function to do?
Generally, I set some value in the default.
raise <- function(x, power=1){ return( x^power ) }
> raise(5)
[1] 5
> raise(5,3)
[1] 125
Or you can do the same but in a slightly unclear manner.
raise <- function(x, power){
Try bkde2D {KernSmooth} or kde2d {MASS}.
Bruce Willy wrote:
> Hello,
>
> I have a n*2 matrix, called "plan", which contains n observations from 2
> variates.
>
> I want a kernel density estimate of the joint distribution of these 2
> variates.
> I try : density(plan). Unfortunately, R think
According to your post you are assuming that there are only 3 unique
values for var3 within each category. But category C and D have 4 unique
values for var3.
split(dfr, dfr$categ)
...
$C
id categ var3 score
3 3 C6 high
7 7 C5 mid
11 11 C
Can you check if the following gives you what you want?
tmp <- rbind( A, B )
dis <- dist( tmp )
nA <- nrow(A)
nB <- nrow(B)
dis[ 1:nA, nA + 1:nB ] ## output
If it works, this suggestion comes with the caveat that it might be
computationally inefficient compared with using f
Don't need to upgrade R just to get index() working. You can try the
following modification.
v <- sample(1:3, 30, replace = TRUE)
split( 1:length(v), v )
Should do the trick. Check out the reverse function unsplit().
Regards, Adai
Leeds, Mark (IED) wrote:
> index is definitely defined in
trig
0.06624167 0.19490517 0.27300965 0.21950332 0.27768153 0.40658964
Regards, Adai
Inman, Brant A. M.D. wrote:
> Adai,
>
> Thanks for the functions. I tried using your functions and I get the
> same error message during the pooling part:
>
>> pool(micefit)
> E
See my response to your thread " controling the size of vectors in a
matrix". Please do not create multiple threads on the same day asking
basically the same question, especially if you cannot substantially
improve the clarity and quality of the post.
Multiple threads asking the same question b
1) Your colnames need 4 elements and not 3
2) Utilize the argument 'n' in your random number generators
Your codes could be simplified as:
m <- cbind( treatmentgrp = sample( 1:2, n, replace=T ),
strata= sample( 1:2, n, replace=T ),
survivalTime = rexp( n, r
I encountered this problem about 18 months ago. I contacted Prof. Fox
and Dr. Malewski (the R package maintainers for mice) but they referred
me to Prof. van Buuren. I wrote to Prof. van Buuren but am unable to
find his reply (if he did reply).
Here are the functions I used at that time, if you
R understands only numerical and Date class values for axis. So either
a) plot them using the sequence 1, ..., 32 and then explicitly label
them. Here is an example:
n <- length(year.month)
plot( 1:n, freq, xaxt="n")
mtext( text=year.month, side=1, at=1:n, las=2 )
b) or create the dates
http://en.wikipedia.org/wiki/Weighted_least_squares gives a formulaic
description of what you have said.
I believe the original poster has converted something like this
y x
0 1.1
0 2.2
0 2.2
0 2.2
1 3.3
Your data points appear to
arise from discrete distribution, so I am not entirely sure if you can
use the linear model which assumes the errors are normally distributed.
Regards, Adai
hadley wickham wrote:
> On 5/8/07, Adaikalavan Ramasamy <[EMAIL PROTECTED]> wrote:
>> See below.
&
See below.
hadley wickham wrote:
> Dear all,
>
> I'm struggling with weighted least squares, where something that I had
> assumed to be true appears not to be the case. Take the following
> data set as an example:
>
> df <- data.frame(x = runif(100, 0, 100))
> df$y <- df$x + 1 + rnorm(100, sd=1
Here is the contents of my "testdata.txt" :
-
START OF HEIGHT DATA
S= 0y=0.0 x=0.
S= 0 y=0.1 x=0.00055643
S= 9 y=4.9 x=1.67278117
S= 9 y=5.0 x=1.74873257
S=10 y=0.0 x=0.
S=10y=0.1 x=0.00075557
S=9
On a related note, one might be interested in checking out citizendium
which is spin off wikipedia but 1) has more stringent identity
verification and 2) uses a two-tier system of editors and authors. See
http://www.citizendium.org/cfa.html.
Deepayan Sarkar wrote:
> On 3/30/07, Sarah Goslee <
Sounds like you have two different tables and are trying to mine one
based on the other. Try
ref <- data.frame( levels = 1:25,
ratings = rep(letters[1:5], times=5) )
db <- data.frame( vals=101:175, levels=c(1:25, 1:25, 1:25) )
levels.of.interest <- ref$levels[ ref$rating=="
I think sometime ago someone suggested that we append a
comments/discussion/wiki section to the end of every R functions' help
page that is editable by everyday users.
In other words, every R function help page has a fixed component that
has met R-core's approval and a clearly marked and more f
Please try to give a simple reproducible example and simplify your codes
a bit if you want to get useful responses.
For example, you say your data is a matrix of 1000*30, where I presume
the matrix has 1000 rows and 30 columns. If so EMP <- data[,378:392]
does not make sense.
Perhaps you might
Something ugly like this?
Lst <- list()
Lst[[1]] <- list(name="Fred", wife="Mary", no.children=3,
child.ages=c(4,7,9))
Lst[[2]] <- list(name="Barney", wife="Liz", no.children=2,
child.ages=c(3,5))
cbind( do.call("rbind", as.list(Lst))[ ,-4],
child.ages=sapply( Lst, function(myli)
sessionInfo()
[EMAIL PROTECTED] wrote:
> Hi All
>
> what is the command to give me the listing of the loaded packages. I mean
> which are active and not the listing of all the installed packages as
> given by library()
>
> thanks in advance
> -gaurav
>
>
> ==
Try changing
outliers <- subset(pre.outliers, gtvalue4FWHM >= 0.00)
to
w <- which( gtvalue4FWHM >= 0.00 )
outliers( length(w) > 0, pre.outliers[ w, ], NA )
Other comments:
1. Make sure you detach(data_gcs) at the end of the loops
2. scale() works on columns by default, so try
e "mydata.RData" in my package and I want it to be updated
> every time i build the package.
>
> I appreciate your help anyway.
>
>
> -Johan
>
> - Original Message
> From: Adaikalavan Ramasamy <[EMAIL PROTECTED]>
> To: johan Faux <[EM
Yes, one way is to use commandArgs in the R script. So say your R script
is as follows
n <- as.character(commandArgs()[3])
fn <- as.character(commandArgs()[4])
mat <- matrix( rnorm( n*n ), nc=n )
write.table( mat, filenames=fn, sep="\t", quote=FALSE )
Then you execute the commands
Here is yet another solution. This one uses by() which generates nice
visual output.
score <- data.frame(
id = c('001','001','001','002','003','003'),
math= c(80,75,70,65,65,70),
reading = c(65,70,88,NA,90,NA)
)
out <- by( score, score$id, tail, n=2 )
# score$id: 001
#id math
Do you mean write.table instead of Write() ? Try
fn <- paste("Data_", i, ".txt", sep="")
write.table( t(x), file=fn, sep="\t" )
Regards, Adai
On Mon, 2006-07-24 at 11:06 +0200, Robert Mcfadden wrote:
> Dear R Users,
> Is it possible to make file names dependent on a changing variable?
> For
I do not fully understand your question but how about :
inplace <- function( df, cond1, cond2, cols, suffix ){
w <- which( cond1 & cond2 )
df <- df[ w, cols ]
paste(df, suffix)
return(df)
}
BTW, did you mean "colnames(df) <- paste(colnames(df), suffix)" instead
of "paste(df, suffix)
?commandArgs
On Thu, 2006-06-15 at 16:05 -0700, Eric Hu wrote:
> Hi I have a R script that needs to run a few times for different
> systems. I use R --no-save < r.script for one system. I am trying with
> no luck to use R CMD BATCH to introduce an stdin input variable for
> the script. I wonder
If your df contains your data, try
tmp <- cbind( paste(df[ ,1], df[ ,2], sep=":"),
paste(df[ ,3], df[ ,4], sep=":") )
tmp <- t( apply(tmp, 1, sort) )
out <- data.frame( do.call(rbind, strsplit( tmp[,1], split=":" )),
do.call(rbind, strsplit( tmp[,2], split=
You have discontinuity between your MIN.VAL and MAX.VAL for a given
group. If this is true in practise, then you may want to check and
report when VAL is in the discontinuous region.
Here is my solution that ignores that (and only uses MIN.VAL and
completely disrespecting MAX.VAL). Not very elegan
What is your desired output ? This will clarify the problem greatly.
Perhaps, this might be of some use :
f <- function(v, pos, val=100){ v[pos] <- val; return(v) }
test <- 1:3
test <- f(test, 1)
test
[1] 100 2 3
Regards, ADai
On Wed, 2006-06-14 at 12:41 +0200, Sebastian Leuzinger w
I am coming late into the discussion, so apologies if the following
points are redundant.
1) IMHO, the most important feature that would make life a lot easier
for everyone is having search engines on the main webpage. I know you
can click on the "Search" on the left hand side pane but putting it
If you define a cost function for a given threshold k as
cost(k) = FP(k) + lambda * FN(k)
then choose k that minimises cost. FP and FN are false positives and
false negatives at threshold k.
You change lambda to a value greater than 1 if you want to penalise FN
more than FP. There are many s
Try
test.fn <- function(obj.name, var.name="q2"){
stopifnot( is.character(obj.name) & is.character(var.name) )
x <- subset( get(obj), select=var.name )
table(x)
}
On Fri, 2006-03-31 at 12:44 +0300, Adrian DUSA wrote:
> Hello all,
>
> I'd like to create a function which would do some a
I find it helpful to explain to my colleagues from non-mathematical
background that in classification the classes are predefined and in
clustering the classes (and sometimes the number of classes) are not.
I prefer the use of the term "class discovery" over clustering when
people try to cluster sa
Try
f <- function(x){
if(x <= 0) return(0)
if( 0 < x & x <= 1 ) return( 0.5*x^2 )
if( 1 < x & x <= 2 ) return( -0.5*x^2 + 2*x - 1 )
return(1)
}
xx <- seq(-1, 3, 0.1)
yy <- sapply(xx, f)
Regards, Adai
On Thu, 2006-03-30 at 09:25 -0200, Ken Knoblauch wrote:
> Yo
[[ Please ignore the last email which was sent incomplete ]]
Lets say there are 10 students in the first group and denote x1 as (say)
the number of red balls for student 1 and s1 the total balls. Then I was
calculating the average the proportion ( x1/s1 + x2/s2 + ... + x10/s10 )
and you were calcu
:
> Adaikalavan Ramasamy wrote:
> > Are you saying that your data might look like this ?
> >
> > set.seed(1) # For reproducibility only - remove this
> > mydf <- data.frame( age=round(runif(100, min=5, max=65), digits=1),
> > nred=rpois(100, lambda=
hist(data, plot=FALSE)$counts
On Mon, 2006-03-20 at 14:23 +0100, Gottfried Gruber wrote:
> hello,
>
> i need the data from hist() but i do not want the plot.
> e.g.
> z=hist(data)$counts #returns absolute frequency
>
> but when i execute this command the plot occurs also. is it possib
61
2 0.3280712 0.1730796 0.4988492
3 0.3061429 0.1748149 0.5190422
4 0.3759380 0.2084694 0.4155926
5 0.3548805 0.1587353 0.4863842
6 0.3106835 0.1829349 0.5063816
7 0.3525933 0.1599737 0.4874330
8 0.3133796 0.1795567 0.5070637
Hope this of some use.
Regards, Adai
On Sun, 2006-03-19 at 18:58 +00
Do you by any chance want to sample from each group equally to get an
equal representation matrix ? Here is an example of the input :
mydf <- data.frame( value=1:100, value2=rnorm(100),
grp=rep( LETTERS[1:4], c(35, 15, 30, 20) ) )
which has 35 observations from A, 15 from B,
You might find the 2nd part of the following response useful
https://stat.ethz.ch/pipermail/r-help/2006-March/090611.html
And if you want to RTFM, I guess sections 2.5, 2.7, 5.1, 5.2 of
http://cran.r-project.org/doc/manuals/R-intro.html might be useful.
PS:
1) R-help is designed for and by unp
My answers are going to be very similar but with minor cosmetic changes
that hopefully will make it bit more clearer.
1) How do you read in the data ? If you are using read.table (or
read.csv, read.delim, etc) you can set na.strings="-999" to take
advantage of the R's missing value features.
2)
Suppose you have 6 groups (A, B, C, D, E, F) and you measured the weight
of 5 individuals from each group. Therefore you have 30 weight
observations in total.
You wish to test if the mean of the response variable is different for
each of the groups.
[ i.e. the null hypothesis is that all 6 groups
A lot of programming style are personal choices and as such varies from
individual to individual. See my comments below.
On Fri, 2006-03-10 at 09:01 -0500, Kevin E. Thorpe wrote:
> Thanks Adai. A couple questions/comments about this.
>
> Adaikalavan Ramasamy wrote:
> > I use e
I use emacs and ESS to develop the scripts. The new releases of R has
the script function already in built.
Typically I keep all the data and scripts related to a project in its
own folder, so I have minimal worry about paths.
To save large and associated objects, I use
save(x, y, z, file="la
Another flexible approach is to zip/tar all the required individual .rda
files together. There are two advantages that I see :
1) You can extract a single file from the collection if you want.
2) You can easily list what objects are in the zipped/tarred file.
In R you have to load all object fr
I think it makes perfect sense for R to drop it since 'NA' represents
uninformative information. I do not know if there is a elegant solution
but I would suggest that you make these 'NA' into an informative value.
Here is one possibility:
df <- data.frame( AA=1:10, BB=rep(1:5,2), CC=rep(1:2,5),
split/unsplit/split<-, i.e. the z-scores
> by group line:
>
> z <- unsplit(lapply(split(x, g), scale), g)
>
> with "scale" suitably replaced. Presumably (meaning: I didn't quite
> read your code closely enough)
>
> z <- unsplit(lapply
A slight variation on your solution but hopefully more readable:
names( which( table(a) == 1 ) )
Regards, Adai
On Wed, 2006-02-22 at 09:11 +, Robin Hankin wrote:
> Hi.
>
> I have a factor and I want to extract just those elements that appear
> exactly once.
> How to do this?
>
I think the idea of defining dir1 and dir2 is a good one. If you want to
simplify life even further, you can put these into files that get
initialised when R starts. See help(Startup) for details.
Regards, Adai
On Wed, 2006-02-22 at 16:54 +1100, [EMAIL PROTECTED] wrote:
> Tom,
>
> You can defin
It might help to give a simple reproducible example in the future. For
example
df <- cbind.data.frame( date=rep( 1:5, each=100 ), A=rpois(500, 100),
B=rpois(500, 50), C=rpois(500, 30) )
might generate something like
date A B C
11 93 51 32
1) You need to use sep="," which is appropriate for a CSV file.
2) You need to specify the FULL path to the file. See
http://cran.r-project.org/bin/windows/base/rw-FAQ.html#R-can_0027t-find-my-file
3) You can use read.csv which is the read.table variant for CSV files.
For example
a <- read.
1) Please use a meaning subject line. Start a new thread instead of
replying to another thread.
2) Please give a simple example (if possible reproducible) to help
explain the problem.
3) Please read the posting guide.
On Tue, 2006-02-21 at 15:12 +0300, Evgeniy Kachalin wrote:
> Hello, dear R
1) It is not good practice to call your objects after existing R
functions (e.g. table)
2) I think you are getting rows and columns confused. If you want to
extract the rows/column of a matrix or dataframe, then try subsetting it
by mat["A1", ] or mat[ , "v4"]. See help(subset) for more informatio
This works :
# simulate some data
mylist <- list(NULL)
for(i in 1:27) mylist[[i]] <- rnorm( rpois( 1, lambda=20 ) )
# execute
par( mfrow=c(9,3) )
par(mar = c(1,1,1,1), oma = c(1,1,1,1))
for(i in 1:27) plot( mylist[[i]] )
Also if you just want to plot the distribution values etc, then you
Try
par( mfrow=c(9,3) )
for(i in 1:27) plot( lls[[i] )
but I think it might be a little crowded to put 9 rows in a page.
Also check out the lattice package which is bit more complicated to
learn but gives prettier output.
Regards, Adai
On Thu, 2006-02-09 at 11:52 -0800, Srinivas Iyyer wro
As much as I love LaTeX, I would be cautious on recommending it for
someone with a short term objective or does not really need to write
equations etc.
Part of the reason is the initial step of getting the different
softwares required to make LaTeX work properly can be difficult.
However, I think
I agree that this is the best way.
I often use Courier font with font size 10 that gives very good results.
On Thu, 2006-02-09 at 09:47 -0500, Gabor Grothendieck wrote:
> In Word use a fixed font such as Courier rather than a proportional
> font and it will look ok.
>
> On 2/9/06, Tom Backer J
With regards to the saving bit, you might want to try dput() or save()
as well.
On Thu, 2006-02-09 at 19:29 -0500, Jim Lemon wrote:
> Taka Matzmoto wrote:
> > Hi R users
> >
> > I like to create a ASCII type file using cat() and paste()
> >
> > x <- round(runif(30),3)
> > cat("vector =( ", paste
Sounds like you may need no use match().
On Wed, 2006-02-08 at 15:21 +0100, Bernhard Baumgartner wrote:
> I have a dataframe with a column, say "x" consisting of values, each
> value appearing different times, e.g.
> x: 1,1,1,1,2,2,4,4,4,9,10,10,10,10,10 ...
> and a vector, including e.g.:
> y: 2
No Excel attachment came through.
Just taking a guess here but there seems to be very little variation the
columns V10 till column V23.
BTW, can you not issue the following call :
mydata[ , 1:7] ~ mydata[ , 8] + mydata[ ,9]
instead of creating y1, y2, ... separately then cbind-ing them ?
Reg
Please read the posting
1) I think BioConductor mailing list might be better as some of these
could be implemented via LIMMA (I believe)
2) Provide sufficient information and perhaps a simple example.
Regards, Adai
On Wed, 2006-02-08 at 10:42 +0100, Mahdi Osman wrote:
> Hi list,
>
>
> I am f
How does the data look and how are you storing in R (e.g. matrix, list)?
I think this an issue related to Word where it is using either unequal
spaces or different carriage returns. I would not recommend storing
data, especially numerical ones in the form of a matrix, in Word files.
I would reco
I cleaned up your function a bit but please double check
generate.matrix <- function(nr, runs=5){
h <- nr/2## half of nr
nc <- nr/10 + 1
mat <- matrix(0, nr, nc) ## initialize
mat[ ,1] <- c( rep(1, h), rnorm(h) ) ## 1st
I do not fully understand what you mean by "stop". If you mean terminate
the whole function, then something like
sim <- function(nn, mustExist=100){
for (ii in 1:nn){
ee <- rep(rbinom(6000, 200, .5), ii)
if( any(ee!=mustExist) )
stop( paste("Iteration", ii, "did not
If you want a one-to-one action between corresponding pairs of "a" and
"b", then how about simply :
for( i in 1:length(a) ){
print( number[i] )
print( name[i] )
}
If you want the first element of "a" to work with all elements of "b",
the second element of "a" to work with all elements of "b
1) R-help mailing list is run entirely by volunteers, so requests such
as "urgent" may sound rude
2) Use an informative subject line please !
3) Please state which package multhist comes from.
4) Please show your call to multhist.
5) multhist does _histograms_ by aggregating points within certa
m1 <- cbind( n=c(1,2,3,4,6,7,8,9,10,13), v1=c(12,10,3,8,7,12,1,18,1,2),
v2=c(0,8,8,4,3,0,0,0,0,0) )
m2 <- cbind( n=c(1,2,3,4,5,6,8,10,11,12), v1=c(0,0,1,12,2,2,2,4,7,0),
v2=c(2,3,9,8,9,9,0,1,1,1) )
m.all <- merge(m1, m2, by="n", all=T)
n v1.x v2.x v1.y v2
Yes, it drives me mad too when people use "=" instead of "<-" for
assignment and suppress spaces in an naive attempt for saving space.
As an example compare
o=fn(x=1,y=10,z=1)
with
o <- fn( x=1, y=10, z=1 )
Regards, Adai
On Tue, 2005-12-06 at 13:43 +0100, Martin Ma
On Tue, 2005-12-06 at 13:43 +0100, Martin Maechler wrote:
> > "vincent" == vincent <[EMAIL PROTECTED]>
> > on Tue, 06 Dec 2005 11:09:36 +0100 writes:
>
> vincent> shanmuha boopathy a écrit :
> >> a<-function(a,b,c,d)
> >> {
> >> k=a+b
> >> l=c+d
> >> m=k+l
>
df <- data.frame( matrix( rnorm(1000), nc=10 ) )
colnames(df) <- c("y", paste("x", 1:9, sep=""))
ifit <- glm( y ~ ., data=df ) # initial fit
a <- stepAIC( ifit, keep=extractAIC )
a$keep
[,1] [,2] [,3] [,4] [,5] [,6] [,7]
[1,] 10.000 9. 8.0
Use as.matrix() :
m <- round( as.dist( cor( matrix( rnorm(600), nc=6 ) ) ), 2 )
m
1 2 3 4 5
2 -0.05
3 0.01 0.03
4 0.00 0.05 0.00
5 0.20 0.07 0.09 -0.07
6 0.03 0.02 0.11 -0.15 -0.11
as.matrix( m )
1 23 4 5 6
1 0.00 -0.05 0.01 0.00 0.
I do not quite follow your post but here are some suggestions.
1) You can the na.strings argument to simplify things
df <- read.delim(file="lala.txt", na.strings="-" )
2) If you can count the number of metastasis per row first, then find
the rows with zero sum.
met.cols <- c(11,1
And you want to have different colored lines but black texts, try
legend(x = 5, y = 0.2, legend = c("Data Set", "Fitted PDF"),
col = c("black", "red"), lty=1)
The advantage of this is that you can use dotted (lty option) or lines
with different weights (lwd option).
Regards, Adai
On
It would be more interesting to ask why does this does not work.
mylist <- list( value=5, plusplus = mylist$value + 1 )
I think this is because plusplus cannot be evaluated because mylist does
not exist and mylist cannot be created until plusplus is evaluated.
There are people on this list wh
Please do not post to both BioConductor and R.
On Thu, 2005-11-10 at 09:51 -0700, Nayeem Quayum wrote:
> Hello everybody,
> I am trying to use mas5 to normalize some array data and using mas5 and
> mas5calls. But I received these warning message. If anybody can explain the
> problem I would real
my.write <- function( obj, name ){
filename <- file=paste( name, ".txt", sep="")
write.table( obj, file=filename, sep="\t", quote=F)
}
my.write( df, "output" )
Regards, Adai
On Thu, 2005-11-10 at 13:28 +, Luis Ridao Cruz wrote:
> R-help,
>
> I have a function which is exporting the o
-sided testing.
But the smaller the p-value, more evidence against the null hypothesis.
Regards, Adai
On Thu, 2005-11-10 at 06:05 -0500, Duncan Murdoch wrote:
> On 11/9/2005 10:01 PM, Adaikalavan Ramasamy wrote:
> > I think an alternative is to use a p-value from F distribution. Even
>
1 - 100 of 440 matches
Mail list logo