Displaying 20 results from an estimated 40000 matches similar to: "Error in if-command"
2002 Aug 01
6
update() can not find objects (PR#1861)
Full_Name: Yi-Xiong Zhou
Version: 1.5.1
OS: win2000pro
Submission from: (NULL) (64.169.249.42)
Update() can not find objects when it is used in a function, which is in turn
being called by another function. Here is a R script to show the problem:
######## begin of the test script ##########
fun1 <- function() {
x <- matrix(rnorm(500), 20,25)
y <- rnorm(20)
oo <- lm(y~x)
2012 Nov 11
2
changing the signs in rows or columns in matrices and check them if they are identical
Dear R users,
i have this problem with matrices i want to check between two matrices if they are isomorphic i will give an example for what excactly i want
1 -1 1 -1 1 1
-1 1 -1 1 -1 -1
1 1 -1 1 1 -1
this two matrices are isomorphic beacause if i change the first 2 columns the matrices
2012 Aug 11
3
replace funcion
Hello everybody,
I would like to replace or recode a list of numbers between 1 and 12 (total
100). I have tried to make it with recode, but i have two types of
replacements. For 1,2,3,4,11,12 => invierno and for 5,6,7,8,9 and 10 =>
verano.
recode(datos.mx1[,7], "1='invierno'; 2='invierno';
2020 May 02
1
issues with environment handling in model.frame()
Dear all,
model.frame behaves in a way I don't expect when both its formula and
subset argument are passed through a function call.
This works as expected:
model.frame(~wool, warpbreaks, breaks < 15)
#> wool
#> 14 A
#> 23 A
#> 29 B
#> 50 B
fun1 <- function(y) model.frame(~wool, warpbreaks, y)
fun1(with(warpbreaks, breaks < 15))
#> wool
#> 14
2006 Aug 09
3
objects and environments
Dear list,
I have two functions created in the same environment, fun1 and fun2.
fun2 is called by fun1, but fun2 should use an object which is created in fun1
fun1 <- function(x) {
ifelse(somecondition, bb <- "o", bb <- "*")
## mymatrix is created, then
myresult <- apply(mymatrix, 1, fun2)
}
fun2 <- function(idx) {
if (bb == "o) {
#
2012 Nov 17
3
transform input argument (matrix) of function
Dear list!
I would like to write a function to transform matrix, which is input argument of a written function. It is easy with new matrix (see below), but my idea is to transform input argument (matrix) of function without any additional matrixes. Here is an example:
fun1 <- function(xy) {
xy <- cbind(xy[,1], xy[,2], xy[,1] + xy[,2])
return(xy)
}
df1 <- matrix(c(1,2,3,1,2,3), ncol =
2011 Nov 23
2
How to increase precision to handle very low P-values
Hello, Rlisters
I have to compute p-values that are on the tail of the distribution,
P-values < 10^-20.
However, my current implementations enable one to estimate P-values up to
10^-12, or so.
A typical example is found below, where t is my critical value.
########### example - code adapted from Rassoc #######################
rho01 = 0.5
rho105 = 0.5
rho005 = 0.5
t = 8
z = 2
2009 Jun 16
1
ifelse(is.na), with function inside
Hi,
I have a vector a=c(NA, 3, 4, 4, NA, NA, 3) and I would like to use is.na(a)
function to get a vector like this:
wy=(1,2,2,2,1,1,2) - you know, this vector create 1 or 2 depends on value in
vector "a"
This is my short code but something is wrong and I don't know what...
for (i in 1:7){
a=c( NA, 3, 4, 4, NA, NA, 3)
fun1=function(x){
x=1
print(x)
}
fun2=function(x){
2012 Nov 08
5
map two names into one
Thanks.
Yes. Your approach can identify:
Glaxy ace S 5830 and
S 5830 Glaxy ace
But you can not identify using same program:
Iphone 4S 16 G
Iphone 4S 16G
How should I solve both in same time.
Kind regards,Tammy
[[alternative HTML version deleted]]
2007 May 17
1
use loop or use apply?
Hi,
I have two matrices, A (axd) and B (bxd). I want to get another matrix C (axb)
such that, C[i,j] is the Euclidean distance between the ith row of A and jth
row of B. In general, I can say that C[i,j] = some.function (A[i,], B[j,]).
What is the best method for doing so? (assume a < b)
I have been doing some exploration myself: Consider the following function:
get.f, in which,
2020 Apr 22
3
how to add my own passes to LTO pass
Hi,
I have a module pass and I hope to use it to optimize a real-world program.
I need LTO,and I have got LTO plugin.
But How can I add my passes to LTO Pass. I can't find solution.
What should I do?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20200422/76d2b046/attachment.html>
2011 Apr 07
2
Two functions as parametrs of a function.
Hi R users:
I'm trying to make a function where two of the parameters are
functions, but I don't know how to put each set of parameters for
each function.
What am I missing?
I try this code:
f2<-function(n=2,nsim=100,fun1=rnorm,par1=list(),fun2=rnorm,par2=list()){
force(fun1)
force(fun2)
force(n)
p1<-unlist(par1)
p2<-unlist(par2)
force(p1)
force(p2)
2007 Jan 06
1
listing all functions in R
Dear List,
I'm building an R syntax highlighting file for GeSHi [*] for a website I
am currently putting together. The syntax file needs a list of keywords
to highlight. How can I generate a list of all the functions in a base R
installation?
Ideally the list would be formatted like this:
"'fun1', 'fun2', 'fun3'"
when printed to the screen so I can copy
2002 Apr 12
1
Problems with memory
Dear all,
I've started working with R (vs 1041) a few weeks ago, and now I'm
having problems with the amount of memory.
I'm working on the windows-me, my computer has 128 Mb of memory. I'm
using the R under the emacs (ESS-5.1.20) and it is started by the
command:
Rterm --min-vsize=10M --max-vsize=100M --min-nsize=500k --max-nsize=1M
I've been had problems when executing a
2007 Nov 13
2
[LLVMdev] BasicAliasAnalysis and out-of-bound GEP indices
Hi!
While investigating into the PR1782 I spent some time analyzing
BasicAliasAnalysis.cpp. While the mentioned problem should be fixed now
(I hope), I have discovered some other possibilities for a bug to occur.
In the case of checking for aliasing of two pointer values, where at
least one of them is a GEP instruction with out-of-bound indices,
BasicAliasAnalysis can return NoAlias, even if the
2004 Mar 25
1
mlocal/mtrace inside a loop
Hello
I need some help in figuring Bravington’s debugger
out.
Ok
I have 2 functions, fun1 and fun2 saved in a ASCII
file say filename is funs.
Fun1 has a loop which calls fun2, fun2 has a loop
which fails and I need to find out the value of the
variables of the fun2 and fun1 loops at the specific
iteration that fails. Both fun1 and fun2 loops will
iterate thousands of times so line by line debug
2009 Oct 01
1
pass "..." to multiple sub-functions
Dear list,
I know I have seen this discussed before but I haven't been successful
in searching for "ellipsis", "dots", "..." in the archives. I would
like to filter "..." arguments according to their name, and dispatch
them to two sub-functions, say fun1 and fun2. I looked at lm() but it
seemed more complicated than I need as it modifies the calling
2012 Aug 30
1
How to modify the values of the parameters passing via ...
Dear Friends,
Let's assume there are three parameters that were passed into fun1. In
fun1, we need to modify one para but the remains need to be untouched. And
then all parameters were passed into fun2. However, I have failed to
achieve it.
Please see the following code.
##########################################
fun1 <-function(x, y, z=10) {x+y+z;}
fun2 <-function(aa, ...) {
2004 Mar 23
3
how to modify variables of another frame (but not global)
Hello!
Maybe "frame" is not the right term in this context.
I explain my problem by example code:
fun2 <- function(objName, add) {
## the object "objName" should be increased by "add",
## but the evaluation should be done in the calling function (here:
fun1)
## ...... what's the right code??
}
fun1 <- function() {
x <- 1
fun2("x",
2012 Nov 20
2
correct function formation in R
Dear list!
?
I have question of?'correct function formation'. Which function (fun1 or fun2; see below) is written more correctly? Using ''structure'' as output or creating empty ''data.frame'' and then transform it as output? (fun1 and fun1 is just for illustration).
?
Thanks a lot, OV
?
code:
input <- data.frame(x1 = rnorm(20), x2 = rnorm(20), x3 =