Displaying 20 results from an estimated 8000 matches similar to: "Converting an ftable (contingency table) to a dataframe in R"
2017 Jul 09
2
Help with ftable.svyby
Hi all,
When I try the following with pkg Survey it returns the error below:
ftable(svyby(~INCOME, ~AGECL+RACECL, svymean, design=q50),
rownames=list(AGECL=c("<35", "35-44", "45-54", "55-64",
"65-74", ">=75"),
RACECL=c("white non hispanic", "non white or
2010 Jun 08
2
constructing a contingency table (ftable, table)
Dear all,
an hopefully quick table question.
I have the following data:
Two objects that are 2*9 matrix with nine column names (Dis1, ...,
Dis9) and the row names (2010,2020). The content are frequencies
(numeric).
In want to create a table that is along the lines of
ftable(UCBAdmissions) and should looks like this:
Dis1 | ...| Dis9
2010|2020|....|2010|2020
(first row,first column is the value
2017 Jul 09
0
Help with ftable.svyby
try resetting your factor levels and re-run?
q50 <- update( q50 , INCOME = factor( INCOME ) , AGECL = factor( AGECL ) ,
RACECL = factor( RACECL ) )
On Sun, Jul 9, 2017 at 2:59 PM, Orsola Costantini via R-help <
r-help at r-project.org> wrote:
> Hi all,
>
> When I try the following with pkg Survey it returns the error below:
>
> ftable(svyby(~INCOME, ~AGECL+RACECL,
2011 Feb 17
1
3 questions about the poisson regression of contingency table
Hi all:
I have 3 questions about the poisson regression of contingency table.
Q1¡¢How to understand the "independent poisson process"as many books or paper
mentioned?
For instance:
Table1
-------------------------------------------
treat caner non-cancer sum
-------------------------------------------
treat1 52(57.18) 19(13.82) 71
treat2
2010 Mar 10
3
see the example and help me
sample report data that i want to forecast
quarter quarter_index Revenue
2007 Q1 1 $3,856,799
2007 Q2 2 $4,243,328
2007 Q3 3 $4,930,369
2007 Q4 4 $5,443,579
2008 Q1 5 $5,164,830
2008 Q2 6 $5,104,413
2008 Q3 7
2010 Mar 11
4
Forecast
sample report data that i want to forecast
quarter quarter_index Revenue
2007 Q1 1 $3,856,799
2007 Q2 2 $4,243,328
2007 Q3 3 $4,930,369
2007 Q4 4 $5,443,579
2008 Q1 5 $5,164,830
2008 Q2 6 $5,104,413
2008 Q3 7
2012 Feb 03
3
Cannot get "==" operator to return TRUE
I have a data.frame named "df". The dput of df is at the bottom of this e-mail.
What I'd like to do is replace the "n/a " values with NA. On Mac OSX, it works
to do this:
df[df == "n/a"] <- NA
However, it does not work on Ubuntu. See below.
Thanks in advance,
Garrett
> x <- df[27, 4] # complete data.frame dput is below
> dput(x)
"n/a?"
2008 Mar 02
1
question on lag.zoo
Hi Guys,
I'm using zoo package now. I found lag is not doing what I assumed.
> x <- zoo(11:21)
> z <- zoo(1:10, yearqtr(seq(1959.25, 1961.5, by = 0.25)), frequency = 4)
> x
1 2 3 4 5 6 7 8 9 10 11
11 12 13 14 15 16 17 18 19 20 21
> lag(x)
1 2 3 4 5 6 7 8 9 10
12 13 14 15 16 17 18 19 20 21
> z
1959 Q2 1959 Q3 1959 Q4 1960 Q1 1960 Q2 1960 Q3 1960 Q4
2012 Apr 12
4
Definition of "lag" is opposite in ts and xts objects!
Example:
Will ts objects be obsolete or modified?
> a [,1]
1983 Q1 2.747365190
1983 Q2 2.791594762
1983 Q3 -0.009953715
1983 Q4 -0.015059485
1984 Q1 -1.190061246
1984 Q2 -0.553031799
1984 Q3 0.686874720
1984 Q4 0.953911035> lag(a,4) [,1]
1983 Q1 NA
1983 Q2 NA
1983 Q3 NA
1983 Q4 NA
1984 Q1 2.747365190
1984 Q2
2009 May 20
1
sem with categorical data
I am trying to run a confirmatory factor analysis using the SEM package. My
data are ordinal. I have read
http://socserv.mcmaster.ca/jfox/Misc/sem/SEM-paper.pdf.
When I apply the hetcor function, I receive the following error:
Error in checkmvArgs(lower = lower, upper = upper, mean = mean, corr = corr,
:
at least one element of 'lower' is larger than 'upper'
Example:
2009 Feb 19
2
table with 3 variables
I have the initial matrice:
> *data.frame(Subject=rep(100:101, each=4), Quarter=rep(paste("Q",1:4,
sep=""),2), Boolean = rep(c("Y","N"),4))*
Subject Quarter Boolean
1 100 Q1 Y
2 100 Q2 N
3 100 Q3 Y
4 100 Q4 N
5 101 Q1 Y
6 101 Q2 N
7 101 Q3 Y
8 101
2008 Feb 01
2
the "union" of several data frame rows
Hi,
I have a question about how to obtain the union of several data frame
rows. I'm trying to create a common key for several tests composed of
different items. Here is a small scale version of the problem. These
are keys for 4 different tests, not all mutually exclusive:
id q1 q2 q3 q4 q5 q6
1 A C
2 B D
3 A D B
4 C D B D
I would like
2009 Feb 19
2
table with 3 varialbes
I have the initial matrice:
> *data.frame(Subject=rep(100:101, each=4), Quarter=rep(paste("Q",1:4,
sep=""),2), Boolean = rep(c("Y","N"),4))*
Subject Quarter Boolean
1 100 Q1 Y
2 100 Q2 N
3 100 Q3 Y
4 100 Q4 N
5 101 Q1 Y
6 101 Q2 N
7 101 Q3 Y
8 101
2008 Jul 02
1
exporting ftable
How can I export an ftable object in the same format that appears in R
command window?
For testing that i was using this example that is in help of this function.
## Start with a contingency table.
ftable(Titanic, row.vars = 1:3)
ftable(Titanic, row.vars = 1:2, col.vars = "Survived")
ftable(Titanic, row.vars = 2:1, col.vars = "Survived")
## Start with a data frame.
x <-
2011 Jul 06
3
Tables and merge
----- Original Message -----
From: "Silvano" <silvano at uel.br>
To: <r-help at r-project.org>
Sent: Thursday, June 30, 2011 9:07 AM
Subject: Tables and merge
> Hi,
>
> I have 21 files which is common variable CODE.
> Each file refers to a question.
>
> I would like to join the 21 files into one, to construct
> tables for each question by CODE.
>
2011 Mar 14
2
data.frame transformation
Hi R users,
I have following data frame
df<-data.frame(q1=c(0,0,33.33,"check"),q2=c(0,33.33,"check",9.156),
q3=c("check","check",25,100),q4=c(7.123,35,100,"check"))
and i would like to replace every element that is less then 10 with . (dot)
in order to obtain this:
q1 q2 q3 q4
1 . . check .
2 . 33.33 check 35
2009 Jul 11
3
Reading data entered within an R program
Dear R-helpers,
I know of two ways to reading data within an R program, using
textConnection and stdin (demo program below). I've Googled about and
looked in several books for comparisons of the two approaches but
haven't found anything. Are there any particular advantages or
disadvantages to these two approaches? If you were teaching R beginners,
which would you present?
Thanks,
Bob
2012 Dec 17
2
Suggestion: 'method' slot for format.ftable()
Dear R-developers,
I would like to suggest a 'method' slot for format.ftable() (see an adjusted
'format.ftable()' below, taken from the source of R-2.15.2).
At the moment, format.ftable() contains several empty cells due to the way the
row and column labels are printed. This creates problems (= unwanted empty
columns/rows) when converting an ftable to a LaTeX table; see an
2007 Sep 15
3
applying math/stat functions to rows in data frame
Hi All,
There are a variety of functions that can be applied to a variable
(column) in a data frame: mean, min, max, sd, range, IQR, etc.
I am aware of only two that work on the rows, using q1-q3 as example
variables:
rowMeans(cbind(q1,q2,q3),na.rm=T) #mean of multiple variables
rowSums (cbind(q1,q2,q3),na.rm=T) #sum of multiple variables
Can the standard column functions (listed in the
2008 Nov 03
1
qr() and Gram-Schmidt
Hi,
Why the qr() produces a negative Q compared with Gram-Schmidt? (note
example below, except Q[2,3])
Here is an example, I calculate the Q by Gram-Schmidt process and
compare the output with qr.Q()
a <- c(1,0,1)
b <- c(1,0,0)
c <- c(2,1,0)
x <- matrix(c(a,b,c),3,3)
##########################
# Gram-Schmidt
##########################
A <- matrix(a,3,1)
q1 <-