Displaying 20 results from an estimated 4000 matches similar to: "xtabs or model.frame (PR#5461)"
2009 Jun 03
1
Still can't find missing data - How do I get NA in xtabs with factors?
The problem here is Table doesn't seem to have a way to weigh the data.
> ToyData
Data1 Data2 Data3 Weight
101 Sam Red Banana 1.1
102 Sam Green Banana 2.1
103 Sam Blue Orange 2.1
104 Fred Red Orange 2.1
105 Fred Green Guava 2.1
106 Fred Blue Guava 2.1
107 <NA> Red Pear 50.1
108 <NA> Green Pear 50.1
109 <NA> Blue
2006 Feb 12
1
lme, nlsList, nlsList.selfStart
Dear listers,
I am trying to fit a model using nlsList() using alternately a SSfol()
selfstart function or its developped equivalent formulae.
This preliminary trial works well
mydata<-groupedData(Conc~Tps|Organ,data=mydata)
mymod1<-nls(Conc~SSfol(Dose,Tps,lKe,lKa,lCl),data=mydata)
as well as a developped form:
mymod2<-nls(Conc~Dose * exp(lKe+lKa-lCl) *
2004 Feb 18
2
using names() as a variable in a formula
Greetings List,
I'm having some trouble with the use of the names function in a formula. Below is an example of something that works (i.e first line), and the second line is the same formula which doesn't. I want to be able to reference the column of the dataC table so I can run the variogram iteratively with a loop.
> v<-variogram(A1~1,loc=~x+y, dataC)
>
2007 Mar 07
3
possible bug in model.frame.default
Dear list,
I may have found a bug in model.frame.default (called by the lm function).
The problem arises in my R dev version but not in my R 2.4.0.
Here is my config :
> version
_
platform
x86_64-unknown-linux-gnu
arch
x86_64
2006 Oct 24
1
r error
I hope you can help me. I am new to "R" and am working through the
example of quantile regression analysis in the paper by Roger Koenker
(quantile regression in R: a Vignette. I got to page 6 and in trying to
execute the following code I received the error below. I have searched
on the web and while I have found similar error messages, I have not
been able to ascertain the root cause.
2003 May 14
2
how to include 'NA's in xtabs?
Hello!
I have a dataset with NA's in some variables (factors), for example:
$ P67 : Factor w/ 2 levels "-","+": NA 2 1 NA NA 2 1 1 2 NA ...
I need to use 'xtabs' like
xtabs(~x$P67)
It works well and produces something like this:
x$P67
- +
779 1318
but i want to compute NA's too, like this:
x$P67
- + NA
779 1318 137
I am trying
2004 Feb 15
1
manova() with a data frame
I'm trying to learn to use manova(), and don't understand why none of
the following work:
> data(iris)
> fit <- manova(~ Species, data=iris)
Error in lm.fit(x, y, offset = offset, singular.ok = singular.ok, ...) :
incompatible dimensions
> fit <- manova(iris[,1:4] ~ Species, data=iris)
Error in model.frame(formula, rownames, variables, varnames, extras,
2009 Sep 04
1
Problem with xtabs(), exclude=NULL, and counting NA's
Hi all,
I cannot get xtabs to count NA's like I expect. Below is a sample session, and
note that the last two calls to xtabs() yield exactly the same thing.
I am running R-2.5.0 -- if there was a bug in xtabs that got fixed, I would love
to know about it. If there is a bug tracker somewhere, I can file it too. It
isn't my fault that the server is so ridiculously outdated, but I would
2017 Jan 20
0
xtabs(), factors and NAs
>>>>> Milan Bouchet-Valat <nalimilan at club.fr>
>>>>> on Thu, 19 Jan 2017 13:58:31 +0100 writes:
> Hi all,
> I know this issue has been discussed a few times in the past already,
> but Martin Maechler suggested in a bug report [1] that I raise it here.
>
> Basically, there is no (easy) way of printing NAs for all variables
> when calling
2009 Dec 13
1
xtabs - missing combination
Dear list,
I am trying to make a contingency table with xtabs but I am getting
a 0 where I expect a 'NA'. Here is a simple example:
options(stringsAsFactors = FALSE)
rn <- LETTERS[1:4]
df1 <- data.frame(r07 = rep(rn, each=4),
r08 = rep(rn, 4), value = 1:16)
xtabs(value ~ r07 + r08, df1)
# Delete the combination [A, C]
df1 <- df1[-3,]
# Set 'value'
2015 Feb 09
3
xtabs and NA
Hi
I haven't found a way to produce a tabulation from factor data with NA
values using xtabs. Please find a minimal example below, it's also on
R-pubs [1]. Tested with R 3.1.2 and R-devel r67720.
It doesn't seem to be documented explicitly that it's not supported.
From reading the code [2] it looks like the relevant call to table()
doesn't set the "useNA"
2007 Oct 05
1
creating objects of class "xtabs" "table" in R
I have an application that would generate a cross-tabulation in array
format in R. In particular, my application would give me a result
similar to that of :
array(5,c(2,2,2,2,2))
The above could be seen as a cross-tabulation of 5 variables with 2
levels each (could be 0 and 1). In this case, the data were such that
each cell has exactly 5 observations. I
Now, I want the output to look like the
2005 Sep 13
1
logistic regression with nominal predictors
(Sorry for obvious mistakes, as I am quite a newby with no Statistics
background).
My question is going to be what is the gain of logistic regression over
odds ratios when none of the input variables is continuous.
My experiment:
Outcome: ordinal scale, ``quality'' (QUA=1,2,3)
Predictors: ``segment'' (SEG) and ``stress'' (STR). SEG is
nominal scale with 24
2008 Mar 12
1
ftable and xtabs
Hoping someone can help me with xtabs and ftable. I'm trying to get a pair
of ftables (possibly more) next to each other. For example:
> dunhill_lights_xtab<-ftable(xtabs(grossedupobs ~ gender+age_group +
dunhill_lights, data = ciggs))
> dunhill_lights_xtab
dunhill_lights No Yes
gender age_group
Female
2003 Jul 04
1
specifying dataframe column names in loops
Dear list members,
This is probably a naive question (from a new user), but I'm having problems
getting column
names to be recognised in loop that is supposed to apply a set of
calculations in turn
to each column of a dataframe.
The dataframe has 33 columns of output from a simulation.
The columns each have a text name and I want to apply the same set of
calculations
to each column in turn.
2009 Apr 24
2
argument 'exclude' in function xtabs
Dear all
I was willing to use argument 'exclude' in function xtabs to remove some
levels of factors (xtabs help page says '"exclude: a vector of values to be
excluded when forming the set of levels of the classifying factors").
I tried:
> mydata <- data.frame(
treatment = c("B", "A", "C", "C", "B",
2009 Jul 02
1
From xtabs to matrix
Hi list,
is it possible convert the xtabs result
xtabs(breaks~tension+wool,data=warpbreaks)
wool
tension A B
L 401 254
M 216 259
H 221 169
to a simple matrix or data frame?
A B
L 401 254
M 216 259
H 221 169
Thanks a lot! Gianandrea
--
View this message in context: http://www.nabble.com/From-xtabs-to-matrix-tp24304588p24304588.html
2005 Nov 08
0
sorting during xtabs? sorting by "individual" order?
Hey alltogether,
refacturing a package (before it will be released),
I ran across the following problem.
I have two directories with different text files,
I want to read the first and construct a document-term
matrix from it (every term=word in a row, every file in
a column, occurrence frequencies form the values).
The second directory contains different files. It
needs to be read in to also
2001 Aug 05
2
xtabs, drop.unused.levels (PR#1041)
Full_Name: Martin Lenze
Version: 1.3.0 22.06.2001
OS: win32,x86
Submission from: (NULL) (194.221.251.1)
As a newbie I'm not sure, whether this is a bug, but I don't know how to get
around this behaviour:
> x <- list("A"=rep(c(1:5),30),
+ "B"=c(rep(letters[1:3],30),rep(letters[2:4],20)))
> y <- as.data.frame(x)
> xtabs(~A+B,y)
B
A a b c d
1 6 10
2007 Feb 13
1
Missing variable in new dataframe for prediction
Hi,
I'm using a loop to evaluate several models by taking adjacent variables from my dataframe.
When i try to get predictions for new values, i get an error message about a missing variable in my new dataframe.
Below is an example adapted from ?gam in mgcv package
library(mgcv)
set.seed(0)
n<-400
sig<-2
x0 <- runif(n, 0, 1)
x1 <- runif(n, 0, 1)
x2 <- runif(n, 0, 1)
x3 <-