On 07/02/2011 07:50 AM, David Winsemius wrote:
I would like to do some operations inside a function using only one
value for the last dimension of a table/matrix:
tabfn <- function (dfrm, facvec, YN ="event"){
return( Etbl <- do.call(table, dfrm[ , c(facvec, "event") ]) )
# just want Etbl[,,,"T
Hi,
I am new to R and not fantastic at statistics so it may well be that I am
doing something silly but I can't figure out what it is and hoping that
somebody can help.
I am running package lme4, and trying to get a Residuals vs. Fitted graph.
When I try to plot, I receive an error.
Error in as
On Jul 2, 2011, at 03:29 , Marc Schwartz wrote:
> It actually scared me that I had any recollection of an isolated post from 10
> years ago. Not sure what to make of that...
If it is any consolation, the author had forgotten it entirely
--
Peter Dalgaard
Center for Statistics, Copenhagen
There is indeed right censoring, but I obviously didn't explain it very well.
Patients are either fully oriented or not (1 or 2) after an hour. If they're
not, then the data is right censored.
However, I don't feel that "coxme" is overkill at all, as I may also have to
account for repeated COURS
Sara Krause gmail.com> writes:
>
> Hi,
>
> I am new to R and not fantastic at statistics so it may well be that I am
> doing something silly but I can't figure out what it is and hoping that
> somebody can help.
>
> I am running package lme4, and trying to get a Residuals vs. Fitted graph.
>
Hi all:
I perform the linear mixed model for 300 persons, y is CD4 count,x is time.
I randomized slope and intercept,so I can get 300 slopes and 300 intercepts.Now
I wanna test wheter the variance of 300 slopes and 300 intercepts differs from
zero. If the variance of 300 slopes(or intercepts) d
What happens to the correlation when i dichotomize the variables? ( i need a
function for R)
What happens if the correlation is always larger or smaller? What happens to
the median? (also a function is needed)
What happens if the distribution is not normal?
I need point clouds!
and last but not
Dear Madame or Sir,I am having a problem in combining density-smoothed
scatterplot matrices with a plot of kernel destiny estimations of each
dimension plotted on the respective field of the diagonal.I have tried
following approach using the package "sm" for the kernel density estimation, as
w
Hello Uwe,
thanks a lot!
That solved the "problem"
Have a nice weekend!
Viele Grüße
Lui
2011/7/1 Uwe Ligges :
> See ?clusterEvalQ
>
> Uwe Ligges
>
> On 01.07.2011 16:11, Lui ## wrote:
>>
>> Dear group,
>>
>> does anybody know how to export libraries/functions to all nodes when
>> launching sn
Hi,
If i want to repeat a function, say 100 times, how do i do that? i used the for
loop but there's an error somewhere.
Thanks
shan
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinf
Please read the posting guide. "there's an error somewhere" is simply
not enough to go on.
Best,
Ista
On Sat, Jul 2, 2011 at 9:03 AM, Shantal Bonnick wrote:
> Hi,
>
> If i want to repeat a function, say 100 times, how do i do that? i used the
> for
> loop but there's an error somewhere.
>
> Tha
Your question needs help. Seriously.
A) No subject on the Subject line. This makes it difficult to keep track of the
replies as the discussion proceeds.
B) no example code. This makes it difficult to respond directly, since there is
more than one way to "use the for loop".
C) No mention of the s
On 02.07.2011 13:59, akaebi wrote:
What happens to the correlation when i dichotomize the variables? ( i need a
function for R)
What happens if the correlation is always larger or smaller? What happens to
the median? (also a function is needed)
What happens if the distribution is not normal?
If you send a better readable message with really reproducible code, we
may provide a solution, this way it is really hard to read your code.
And yes, please do not send html mail. My guess is that par(new=TRUE)
will help, but I do not want to construct the examples at first.
On 02.07.2011
OK, so let me make it reproducible and start with
myTable <- iris
require("MASS")
On 02.07.2011 17:09, "Patrick Großmann" wrote:
Dear Mr. Ligges,
my apologies! As I can see in your E-Mail the quote of mine is really just
unreadable! Anyhow, this was not produced by me writing messy messa
On Jul 2, 2011, at 5:39 AM, peter dalgaard wrote:
>
> On Jul 2, 2011, at 03:29 , Marc Schwartz wrote:
>
>> It actually scared me that I had any recollection of an isolated post from
>> 10 years ago. Not sure what to make of that...
>
> If it is any consolation, the author had forgotten it enti
On Jul 2, 2011, at 12:34 PM, Bansal, Vikas wrote:
Dear all,
I am doing a project on variant calling using R.I am working on
pileup file.There are 10 columns in my data frame and I want to
count the number of A,C,G and T in each row for column 9.example of
column 9 is given below-
On Jul 2, 2011, at 10:15 AM, Ista Zahn wrote:
Please read the posting guide. "there's an error somewhere" is simply
not enough to go on.
True enough, but under the hypothesis that this might be some sort of
simulation task, I would also suggest looking at:
?replicate
Best,
Ista
On Sa
dear R experts---
I am experimenting with multicore processing, so far with pretty
disappointing results. Here is my simple example:
A <- 10
randvalues <- abs(rnorm(A))
minfn <- function( x, i ) { log(abs(x))+x^3+i/A+randvalues[i] } ## an
arbitrary function
ARGV <- commandArgs(trailingOnly
>> Dear all,
>>
>> I am doing a project on variant calling using R.I am working on
>> pileup file.There are 10 columns in my data frame and I want to
>> count the number of A,C,G and T in each row for column 9.example of
>> column 9 is given below-
>>
>> .a,g,,
>> .t,t,,
>>
Dear Mr. Ligges,
my apologies! As I can see in your E-Mail the quote of mine is really just
unreadable! Anyhow, this was not produced by me writing messy messages, this
is due to the Java application behind the client not being able to cope with
external tab-characters on my browser when
hi,
I'm looking for a package to compare two hazard ratios (and assign
statistical significance) obtained from two different predictive models. I
know of the hr.comp2 function from the survcomp package, but was wondering
if there's any other packages out there.
thanks!
[[alternative HTM
On 02/07/2011 14:03, Shantal Bonnick wrote:
Hi,
If i want to repeat a function, say 100 times, how do i do that? i used the for
loop but there's an error somewhere.
Thanks
shan
[[alternative HTML version deleted]]
Hi Shan,
Could you post the code you're using? Then we can figure out
Hi there,
I have a vector of some functions e.g.
#-#
f.1 <- function(a) {
return( a );
}
f.2 <- function(a) {
return( 1 - (tanh(a))^2 );
}
f.3 <- function(a) {
return( 1 / (1+exp(-a)) * (1 - (1 / (1+exp(-a );
}
func.l <- c(f.1, f.2, f.3);
#--
On 02.07.2011 19:32, ivo welch wrote:
dear R experts---
I am experimenting with multicore processing, so far with pretty
disappointing results. Here is my simple example:
A<- 10
randvalues<- abs(rnorm(A))
minfn<- function( x, i ) { log(abs(x))+x^3+i/A+randvalues[i] } ## an
arbitrary fun
Hi Thomas,
On Sat, Jul 2, 2011 at 9:36 AM, Thomas Stibor wrote:
> Hi there,
>
> I have a vector of some functions e.g.
> #-#
> f.1 <- function(a) {
> return( a );
> }
> f.2 <- function(a) {
> return( 1 - (tanh(a))^2 );
> }
> f.3 <- function(a) {
> return( 1 / (1+exp
thank you, uwe. this is a little disappointing. parallel processing
for embarrassingly simple parallel operations--those needing no
communication---should be feasible if the thread is not always created
and released, but held. is there light-weight parallel processing
that could facilitate this?
This bug has been fixed.
Kevin
On Tue, Jun 28, 2011 at 6:11 AM, Niels Janssen wrote:
> Dear list,
>
> I have a problem with the "corrgram" function. It does not seem to "color"
> large negative correlations, while the same correlation, if positive,
> provides no problems. Is this a bug?
>
>
On 02.07.2011 20:04, ivo welch wrote:
thank you, uwe. this is a little disappointing. parallel processing
for embarrassingly simple parallel operations--those needing no
communication---should be feasible if the thread is not always created
and released, but held. is there light-weight paral
This email is intended for R users that are not that familiar with R
internals and are searching google about how to speed up R.
Despite common misperception, R is not slow when it comes to iterative
access. R is fast when it comes to matrices. R is very slow when it
comes to iterative access in
hi uwe--I did not know what snow was. from my 1 minute reading, it
seems like a much more involved setup that is much more flexible after
the setup cost has been incurred (specifically, allowing use of many
machines).
the attractiveness of the doMC/foreach framework is its simplicity of
installat
On 02.07.2011 20:42, ivo welch wrote:
hi uwe--I did not know what snow was. from my 1 minute reading, it
seems like a much more involved setup that is much more flexible after
the setup cost has been incurred (specifically, allowing use of many
machines).
the attractiveness of the doMC/foreac
You can just tell the function to create 1000 random numbers. See ?runif for
the specifics. The arguments are n, min, and max. 'n' is the one you are
looking for.
Da.
--
View this message in context:
http://r.789695.n4.nabble.com/Repeating-a-function-in-R-tp3640508p3640966.html
Sent from the R h
If you want to repeat an entire function, use replicate as in
replicate(15,sapply(1,function(x) runif(x)))
Here, sapply(1,function(x) runif(x)) draws on uniformly distributed
variable. replicate(15,...) is the wrapper function that tells to do this 15
times. The benefit here is that you can repli
Some comments:
the comparison matrix rows vs. matrix columns is incorrect: Note that R
has lazy evaluation, hence you construct your matrix in the timing for
the rows and it is already constructed in the timing for the columns,
hence you want to use:
M <- matrix( rnorm(C*R), nrow=R )
D <-
On 02.07.2011 20:51, Daniel Malter wrote:
You can just tell the function to create 1000 random numbers. See ?runif for
the specifics. The arguments are n, min, and max. 'n' is the one you are
looking for.
Thanks for providing help on R-help, but for the future please
- respond to the OP rath
Hi:
There seems to be a problem if the string ends in , or . , which makes
it difficult for strsplit() to pick up if it is splitting on those
characters. Here is an alternative, splitting on individual characters
and using charmatch() instead:
charsum <- function(s, char) {
u <- strsplit(s, "
hi uwe---thanks for the clarification. of course, my example should always
be done in vectorized form. I only used it to show how iterative access
compares in the simplest possible fashion. <100 accesses per seconds is
REALLY slow, though.
I don't know R internals and the learning curve would b
Hi,
To amplify on Josh's cogent remarks, the reason you can't create a
vector of functions is because vectors are composed of atomic objects
and functions are not atomic objects:
> is.atomic(f.3)
[1] FALSE
> is.atomic(1)
[1] TRUE
> is.atomic(TRUE)
[1] TRUE
> is.atomic('a')
[1] TRUE
'Vectors' of
On reflection and a bit of testing I think the best approach would be
to use gregexpr. For counting the number of commas, this appears quite
straightforward.
> sapply(gregexpr("\\,", txtvec), function(x) if ( x[[1]] != -1)
length(x) else 0 )
[1] 3 3 3 4 3 3 2 6 4 6 6
It easily generalize
Here's another datapoint using the multicore package -- which is what
the foreach/doMC combo uses internally:
I halved your A value to 50,000 because I was getting impatient :-)
A=5
randvalues <- abs(rnorm(A))
minfn <- function( x, i ) { log(abs(x))+x^3+i/A+randvalues[i] }
system.time(a1 <- l
This should work. You have to return an object from a function; you
can not try to reference an object within a function. So the value is
returned and saved in an object called 'rw' since that is how you are
referening it.
walk.2d<-function(n)
{
rw <- matrix(0, ncol = 2, nrow = n)
# generate t
On Jul 2, 2011, at 4:46 PM, Bansal, Vikas wrote:
DEAR ALL,
I TRIED THIS CODE AND THIS IS RUNNING PERFECTLY...
df=read.table("Case2.pileup",fill=T,sep="\t",colClasses = "character")
txt=df[,9]
txtvec <- readLines(textConnection(txt))
dad=data.frame(A = unlist(sapply(gregexpr("A|a", txtvec),
f
Hi all,
I have a data matrix likein "input.txt"
8 9 2 5 4 5 8 5 6 6
8 9 2 8 9 2 8 9 2 1
8 9 2 5 4 5 8 5 6 4
8 9 2 5 4 5 8 5 6 6
8 9 2 8 9 2 8 9 2 1
8 9 2 5 4 5 8 9 2 2
In this example will be an 6x10 matrix (or data frame)
I want to detect how many times in a row appears this combination
Hi
I have developed the code below. I am worried that the parameters I want to
be estimated are "not being found" when I ran my code. Is there a way I can
code them so that R recognize that they should be estimated.
This is the error I am getting.
> out1=optim(llik,par=start.par)
Error in pnorm(
Thanking you,
Warm Regards
Vikas Bansal
Msc Bioinformatics
Kings College London
From: David Winsemius [dwinsem...@comcast.net]
Sent: Saturday, July 02, 2011 6:19 PM
To: Bansal, Vikas
Cc: r-help@r-project.org
Subject: Re: [R] For help in R coding
On Jul 2,
HI
THIS SEEMS LITTLE BIT CONFUSING.BUT I AM USING THIS CODING AS SUGGESTED BY YOU-
df=read.table("Case2.pileup",fill=T,sep="\t",colClasses = "character")
txt=df[,9]
txtvec <- readLines(textConnection(txt))
vik=data.frame(A = unlist(lapply( lapply( sapply(txtvec, strsplit,
split="a|A"), length)
DEAR ALL,
I TRIED THIS CODE AND THIS IS RUNNING PERFECTLY...
df=read.table("Case2.pileup",fill=T,sep="\t",colClasses = "character")
txt=df[,9]
txtvec <- readLines(textConnection(txt))
dad=data.frame(A = unlist(sapply(gregexpr("A|a", txtvec), function(x) if (
x[[1]] != -1)
length(x) else 0 )),
Dear R Development Core Team
We are more than happy that Windows 7 was launched after long restless period
of waiting. Due to this expected moment, we prepared and launched new Windows 7
download website that will be used by new Windows 7 customers to look for
software compatible with Windows 7
Dear all
I want to simulate a stochastic jump variance process where N is Bernoulli
with intensity lambda0 + lambda1*Vt. lambda0 is constant and lambda1 can be
interpreted as a regression coefficient on the current variance level Vt. J
is a scaling factor
How can I rewrite this avoiding the loop
Hi,
Could anyone help me with this error? I have no idea what that is about...
> file <- system.file("DADOSCASUMCCORMICK.xlsx", package = "xlsx")
> data <- read.xlsx(file, 1)
Error in .jnew("java/io/FileInputStream", file) :
java.io.FileNotFoundException: (No such file or directory)
Thanks
EdBo wrote:
>
> Hi
>
> I have developed the code below. I am worried that the parameters I want
> to be estimated are "not being found" when I ran my code. Is there a way I
> can code them so that R recognize that they should be estimated.
>
> This is the error I am getting.
>
>> out1=optim(ll
Hi Edward,
One hint to improve your code is simply stylistic. Everyone tends to
have their own favorite way, but adding spaces and line breaks can
help make code much easier to read. Also, you seemed to have used
brackets "[" instead of parentheses "(" for the first two calls to
sum(). As Beren
On Saturday 02 July 2011 21:40:24 Trying To learn again wrote:
Clumsy but it works (replace the bingo stuff with what you want to do next):
x <- as.matrix( read.table( "input.txt") )
xdim <- dim( x )
ix <- xdim[ 1 ]
jx <- xdim[ 2 ] - 2
bingo <- 0
for( i in 1:ix )
{
for( j in 1:jx )
{
if
54 matches
Mail list logo