similar to: Is missingness always passed on?

Displaying 20 results from an estimated 20000 matches similar to: "Is missingness always passed on?"

2019 Oct 01
0
Is missingness always passed on?
There is "missing with default" and "missing without default". If an argument x is missing without a default, then missing(x) is true, if you pass x to another function, it will pass the value of the "missing argument". (which is different than simply being missing!) If an argument x is missing _with_a default, then missing(x) is still true, but if you pass x to
2019 Oct 01
0
Is missingness always passed on?
Le 30/09/2019 ? 16:17, Duncan Murdoch a ?crit?: > > There's a StackOverflow question > https://stackoverflow.com/q/22024082/2554330 that references this text > from ?missing: > > "Currently missing can only be used in the immediate body of the > function that defines the argument, not in the body of a nested > function or a local call. This may change in the
2008 Apr 07
2
basehaz and newdata
I am unable to get the basehaz function to apply a proportional hazards model to a new data frame. I replicated my specific situation with the example for coxph in the help, where I changed the x value of the first record from 0 to 1. Is there something incorrect in the syntax that I am using? Thanks in advance! test1 <- list(time= c(4, 3,1,1,2,2,3), status=c(1,NA,1,0,1,1,0),
2013 Apr 26
2
speed of a vector operation question
Hello, I am dealing with numeric vectors 10^5 to 10^6 elements long. The values are sorted (with duplicates) in the vector (v). I am obtaining the length of vectors such as (v < c) or (v > c1 & v < c2), where c, c1, c2 are some scalar variables. What is the most efficient way to do this? I am using sum(v < c) since TRUE's are 1's and FALSE's are 0's. This
2012 Sep 18
1
chunk row to new table/file
I have big .csv file. I would like to filter that file into a new table. For example, I have .csv file as below: f1 f2 f3 f4 f5 f6 f7 f9 f10 f11 t1 1 0 1 0 1 0 0 0 0 1 t2 1 0 0 0 0 1 1 1 1 1 t3 0 0 0 0 0 0 0 0 0 0 t4 1 0 0 0 1 0 0 0 0 0 t5 0 0 0 0 0 0 0 0 0 0 t6 0 0 0 0 0 0
2012 Nov 24
1
Adding a new variable to each element of a list
Hello, I have a list of data with multiple elements, and each element in the list has multiple variables in it. Here's an example: ### Make the fake data dv <- c(1,3,4,2,2,3,2,5,6,3,4,4,3,5,6) subject <- factor(c("s1","s1","s1","s2","s2","s2","s3","s3","s3",
2019 Oct 05
4
should base R have a piping operator ?
Hi John, Thanks, but the Bizzaro pipe comes with many flaws though : * It's not a single operator * It has a different precedence * It cannot be used in a subcall * The variable assigned to must be on the right * It doesn't trigger indentation when going to the line * It creates/overwrite a `.` variable in the worksace. And it doesn't deal gracefully with some lazy evaluation edge
2010 Feb 09
1
"1 observation deleted due to missingness" from summary() on the result of aov()
I have the R code at the end. The last command gives me "1 observation deleted due to missingness". I don't understand what this error message. Could somebody help me understand it and how to fix the problem? > summary(afit) Df Sum Sq Mean Sq F value Pr(>F) A 2 0.328 0.16382 0.1899 0.82727 B 3 2.882 0.96057 1.1136 0.34644 C
2010 Feb 28
1
"Types" of missingness
Dear R-List, My questions concerns missing values. Specifically, is is possible to use different "types" of missingness in a dataset and not a one-size-fits-all NA? For example, data may be missing because of an outright refusal by a respondent to answer a question, or because she didn't know an answer, or because the item simply did not apply. In later analysis it is sometimes
2011 Mar 10
1
avoid copying big object passed into optimize()
Hello list, I have the following scenario: f1 <- function(a) { .... # doing things; may need 'a', but does not change 'a'. g <- function(x) { sum(x + a) # Say. Use 'a'; does not change 'a'. } optimize(f = g, lower = 0, upper = 1) } f2 <- function() { b <- runif(100000000000) # Create big object. f1(a
2008 Apr 18
3
Function redefinition - not urgent, but I am curious
This is just my curiousity working. Suppose I write: f1 <- function(x) x + 1 f2 <- function(x) 2 * f1(x) f2(10) # 22 f1 <- function(x) x - 1 f2(10) # 18 This is quite obvious. But is there any way to define f2 in such a way that we "freeze" the definition of f1? f1 <- function(x) x + 1 f2 <- function(x) # put something here 2 * f1(x) # probably put something else here
2011 Oct 06
3
Wide to long form conversion
I have some data 'myData' in wide form (attached at the end), and would like to convert it to long form. I wish to have five variables in the result: 1) Subj: factor 2) Group: between-subjects factor (2 levels: s / w) 3) Reference: within-subject factor (2 levels: Me / She) 4) F: within-subject factor (2 levels: F1 / F2) 5) J: within-subject factor (2 levels: J1 / J2) As this is the
2006 Aug 16
1
Specifying Path Model in SEM for CFA
I'm using specify.model for the sem package. I can't figure out how to represent the residual errors for the observed variables for a CFA model. (Once I get this working I need to add some further constraints.) Here is what I've tried: model.sa <- specify.model() F1 -> X1,l11, NA F1 -> X2,l21, NA F1 -> X3,l31, NA F1 -> X4,l41, NA F1 -> X5, NA, 0.20
2011 Feb 14
4
sem problem - did not converge
Someone can help me? I tried several things and always don't converge # Model library(sem) dados40.cov <- cov(dados40,method="spearman") model.dados40 <- specify.model() F1 -> Item11, lam11, NA F1 -> Item31, lam31, NA F1 -> Item36, lam36, NA F1 -> Item54, lam54, NA F1 -> Item63, lam63, NA F1 -> Item65, lam55, NA F1 -> Item67, lam67, NA F1 ->
2009 Aug 05
4
A question regarding R scoping
I have a question related to scoping. Suppose we have 2 functions: f1 = function(i){i = 1} f2 = function(n){ i = length(n) f1(i) } In other words, I would like i=1 regardless of n. Is this possible without having f1 in the body of f2? Thanks in advance!
2007 Jul 12
1
sub-function default arguments
Hi. I have defined a function, f1, that calls another function, f2. Inside f1 an intermediate variable called nm1 is created; it is a matrix. f2 takes a matrix argument, and I defined f2 (schematically) as follows: f2<-function(nmArg1=nm1,...){nC<-ncol(nmArg1); ... } so that it expects nm1 as the default value of its argument. f1 is defined (schematically) as:
2003 May 20
1
How to use pakcage SEM
Hi. I have tried to use Package "SEM". As a learning, I try to convert a program running well of EQS which is as follows to SEM: ### EQS ### /SPECIFICATION CAS=100; VAR=5 MAT=COR; ANA=COR; /EQUATIONS V1=*F1+E1; V2=*F1+E2; V3=*F1+*F2+E3; V4=**F1+*F2*E4; V5=*F2+E5; /VAR E1 TO E5=*; F1*1.0; F2=1.0; /COV E1,E2=*; F1,F2=*: /PRINT FIT ALL; /MATRIX ...... /END This is the converted SEM
2008 Apr 04
2
How to create a function calling two functions with unknown number of parameters?
... can be used to represent unknown number of parameters passed into a function. For example, I write a function g. g calls another function f1. For example f1 could be different random number generation function. when f1=rnorm(), it has 3 parameters n, mean and standard deviation. when f1=rexp(), it has 2 parameters n and rate. g can be defined as g <- function(f1, ...) { f1(...) }
2009 Jul 15
4
Extract pairs (rowname, columname) from a matrix where value is 0
Dear sir, I have a matrix like a<-matrix(c(0,2,0,4,0,6,5,8,0),nrow=3) colnames(a)<-c("F1","F2","F3") rownames(a)<-c("A1","A2","A3") a F1 F2 F3 A1 0 4 5 A2 2 0 8 A3 0 6 0 I want to extract all pairs (rownames, columnames) from which the value in the matrix is 0 The result should be something like this A1, F1 A2,
2015 Oct 12
2
identical(..., ignore.environment=TRUE)
It seems odd/inconvenient to me that the "ignore.environment" argument of identical() only applies to closures (which I read as 'functions' -- someone can enlighten me about the technical differences between functions and closures if they like -- see below for consequences of my confusion). This is certainly not a bug, it's clearly documented, but it seems like a design