Displaying 20 results from an estimated 10000 matches similar to: "how to comment off sections"
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
2006 Aug 03
2
Link to an other model
Hi
I a newbie in RoR! So I have an easy question for some of you:
I want with the following codeline link to the Admin-Controller. The
codeline is on the Product-View with a seperate controller "Product".
<%= link_to ''Back'', :action => ''Admin'' %>
But it doesn''t work correctly. Can anyone help me? I want to make a
simple link!
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 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 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 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 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 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
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 Apr 12
2
source(,echo=T) doesn't echo final comments
Hi,
source(file,echo=T) will not echo the last comment in "file" if it is the last line in the file.
For instance, when sourcing a file containing the following lines
#comment 1
a<-1
#comment 2
R will echo
> #comment 1
> a<-1
What is the solution to have R echo all of the comment lines?
Specific context:
This problem arises e.g. in the context of help files (.Rd) whose
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
2014 Nov 26
6
testing dontrun examples
Is there a good strategy for testing examples which should not be run by
default? For instance, I have examples which get data from the Internet.
If I wrap them in try() then they can be skipped if the Internet is not
available, but may not be tested in cases when I would like to know
about the failure. (Not to mention that the example syntax is ugly.)
If I mark them \dontrun or \donttest
2007 Jun 16
1
How to comment out a piece of a R code in XEmacs+ESS
Hi,
When I using Xemacs+ESS to write a R code, I need to comment out a code line
by line putting #
It is possible to configure ESS to comment and uncomment a selected block of
code.
Thanks
Ronaldo
--
__ _
/ `-' ) ,,,
| | ()|||||||[:::e
\__.-._) ''' unk
--
> Prof. Ronaldo Reis J?nior
| .''`. UNIMONTES/Depto. Biologia Geral/Lab. de Ecologia
| : :'