Displaying 20 results from an estimated 30000 matches similar to: "A function likes table"
2006 Dec 31
3
tabulate: switching columns and rows
Hi all,
Please, is there any way of controlling factors in row/columns when using ftable/xtabs? As far as I can see, the last cross-clasifing variable in the formula will appear in columns. The previous ones, in rows. For instance, is it possible to make tension and replicate appear in columns?
ftable(xtabs(breaks ~ wool + tension + replicate, data = warpbreaks))
After some years using SAS
2004 Sep 16
5
Indexing lists
DeaR useRs:
I have a list with 500 elements, in each other there are data.frames and I
want to take the first row and the first column of each elements of my list
since the first to the 500-th.
Thanks and excuse my bad English.
---
[[alternative HTML version deleted]]
2004 Feb 20
1
read.table with spaces
DeaR useRs:
Excuses for my english. I am trying to read a file with my dats and the format is a number, 3 spaces, other number, etc...
When I use:
a<-read.table(file="c:/datos2.dat",sep="")
R sais:
Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, :
line 3 did not have 34 elements
And I see my dats and in line 3 the first number is an
2006 Jul 19
3
illegal operation in debian (PR#9086)
Full_Name: Agustin Perez
Version: 2.3.1
OS: Debian 2.6.8-11-amd64-generic
Submission from: (NULL) (193.147.142.6)
First of all excuses for my bad use of english and thanks for read my problem.
Well when I do the following comand in R suddenly crashes and exit me for the
enviroment:
> a<-matrix(1:13500,450,30)
> a%*%t(a)
*** caught illegal operation ***
address 0x2a9590086f, cause
2001 Sep 05
3
Bug in ftable?? (Was: Two-way tables of data, etc)
Further to the discussion between Murray Jorgensen and Brian Ripley,
it seems to me better to choose tabulations that will not come and bite
you. Suppose your data are sligtly irregular, e.g. (for the sake of
the argument):
data( warpbreaks )
warpbreaks$variant <- rep( 1:5, len=54 )
attach( warpbreaks )
tb <- table( wool, tension, variant )
tb
# in this case you would like to see:
tp
2001 Sep 05
3
Bug in ftable?? (Was: Two-way tables of data, etc)
Further to the discussion between Murray Jorgensen and Brian Ripley,
it seems to me better to choose tabulations that will not come and bite
you. Suppose your data are sligtly irregular, e.g. (for the sake of
the argument):
data( warpbreaks )
warpbreaks$variant <- rep( 1:5, len=54 )
attach( warpbreaks )
tb <- table( wool, tension, variant )
tb
# in this case you would like to see:
tp
2003 Feb 28
0
(multiway) percentage tables
R has amazing capabilities, but percentage tables are a weak spot
IMHO. There's prop.table but that's rather unwieldly, especially for
multiway tables. CrossTable by Marc Schwartz in the gregmisc library
makes percentage tables a breeze but is limited to two-way tables. So
I decided to try my own hand at writing an R-function that would make
it easy to produce nicely formatted percentage
2011 Jun 24
1
Converting an ftable (contingency table) to a dataframe in R
I am generating an ftable (by running ftable on the results of a xtabs command) and I am getting the following.
? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?Var1? Var2
date ? ? ? ? ? ? ? ? group? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
2007-01-01? ? ? ? ? q1 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?1? ? 9
? ? ? ? ? ? ? ? ? ? ?q2 ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?
2009 Mar 21
0
Solved: [Fwd: Matching failure in merge()]
I've found where the problem was and a way to solve this problem:
One dataset was encoded (and read) as UTF-8
and the other one was encoded (en read) as latin3
In this case, even if at the terminal you see
the same characters, R states that the two
elements are not equal.
Don't know if this is the way it has to be,
or this is a bug.
Anyway, editing the second file (encoded as latin3)
2007 Jul 13
1
counting occurances of matching rows in a matrix
I need help regarding to the following problem:
Consider this matrix:
> M <- matrix(c(1,2, 4,3, 1, 2),3, 2, byrow=TRUE)
> M
[,1] [,2]
[1,] 1 2
[2,] 4 3
[3,] 1 2
I would like to have a matrix which counts the identical rows and places the counts into its third column. I tried with ftable():
> as.data.frame(ftable(M[,1], M[,2]))
Var1 Var2 Freq
1 1 2
2002 Jul 12
2
Crosstabs in R
Before I reinvent the wheel, I have need for a relatively straightforward
crosstabulation (2 x n) function. I know that R has table(), ftable(),
xtabs(), and summary(xtabs()), but none of these produce a fully "tricked"
out cross-tabulation with marginal totals, expected cell frequencies, and
an array of statistics about the contingency table.
Is there a more complete (something
2008 Feb 29
2
Getting multiple tables when using table(dataframe) to tabulate data
I am having hard time tabulating data in a dataframe, and getting a single
"table" for an answer. I am trying to tabulate all "counts" for given
"status" on a given date.
I have a data frame such as:
delta_ts status count
1 2008-02-27 CLOSED 3
2 2008-02-27 NEW 56
3 2008-02-27 RESOLVED 5
4 2008-02-21 ASSIGNED 1
5
2002 Feb 19
1
Rgnome produces errors?
I'm totally confused by the following:
1. I start R simply by typing R on the shell
and the following works with no problems:
> library(MASS)
> a <- lda(x=mod23puriflda[,2:5],grouping=mod23puriflda[,6],CV=F)
> summary(a)
Length Class Mode
prior 23 -none- numeric
counts 23 -none- numeric
means 92 -none- numeric
scaling 16 -none- numeric
lev 23
2009 May 12
2
[Fwd: Re: ubuntu problem with 'r-cran-robustbase' [FWD Agustin Lobo]]
Subject: Re: [R-sig-Debian] ubuntu problem with 'r-cran-robustbase' [FWD
Agustin Lobo]
Date: Tue, 12 May 2009 13:30:49 +0200
From: Agustin Lobo <aloboaleu at gmail.com>
Reply-To: aloboaleu at gmail.com
To: Dirk Eddelbuettel <edd at debian.org>
CC: Martin Maechler <maechler at stat.math.ethz.ch>,
R-SIG-Debian at stat.math.ethz.ch
References: <18953.17704.527898.355877
2001 Dec 11
1
how can i have the total for each level using table,ftable,xtabs etc. etc. ?
I have a list with four fields and 3500 records, from a MySQL table.
How can i have the total for each level using table, ftable, xtabs?
ex:
print(ftable(table[,"field1"]~table[,"field2"]))
thanks
Danilo Maurizio
Veneto Lavoro - Area Osservatorio -
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read
2008 Jun 27
4
Recoding
Hi!
Given a vector (or a factor within a df),i.e. v1 <- c(1,1,1,2,3,4,1,10,3)
and a dictionary
cbind(c(1,2,3),c(1001,1002,1003))
is there a function (on the same line than recode() in car)
to get v2 as c(1001,1001,1001,1002,1003,4,1001,10,1003) ?
I'm using myself a function based on match() since
long ago (I think that thanks to advice by Prof. B. Ripley),
but would like to know if there
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
2008 Sep 12
2
Greyed text in the background of a plot
Hi!
Is there any way of having a greyed ("ghosted") text
(i.e, 2006) in the background of a plot?
I'm making a dynamic plot and would like to show the
year of each time step as a big greyed text in the background.
(the idea comes from Hans Rosling video:
http://video.google.com/videoplay?docid=4237353244338529080&sourceid=searchfeed
)
Thanks
Agus
--
Dr. Agustin Lobo
Institut
2008 May 19
2
Log or diary file
Hi!
Is it possible to set a file to which both
commands and output would get automatically
saved? I've tried with sink(), but only get
the output. I mean something
like a combined history and sink, as you
get with File/Save to File.. in the windows
GUI.
Tis is done with diary filename in Matlab,
and you can state diary on and
diary off to control what is being saved to
the file.
Thanks
Agus
2011 Sep 16
1
cutree() and rect.hclust(): different labelling of classes
I've found that while cutree() and rect.hclust() make the same classes
for a given height in the dendrogram, the actual labeling of the classes
is different. For example, both produce the same 4 classes but
class 1 according to cutree() is class 4 according to rect.hclust().
Would it be possible that future versions provide the same labeling?
rect.hclust() is useful to display the classes