Hi,
'R CMD INSTALL -l' will stop if some error is encountered. I don't
find in the manual an option to keep the command running. Is there
such an option?
--
Tom
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE d
a, elem_name) {
>> mean(data[[elem_name]])
>> }
>> mean_on_element(data, 'x')
>>
>> Since 'x' is quoted in the function call, you need to use code that
>> can convert the string 'x' to extracting the data object with name x.
>&
my_sum(data, c('x1', 'x3', 'x6'))
>>
>> # (2) Lose 'with' and use subscripting instead:
>> mean_on_element=function(data, elem_name) {
>> mean(data[[elem_name]])
>> }
>> mean_on_element(data, 'x')
>>
>&g
Hi All,
I want to enclose with() in a function mean_on_element. Obviously, it
is not working. The problem is how to specify the element name with a
function body. Does anybody have any suggestion? Thanks!
> data=list(x=1:10)
> with(data, mean(x))
[1] 5.5
>
> mean_on_element=function(data, elem_na
Dear All,
I want to check what packages depends on a given package. For example,
glmnet depends on Matrix. I want get the names of all the packages
that depend on Matrix on CRAN. Is there a way to do so? Thanks!
> library(glmnet)
Loading required package: Matrix
Loading required package: lattice
Hello All,
I'm trying to supply both an expression and a .R file to Rscript. But
it seems that it is not possible with the first approach (see below)
and I'll have to use the second approach (see below). I'm wondering if
it is a bug in Rscript not to support both a .R file and an
expression.
$ ca
Hello All,
I have the following line and some other lines in my .Rprofile.
options(echo=T)
To disable it, I have the following in the first line in the script.
But 'Rscript a_script.R' still shows ">options(echo=F)", which I want
to get rid of it as well.
options(echo=F)
I tried to use the fol
Hi,
The following two 'df's should be the same, although their
constructions are different. But the results of paste() are different.
I don't see this is explained in ?paste. Could you help me understand
why it is like this?
> df=data.frame(X=c(1, 2, 3), Y=c(4, 5, 6))
> df
X Y
1 1 4
2 2 5
3 3 6
Hello All,
Suppose that I have a sequence of letters (e.g., A..Z). I want to
permute the sequence to generate random sequences, such that the local
density of any letter with a window (say of length L) doesn't change
much before and after permutation.
One way that I can thing of is to require tha
Hello All,
?environmentName shows how to get the environment name. But I don't
see how to set the name in the first place. Could you tell me where to
look for the function that set the environment name?
--
Tom
__
R-help@r-project.org mailing list
http
Hi All,
The last line if the following code returns the error right below this
paragraph. Essentially, I use the operator %:% to retrieve a variable
in a nested frame. Then I want to use the same operator (with '<-') to
change its value. I'm not sure if this is possible in R with %:%
operator. Wo
Hello All,
Suppose that x is a data.frame. I want to change the colname 'oldname'
to 'newname'. I have the following code. Could anybody let me know if
there is any better way to change a column name?
colnames(x)[grep('oldname', colnames(x))]='newname'
--
Tom
__
Hello All,
It seems weird to me that Rscript does the following thing and enters
the R prompt mode. If I change the file name to something that doesn't
start with 'size', then Rscript runs normally. Does anybody know what
is going on?
$ Rscript size.R
WARNING: '--file=size.R' value is invalid: ig
Hi All,
I meant to take the min row by row. But the result is apparently not
what I want. Changing min to pmin solve the problem.
> df=data.frame(X=1:10, Y=1:10)
> transform(df, Z=min(X,10-Y))
X Y Z
1 1 1 0
2 2 2 0
3 3 3 0
4 4 4 0
5 5 5 0
6 6 6 0
7 7 7 0
8 8 8 0
9 9
Hello All,
I'm trying to pass the argument col.names to write.csv using '...'.
But I got the following warnings. Maybe it is very simple. But I'm not
sure what I am wrong. Could you please help point to me what the
problem is?
#
fun=function(x, ...) {
fr=parent.frame()
tm
Hello All,
'\\' is printed as '\\', but it is actually only one character.
Sometimes, I'd rather print it as a single '\'. Is there a function to
do so in R?
> nchar('\\')
[1] 1
> print('\\')
[1] "\\"
--
Tom
__
R-help@r-project.org mailing list
https
Hello,
Normally, if I type a function name, it shows the function definition.
When the function is masked by a variable with the same name, it
doesn't show the function definition any more. Can anyone please tell
me a way how to retrieve the function definition even if it is masked
by a variable?
Hello All,
sample() only sample on one variable x. But I'm interested in sampling
more than one variable without replacement.
Suppose I have 3 vectors x, y, z. I want to draw samples from all
three vectors such that the combination of the three elements in each
draw is not the same as any previou
18 matches
Mail list logo