search for: eriki

Displaying 20 results from an estimated 29 matches for "eriki".

Did you mean: erik
2010 Nov 08
7
How to rbind list of vectors with unequal vector lengths?
Hi, How to rbind these vectors from a list?: > l <- list(a = c(1, 2), b = c(1, 2, 3)) > l $a [1] 1 2 $b [1] 1 2 3 > do.call(rbind, l) [,1] [,2] [,3] a 1 2 1 b 1 2 3 Warning message: In function (..., deparse.level = 1) : number of columns of result is not a multiple of vector length (arg 1) > -J
2010 May 23
4
creating a reverse geometric sequence
Hello, Can anyone think of a non-iterative way to generate a decreasing geometric sequence in R? For example, for a hypothetical function dg, I would like: > dg(20) [1] 20 10 5 2 1 where I am using integer division by 2 to get each subsequent value in the sequence. There is of course: dg <- function(x) { res <- integer() while(x >= 1) { res <- c(res, x) x
2010 Sep 18
3
How to check the available of a package on R repo
Hi folks, Debian 504 64-bit What is the correct syntax to check the available of a package on R repo? > available.packages("emacs", "OS_type=linux") Warning: unable to access index for repository emacs Package Version Priority Depends Imports LinkingTo Suggests Enhances OS_type License File Repository > available.packages("emacs") Warning: unable
2010 Aug 11
4
Arbitrary number of covariates in a formula
Hello! I have something like this: test1 <- data.frame(intx=c(4,3,1,1,2,2,3), status=c(1,1,1,0,1,1,0), x1=c(0,2,1,1,1,0,0), x2=c(1,1,0,0,2,2,0), sex=c(0,0,0,0,1,1,1)) and I can easily fit a cox model: library(survival) coxph(Surv(intx,status) ~ x1 + x2 + strata(sex),test1) However, I want to
2010 Feb 16
3
Keyboard
All, I installed R-2.10.1 with Readline=no. Now for some reason R does not recognize some key strokes like the directional arrows. I am not sure if Readline is the problem or not. I have tried .Cofigure with Readline = yes but it doesn't fix the problem nor do I really know if readline is the problem to start with. Has anybody else run into similar problems? Thanks, Steve [[alternative
2010 May 31
0
Put two plots side by side
...=y) grid.newpage() pushViewport(viewport(layout=grid.layout(1,2))) print(p, vp=vport(1,1)) print(p1, vp=vport(1,2)) ? Felipe D. Carrillo Supervisory Fishery Biologist Department of the Interior US Fish & Wildlife Service California, USA ----- Original Message ---- > From: Erik Iverson <eriki at ccbr.umn.edu> > To: Peng Yu <pengyu.ut at gmail.com> > Cc: ggplot2 <ggplot2 at googlegroups.com> > Sent: Sun, May 30, 2010 7:45:22 PM > Subject: Re: Put two plots side by side > > > > I want to put the above two plots side by side (essentially, > to...
2010 Oct 05
4
R editor in ubuntu!
Hello R-Users! I am looking for an editor to be able to execute commands into R in Linux ubuntu. Is there any suggestion? Thanks. [[alternative HTML version deleted]]
2010 Jun 16
3
Function argument as string
Hi, Suppose a write a function a_fn<-function(arg1) { return(table(arg1)); } I have a column called AGE. Now I call the function c = a_fn(AGE); When a_fn is called, AGE is received in arg1. My question is, how do I access the actual name of the argument arg1? i.e, inside the function, i need to know that the actual name of arg1 is "AGE" in this case. Thanks in advance,
2011 Mar 23
3
Compare three or more values?
Is there a less cryptic way to compare three or more values? allTheSame<-c("red","red","red","red") notAllTheSame<-c(132,132,132,999) all.identical <- function(vectorToTest){ cIdentical=sum(vectorToTest %in% vectorToTest[1]) return(cIdentical==length(vectorToTest)) } all.identical(allTheSame) all.identical(notAllTheSame) Thanks in
2010 Feb 14
4
Feature Request: Multiline Comments
Hello, Is it possible to extend the R lexer/parser to include multiline comments like /* acomment */ ? This way I can integrate emacs org-mode with my R code, so that I can have a table of contents, section folding, html-output of source etc. e.g /* * Display Code */ #+BEGIN_SRC R foo <- function(...){ stuff } #+end_src and so on . Thanks Saptarshi
2010 Jul 16
4
how to comment off sections
Hello, Is there an way to easy comment of sections of code? I was thinking something along the lines of \dontrun{ codeline 1 .... codeline k } but that could be used in regular script files. When I am still working on a script, I often want to being using what is done, but I would like the parts I am still working on not to be run when I use source() on the file. I can set everything off
2011 May 04
3
SAPPLY function XXXX
Hello everyone, I am attempting to write a function to count the number of non-missing values of each column in a data frame using the sapply function. I have the following code which is receiving the error message below. > n.valid<-sapply(data1,sum(!is.na)) Error in !is.na : invalid argument type Ultimately, I would like for this to be 1 conponent in a larger function that will produce
2010 Apr 30
3
replace elements in a list
Dear all, I have a list like this: l <- list(list(a=1,b=NULL), list(a=2,b=2)) I want to find out the elements with value of NULL and replace them with NA. The actual case has a very long list, so manually find out and replace them is not an option. I can use for loop to do this, but I want to know if there is vectorized way (or other ways) to do it? Thanks -- Wincent Rong-gui HUANG Doctoral
2010 Jun 15
3
How to see how a function is written
Hello, If I want to see how, say, apply function is written, how would I be able to do that? Just typing "apply" at the prompt does not work. Thank you for help! Sergey
2010 Oct 25
2
Question on passing the subset argument to an lm wrapper
Hello, How would you go about handling the following situation? This is on R 2.12.0 on Ubuntu 32-bit. I have a wrapper function to lm. I want to pass in a subset argument. First, I just thought I'd use "...". ## make example reproducible set.seed(123) df1 <- data.frame(age = rnorm(100, 50, 10), bmi = rnorm(100, 30, sd = 2)) ## create a wrapper using
2010 Aug 21
3
problems with merge() - the output has many repeated lines
Hi everyone, I have been merging many big dataframes (about 80000 rows each) and I never had this problem, but now it happened to me and I want to know if someone knows what could be happening. The final dataframe has many rows, an impossible number! I have done edit(dataframe) and I saw that there are many repeated rows (all equal). Thanks for any help, Cec?lia Carmo Universidade de
2010 Aug 07
4
basic question about t-test with adjusted p value
I have read the R manual and help archives, sorry but I'm still stuck. How would I do a t-test with an adjusted p-value? Suppose that I use t.test ( ) , with the function argument alternative = "two.sided", and data such that degrees of freedom = 20. The function calculates a t-statistic of 2.086, and p-value =0.05 How do I then adjust the p-value? My thought is to do
2010 Feb 17
8
Use of R in clinical trials
Dear all, There have been a variety of discussions on the R list regarding the use of R in clinical trials. The following post from the STATA list provides an interesting opinion regarding why SAS remains so popular in this arena: http://www.stata.com/statalist/archive/2008-01/msg00098.html Regards, -Cody Hamilton
2010 Oct 15
0
nomianl response model
...tatistics Erasmus University Medical Center Address: PO Box 2040, 3000 CA Rotterdam, the Netherlands Tel: +31/(0)10/7043478 Fax: +31/(0)10/7043014 Web: http://www.erasmusmc.nl/biostatistiek/ ------------------------------ Message: 74 Date: Wed, 13 Oct 2010 13:18:32 -0500 From: Erik Iverson <eriki at ccbr.umn.edu> Cc: r-help at r-project.org Subject: Re: [R] Coin Toss Simulation Message-ID: <4CB5F7F8.1080609 at ccbr.umn.edu> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Shiv wrote: > I am trying a simple toin coss simulation, of say 200 coin tosses. The idea &gt...
2010 Aug 24
0
mlm for within subject design
...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. >> >> --Forwarded Message Attachment-- From: eriki at ccbr.umn.edu CC: r-help at r-project.org To: eva.nordstrom at yahoo.com Date: Mon, 23 Aug 2010 16:41:16 -0500 Subject: Re: [R] "easiest" way to write an R dataframe to excel? In addition to the Wiki already mentioned, the following may be useful: http://learnr.wordpress.com/2009/10/...