similar to: Crosstab with Average and Count

Displaying 20 results from an estimated 5000 matches similar to: "Crosstab with Average and Count"

2006 Dec 30
1
Crosstab from sql dump
Hello all,, Im looking for a simple function to produce a crosstab from a dumped sql query result. Its very hard to produce crosstabs with most databases (Access being the exception), so with the vast array of R packages, Im sure this has to have already been implemented somewhere. Examples are always good: Take a csv dump like name code user1 100 user2 100 user1 200 user2 210 user1 300 user2
2012 Jul 09
4
Skipping lines and incomplete rows
I have a text file that has semi-colon separated values. The table is nearly 10,000 by 585. The files looks as follows: ******************************************* First line: Skip this line Second line: skip this line Third line: skip this line variable1 Variable2 Variable3 Variable4 Unit1 Unit2 Unit3 10 0.1 0.01 0.001 20
2018 May 08
3
Bilateral matrix
or in base R : ?xtabs ?? as in: xtabs(~previous_location + current_location,data=x) (You can convert the 0s to NA's if you like) Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Tue, May 8, 2018 at 9:21 AM, Huzefa
2012 Dec 03
2
Excluding all missing values with dcast ("reshape2" package)
Hello--I'm doing a simple crosstab using dcast: rawfreq <- dcast(nh11brfs, race3~CHCCOPD, length) with the results race3 Yes No NA 1 White non-Hispanic 446 5473 21 2 Other non-Hispanic 29 211 0 3 Hispanic 6 81 1 4 <NA> 10 83 1 How would I modify this call to exclude all missing values; that is, to obtain race3
2013 Dec 15
1
Rows to Column
Hi all, I'm kinda new in R programming and I need some help preparing a database to run logistic regression. I have data in a tuple form: *id cat val* 1 A 2 1 C 4 3 B 1 5 A 2 6 A 3 6 B 5 6 C 2 8 B 5 8 D 2 9 D 3 and would like to have it like: *id catA catB catC catD* 1 2 0 4 0 3 0 1 0 0 5 2 0 0 0 6 3
2009 Apr 24
4
omit empty cells in crosstab?
Perhaps this is a common question but I haven't been able to find the answer. I have data with many factors, each taking many values. However, only relatively few combinations appear in the data, ie have nonzero counts, in other words the resulting table is sparse. Say we have 10 factors each with 10 levels. The result of table() would exceed the memory space (on a 32bit machine). Is there
2018 May 16
0
Bilateral matrix
Dear Bert and Huzefa, Apologies for the late reply, my account got hacked and I have just managed to recover it. Thank you very much for your replies and the solutions. Both work well. I was wondering if there was any way to ensure (force) that all possible combinations show up in the output. The full dataset has 25 cities but of course people have not moved from Boston to all the other 24
2008 Apr 03
1
newbie subset question
I want to look at all the records making up a "row and column" of a crosstab, but I'm not getting it right. I'm trying to use subset() but my selection ((prod_act=="other") || (attr_act=="other")) gives my no records. See the second table below. Getting just the row does work, as seen in the third table. Why is this failing me? > .Table <-
2013 Jan 28
2
Pivot
Hi, I have a data set as follow: X         Z x1        102 x2        102 x2        102 x2        77 x3        23   I need to pivot this data as follows and assign the values based on frequency of column Z: X       Z.102   Z.77 Z.23 x1          1        0        0 x2          21  0 x3         00  1 Thanks. Best,Farnoosh Sheikhi [[alternative HTML version deleted]]
2012 Dec 18
7
Summarizing elements for a data.frame
Hello again, let say we have following data: Dat1 <- structure(list(factor.sample.LETTERS.1.3...6..replace...T.. = structure(c(1L, 3L, 2L, 1L, 3L, 3L), .Label = c("A", "B", "C"), class = "factor"), factor.sample.letters.1.2...6..replace...T.. = structure(c(2L, 2L, 1L, 1L, 2L, 1L), .Label = c("a", "b"), class =
2012 Sep 16
5
Count based on 2 conditions [Beginner Question]
Hello, I'm working with a dataset that has 2 columns and 1000 entries. Column 1 has either value 0 or 1, column 2 has values between 0 and 10. I would like to count how often Column 1 has the value 1, while Column 2 has a value greater 5. This is my attempt, which works but doesn't seem to be very efficient, especially when testing different values or columns. count=0 for (i in 1:1000) {
2018 May 16
2
Bilateral matrix
xtabs does this automatically if your cross classifying variables are factors with levels all the cities (sorted, if you like): > x <- sample(letters[1:5],8, rep=TRUE) > y <- sample(letters[1:5],8,rep=TRUE) > xtabs(~ x + y) y x c d e a 1 0 0 b 0 0 1 c 1 0 0 d 1 1 1 e 1 1 0 > lvls <- sort(union(x,y)) > x <- factor(x, levels = lvls) > y <-
2005 Aug 30
2
crosstab for n-way contingency tables
Dear list. New to R, I'm looking for a way of using crosstab to output low-dimensional (higher than 2) contingency tables (frequencies, per-cents by rows, % by columns, mean, quantiles....) I'm looking for something of the following sort dataframe: singers, categorical variates: voice category (soprano,mezzo-soprano, ...) , voice type( drammatic, spinto, lirico-spinto, lirico,
2018 May 08
2
Bilateral matrix
I have data on current and previous location of individuals. I would like to have a matrix with bilateral movement between locations. I would like the final output to look like the second table below. I have tried using crosstab() from the ecodist but I do not have another variable to measure the flow. Ultimately I would like to compute the probability of movement between cities (movement to
2005 Mar 22
1
List of tables rather than an extra dimension in the table or (l)apply(xtabs)
I'm not sure how to best explain what I am after but here goes. I have a data frame with 2 geographical factors. One is the major region the other is the component regions. I am trying to process all the regions at the same time without using "for". So I need (think, I do) a list of matrices each structured according to the number of subregions within each region. So is there a
2018 May 08
0
Bilateral matrix
Dear Miluji, If I understand correctly, this should get you what you need. temp1 <- structure(list(id = 101:115, current_location = structure(c(2L, 8L, 8L, 3L, 6L, 5L, 1L, 2L, 7L, 4L, 2L, 8L, 8L, 3L, 6L), .Label = c("Austin", "Boston", "Cambridge", "Durham", "Houston", "Lynn", "New Orleans", "New York"), class =
2009 Feb 07
3
Re-post data format question (apologies)
Hello all, I have a *.csv file that looks like this (actual file is orders of magnitude larger): Site taxa no.ind forest LMA 1 forest LCY 1 forest SCO 1 meadow LMA 2 meadow LCY 1 meadow PNT
2000 Oct 24
2
Crosstabs function
Is there a crosstabs function like the one found in S-Plus available in any of the R addon packages? I can't seem to locate anything other than the chisq.test, which is adequate but does not yield the output customarily required with any journal submission (in my field). (S-Plus, SPSS, SAS all provide examples of the required output). If there isn't such a function already
2018 May 17
0
Bilateral matrix
Dear William and Ben, Thank you for your replies and elegant solutions. I am having trouble with the fact that two of the previous locations do not appear in current locations (that is no one moved to OKC and Dallas from other cities), so these two cities are not being included in the output. I have provided a better sample of the data and the ideal output (wide form - a 10x10 bilateral matrix)
2007 Feb 22
4
Crosstabbing multiple response data
Using R version 2.4.1 (2006-12-18) on Windows, I have a dataset which resembles this: id att1 att2 att3 1 1 1 0 2 1 0 0 3 0 1 1 4 1 1 1 ratings <- data.frame(id = c(1,2,3,4), att1 = c(1,1,0,1), att2 = c(1,0,0,1), att3 = c(0,1,1,1)) I would like to get a cross tab of counts of co-ocurrence, which might resemble this: