similar to: Formulae with factors that have missing values

Displaying 20 results from an estimated 10000 matches similar to: "Formulae with factors that have missing values"

2000 Sep 07
1
R function writing question
Hi there! I'm looking for a better way of getting the following code working -- can you help? Instead of having to type in: binarymissing(y ~ x1 + x2,data=mydata,na.action=na.keep) as my function call, I would prefer not having to type in na.action=na.keep each time as this will always be the same. The function na.keep is simply: na.keep <- function(X){X} The first few lines
2010 Mar 05
1
How to parse the arguments from a function call and evaluate them in a dataframe?
Hi, I would like to write a function which has the following syntax: myfn <- function(formula, ftime, fstatus, data) { # step 1: obtain terms in `formula' from dataframe `data' # step 2: obtain ftime from `data' # step 3: obtain fstatus from `data' # step 4: do model estimation # step 5: return results } The user would call this function as: myfn(formula=myform,
2008 Jul 17
2
nested calls, variable scope
Below is an example of a problem I encounter repeatedly when I write functions. A call works at the command line, but it does not work inside a function, even when I have made sure that all required variables are available within the function. The only way I know to solve it is to make the required variable global, which of course is dangerous. What is the elegant or appropriate way to solve
2012 Mar 23
3
Using MuMIn - error message
Hello, I hope that you can bare with me. I am new to models, but I think I have a pretty godd understanding of how to run them now, including how to use AICc and Anova. The issue is that I have many factors that I wish to compare so doing each one at a time would take forever. I came across the MuMIn package and I was so excited, however I am getting an error message and i don't know why.
2006 Apr 11
1
Time Series information in formulae
Dear List The UKgas data is stored as an object of class 'ts'. I am trying to use "UKgas" in a formula as argument to a function. However, I do not know how to access the 'time series' information in the response (such as start() end() etc.). Here is a boiled down example. ssm <- function(formula, data = list(),subset=NULL) { cl <- match.call() if
2015 Feb 23
5
iterated lapply
Hi everybody, with the following code I generate a list of functions. Each function reflects a "condition". When I evaluate this list of functions by another lapply/sapply, I get an unexpected result: all values coincide. However, when I uncomment the print(), it works as expected. Is this a bug or a feature? conditions <- 1:4 test <- lapply(conditions, function(mycondition){
2012 Mar 27
1
two lmer questions - formula with related variables and output interpretation
Hello, I have been attempting to set up a lme and have looked at numerous posts including 'R's lmer cheat-sheet' as well as reading a number of papers and other resources including R help, but I am still a little confused on how to write my model (I thought I had it). I have asked a number of questions on different forums; most of which have been resolved. My main concern right now
2015 Feb 24
3
iterated lapply
From: Daniel Kaschek <daniel.kaschek at physik.uni-freiburg.de> > ... When I evaluate this list of functions by > another lapply/sapply, I get an unexpected result: all values coincide. > However, when I uncomment the print(), it works as expected. Is this a > bug or a feature? > > conditions <- 1:4 > test <- lapply(conditions, function(mycondition){ >
2000 Nov 08
3
R for windows read.table()
Just wondering if there was a reason why when I use the read.table() command the R console window shrinks in size? -------------------------------------------------------------------------------- Rachel Merriman Department of Statistics University of Auckland (wk) 373 7599 x 8797 -------------- next part -------------- An HTML attachment was scrubbed... URL:
2015 Feb 26
3
iterated lapply
Would introducing the new frame, with the call to local(), cause problems when you use frame counting instead of <<- to modify variables outside the scope of lapply's FUN, I think the frame counts may have to change. E.g., here is code from actuar::simul() that might be affected: x <- unlist(lapply(nodes[[i]], seq)) lapply(nodes[(i + 1):(nlevels - 1)],
2012 Sep 19
0
[LLVMdev] newbie question on getelementptr
Hi Óscar, Thank you for your prompt reply. Unfortunately, I still need more guidance as using the Demo page to generate C++ code didn't result in a global variable being used. Basically, I'm following your advice to use a LoadInst: Value *v = new LoadInst(result, "", theBasicBlock); Function *myfn = cast<Function>(v); I was not sure how I could get a BasicBlock for the
2002 Apr 26
1
optim or nlm with matrices
Hi, I have the following hypothetical optimization problem: -det(t(x-A%*%x1)%*%(x-A%*%x1)) where A,x,x1 are matrices. A coefficients and x and x1 are variable matrices or vectors. I tried to apply optim and nlm functions but I kept receive the following massage: Error in A%*%x1 : non-conformable arguments. The massage appears even the -det() can be calculated and the dimensions are checked. here
2015 Feb 24
2
iterated lapply
> On Feb 24, 2015, at 10:50 AM, <luke-tierney at uiowa.edu> wrote: > > The documentation is not specific enough on the indented semantics in > this situation to consider this a bug. The original R-level > implementation of lapply was > > lapply <- function(X, FUN, ...) { > FUN <- match.fun(FUN) > if (!is.list(X)) > X <-
2011 Dec 12
2
Problems in building a DLL in 64-bit Windows
I am trying to build a C language DLL and it works well with i386 but when I compile with it substituted by x64, like the FAQ page says, the result is an error message: C:/PROGRA~1/R/R-214~1.0/bin/x64/R.ddl: file not recognized : File format not recognized collect2: ld returned 1 exit status How can I solve this? The problem is with R 2-14.0 and 2-13.0 The complete source code is /* * myfun.c
2006 Jan 25
16
Slideshow beta
Ok, I finally got the slideshow code to a state worth showing it off. The site is a very rough cut of a site I''m building for my wife''s photography, so ignore the unfinished design for now :) http://rachel.kathihill.com/ To see the ajax version, go to: http://rachel.kathihill.com/?ajax=1 To randomize the order the images show: http://rachel.kathihill.com/?random=1 To change
2010 Jun 22
1
subset dataset using factor levels instead of factor names
Hi All, I have a factor variable with 52 levels -with long, annoying names. I want to keep only rows with some variables. I can do this using this code: test1 <- subset(nih2009,ic_name %in% c('NATIONAL EYE INSTITUTE','Veterans Affairs')) dim(test1) [1] 2396 38 But this doesn't work: t1 <- subset(nih2009, ic_name %in% c(27,51)) dim(t1) [1] 0 38 I know
2023 Jul 06
1
Plotting factors in graph panel
Hi John: Thanks! Below is the data using your suggestion. I used "ggplot" to make a graph. I am not too happy with it. I am looking for something simpler and cleaner. Plot is attached. I also tried "lattice" package, but nothing got plotted with "xyplot" command, because it is looking for a numeric variable on x-axis. ggplot(TrialData4, aes(x=Income, y=Percent,
2023 Jul 06
1
Plotting factors in graph panel
Btw, I think "lattice" graphics will provide a better solution than "ggplot", because it puts appropriate (space saving) markers on the axes and does axes labels well. However, I cannot figure out how to do it in "lattice". On Thu, 6 Jul 2023 at 15:11, Anupam Tyagi <anuptyagi at gmail.com> wrote: > Hi John: > > Thanks! Below is the data using your
2023 Jul 07
1
Plotting factors in graph panel
Hallo Anupam I do not see much difference in ggplot or lattice, they seems to me provide almost identical results when removing theme part from ggplot. library(ggplot2) library(lattice) ggplot(TrialData4, aes(x=Income, y=Percent, group=Measure)) + geom_point() + geom_line() + facet_wrap(~Measure) xyplot(Percent ~ Income | Measure, TrialData4, type = "o", pch = 16, as.table =
2015 Feb 26
1
iterated lapply
> On Feb 25, 2015, at 5:35 PM, Benjamin Tyner <btyner at gmail.com> wrote: > > Actually, it depends on the number of cores: Under current semantics, yes. Each 'stream' of function calls is lazily capturing the last value of `i` on that core. Under Luke's proposed semantics (IIUC), the result would be the same (2,4,6,8) for both parallel and serial execution. This is