similar to: Documentation of model.frame() and get_all_vars()

Displaying 20 results from an estimated 3000 matches similar to: "Documentation of model.frame() and get_all_vars()"

2017 Mar 30
0
get_all_vars() does not handle rhs matrices in formulae
Hello again, It appears that get_all_vars() incorrectly handles model formulae that use a right-hand side (rhs) matrix. For example, consider these two substantively identical models: # model using named variables mpg <- mtcars$mpg wt <- mtcars$wt hp <- mtcars$hp m1 <- lm(mpg ~ wt + hp) # model using matrix y <- mtcars$mpg x <- cbind(mtcars$wt, mtcars$hp) m2 <- lm(y ~ x)
2007 May 12
2
Implicit vs explicit printing and the call stack
Hi everyone, I've run into a bit of strange problem with implicit vs explicit printing and the call stack. I've included an example at the bottom of this email. The basic problem is that I have an S3 object with a print method. When the object is implicitly printed (ie. typed directly into the console) the function arguments in the call stack are exploded out to their actual values,
2018 May 10
4
the first name of the first column
Dear all; I need to run heatmap. Because my first column in my data is alphanumeric, I can not run as.matrix(scale(my_data)). So I need to make my data readable as in data(mtcars). In *mtcars *data the first column is alphanumeric and has no name. Thanks, Greg [[alternative HTML version deleted]]
2003 Jul 22
1
Conditional Statements for Graphing
Dear List I have math test scores for male and female students where gender is a dummy code (female =1). I also have a variety of other demographic variables. However to begin, I want to create a very simple stripchart where female math scores are a blue circle and male scores are a red triangle. I am having difficulty using conditional statements to accomplish this. Thank you. ------
2017 Jun 01
3
odfWeave - A loop of the "same" data
Before I go and do this another way - can I check if anyone has a way of looping through data in odfWeave (or possibly sweave) to do a repeating analysis on subsets of data? For simplicity lets use mtcars dataset in R to explain. Dataset looks like this: > mtcars mpg cyl disp hp drat wt ... Mazda RX4 21.0 6 160 110 3.90 2.62 ... Mazda RX4 Wag 21.0 6 160 110 3.90
2017 Jun 01
0
odfWeave - A loop of the "same" data
On Thu, 1 Jun 2017, POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST) via R-help wrote: > Before I go and do this another way - can I check if anyone has a way of > looping through data in odfWeave (or possibly sweave) to do a repeating > analysis on subsets of data? > > For simplicity lets use mtcars dataset in R to explain. Dataset looks like this: >
2004 Jan 22
1
stem plot problem with the mtcars data (PR#6453)
Full_Name: Liming Liang Version: 1.8.1 OS: windows2000 professional Submission from: (NULL) (67.172.81.139) I was looking at the variable 'mpg' of the data file 'mtcars' and make a stem plot, the following is the commend I entered. The stem plot shows the largest observation is 32.9 but actually in the data the largest observation is 33.9, here might be a problem. >
2013 Apr 12
3
Why copying columns of a data.frame becomes numeric?
Dear list, I want the 1st, 2nd, 5th, and 6th columns of mtcars. After copying them, the columns become numeric class rather than data frame. But, when I copy rows, they data frame retains its class. Why is this? I don't see why copying rows vs columns is so different. > class(mtcars) [1] "data.frame" > head(mtcars) mpg cyl disp hp drat wt qsec vs
2018 May 02
0
Converting a list to a data frame
Typo: dat[[z]] should be x[[z]]: x2 <- do.call(rbind, lapply(names(x), function(z) data.frame(type=z, x[[z]]))) x2 type x y 1 A 1 3 2 A 2 4 3 B 5 7 4 B 6 8 David C -----Original Message----- From: R-help <r-help-bounces at r-project.org> On Behalf Of David L Carlson Sent: Wednesday, May 2, 2018 3:51 PM To: William Dunlap <wdunlap at tibco.com>; Kevin E.
2018 May 02
3
Converting a list to a data frame
Or add the type column first and then rbind: x <- list(A=data.frame(x=1:2, y=3:4),B=data.frame(x=5:6,y=7:8)) x2 <- do.call(rbind, lapply(names(x), function(z) data.frame(type=z, dat[[z]]))) ---------------------------------------- David L Carlson Department of Anthropology Texas A&M University College Station, TX 77843-4352 -----Original Message----- From: R-help
2009 Mar 25
1
get_all_vars fails with matrices (PR#13624)
Hi, According to the help file for model.frame/get_all_vars, the following should produce the same output from both functions, but it doesn't... > dat <- list(X=matrix(1:15,5,3),z=26:30) > model.frame(~z+X,dat) z X.1 X.2 X.3 1 26 1 6 11 2 27 2 7 12 3 28 3 8 13 4 29 4 9 14 5 30 5 10 15 > get_all_vars(~z+X,dat) [1] z X <NA> <NA> <0
2009 Apr 27
0
VIF's in R using BIGLM
Dear R-help This is a follow-up to my previous post here: http://groups.google.com/group/r-help-archive/browse_thread/thread/d9b6f87ce06a9fb7/e9be30a4688f239c?lnk=gst&q=dobomode#e9be30a4688f239c I am working on developing an open-source automated system for running batch-regressions on very large datasets. In my previous post, I posed the question of obtaining VIF's from the output of
2007 Mar 18
1
Error with get_all_vars()
> get_all_vars(dist ~ speed, data = cars) Error in `row.names<-.data.frame`(`*tmp*`, value = c(NA, -50L)) : invalid 'row.names' length > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Under development (unstable) major 2 minor 5.0 year 2007 month
2019 Nov 18
2
Inappropriate class(o)[!inherits(o,"AsIs")] in get_all_vars
>>>>> Martin Maechler >>>>> on Mon, 18 Nov 2019 12:15:38 +0100 writes: >>>>> suharto anggono--- via R-devel >>>>> on Sun, 17 Nov 2019 10:34:31 +0000 writes: >> SVN revision 77401 changes >> x[isM] <- lapply(x[isM], function(o) `class<-`(o, class(o)[class(o) != "AsIs"])) >> to
2019 Nov 17
2
Inappropriate class(o)[!inherits(o,"AsIs")] in get_all_vars
SVN?revision?77401?changes ????????x[isM]?<-?lapply(x[isM],?function(o)?`class<-`(o,?class(o)[class(o)?!=?"AsIs"])) to ????????x[isM]?<-?lapply(x[isM],?function(o)?`class<-`(o,?class(o)[!inherits(o,"AsIs")])) in?function?'get_all_vars'?in?src/library/stats/R/models.R?in?R?devel. The?change?is?inappropriate.
2011 Aug 17
1
extract variables from model formula
Hi All, I am writing a function to predict values based on a model. It works fine as long as the formula just uses regular variable names. I am having a problem when the variables are wrapped with a function call. For example: m <- lm(mpg ~ factor(cyl), data = mtcars) ## I get the column names using as.character(attr(terms(m), "variables"))[-1L] ## which gives the same column
2018 Jul 20
2
Model formulas with explicit references
Dear R-Devel, I seem to no longer be able to access the bug-reporting system, so am doing this by e-mail. My report concerns models where variables are explicitly referenced (or is it "dereferenced"?), such as: cars.lm <- lm(mtcars[[1]] ~ factor(mtcars$cyl) + mtcars[["disp"]]) I have found that it is not possible to predict such models with new data. For example:
2013 Apr 16
2
efficiently diff two data frames
Dear all, What is the quickest and most efficient way to diff two data frames, so as to obtain a vector of indices (or logical) for rows/columns that differ in the two data frames? For example, > Xe <- head(mtcars) > Xf <- head(mtcars) > Xf[2:4,3:5] <- 55 > all.equal(Xe, Xf) [1] "Component 3: Mean relative difference: 0.6863118" [2] "Component 4: Mean relative
2010 Jan 26
1
[Fwd: Re: question on sqldf syntax]
Sorry mistake from me. This was another problem in my mind , but with RMySQL. Christian > library(RMySQL) > library(sqldf) > sqldf("Select * from mtcars") Fehler in mysqlNewConnection(drv, ...) : RS-DBI driver: (Failed to connect to database: Error: Access denied for user 'user'@'localhost' (using password: NO) ) Fehler in if (dbname ==
2019 Nov 29
0
Inappropriate class(o)[!inherits(o,"AsIs")] in get_all_vars
class(o)[!inherits(o,"AsIs")] is still in function 'get_all_vars' in R patched (in https://svn.r-project.org/R/branches/R-3-6-branch/src/library/stats/R/models.R). It was ported to R patched by r77402. On Monday, 18 November 2019, 8:12:10 PM GMT+7, Martin Maechler <maechler at stat.math.ethz.ch> wrote: >>>>> Martin Maechler >>>>>? ?