similar to: Summarizing counts by multiple factors

Displaying 20 results from an estimated 30000 matches similar to: "Summarizing counts by multiple factors"

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
2009 Aug 12
5
Nominal variables in SVM?
Hi, The answers to my previous question about nominal variables has lead me to a more important question. What is the "best practice" way to feed nominal variable to an SVM. For example: color = ("red, "blue", "green") I could translate that into an index so I wind up with color= (1,2,3) But my concern is that the SVM will now think that the values are
2012 Nov 29
7
Fast Normalize by Group
Hi, I have a very large data set (aprox. 100,000 rows.) The data comes from around 10,000 "groups" with about 10 entered per group. The values are in one column, the group ID is an integer in the second column. I want to normalize the values by group: for(g in unique(groups){ x[group==g] / sum(x[group==g]) } This works find in a loop, but is slow. Is there a faster way to do
2010 Mar 19
2
Factor variables with GAM models
I'm just starting to learn about GAM models. When using the lm function in R, any factors I have in my data set are automatically converted into a series of binomial variables. For example, if I have a data.frame with a column named color and values "red", "green", "blue". The lm function automatically replaces it with 3 variables colorred, colorgreen,
2011 Aug 23
2
dummy variables from factors
Hi, Looking at a large data set with many factors. I would like to expand each factor variable into multiple new variables for each level. (0,1) coding. My first though was just to code a big nasty loop, to take each level and cbind a column onto my data set. But, that seems painful. There must be a better way. Is there an "easy" way to do this in R? (Note, I don't want to
2010 May 15
3
Discretize factors?
Hi, I'm looking for an easy way to discretize factors in R I've noticed that the lm function does this automatically with a nice result. If I have group <- c("A", "B","B","C","C","C") and run: lm(result ~ x1 + group) The lm function has split the group into separate binary variables {0,1} before performing the
2013 Mar 19
1
RGL 3D plots are flat. Please Help
Hello, I have a matrix of simulated data that I want to plot as a 3D surface using RGL. Have followed the documentation carefully, but my plot only contains a weird "single slice" of the data. The actual RGL library and dependance seem fine as all of the demo code plots beautifully. The actual command I'm using is: rgl.surface(x,z,d,
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
2011 May 27
1
How to convert an ftable object to a matrix including the row names?
Dear expeRts, What's the easiest way to convert an ftable object to a matrix such that the row names of the ftable object are shown in the first couple of columns of the matrix? This is (typically) required, for example, when the final goal is to print the matrix via xtable. Below is a rather complicated example of how to do it... Cheers, Marius ## Goal: convert an ftable() to a
2007 Jan 18
4
Reading contingency tables
I am trying to read an ftable using read.ftable, but I get the following error message: > jobSatTable <- read.ftable("http://definetti.uark.edu/~gpetris/stat5333/jobSatisfaction.dat",skip=2) Error in seek(file, where = 0) : no applicable method for "seek" In addition: Warning messages: 1: no non-missing arguments to max; returning -Inf 2: no non-missing arguments to
2007 Dec 16
4
improving a bar graph
Hello, Below is the code for a basic bar graph. I was seeking advice regarding the following: (a) For each time period there are values from 16 people. How I can change the colour value so that each person has a different colour, which recurs across each of the three graphs/tie epriods? (b) I have seen much more sophisticated examples using lattice (e.g each person has a separate
2011 Mar 31
3
Create Variable names dynamically
Hi, I want to create variable names from within my code, but can't find any documentation for this. An example is probably the best way to illustrate. I am reading data in from a file, doing a bunch of stuff, and want to generate variables with my output. (I could make a "list of lists" and name all the elements, but I really want separate variables.) ################# #This is
2012 Jun 11
3
Decision Trees or Markov Models for Cost Effectiveness
Hello, I was just assigned to perform a cost effectiveness study in healthcare. We are studying the cost effectiveness of a proposed diagnostic vs. current screening procedures. One of the team members suggest a commercial software package called "TreeAge Pro". Looking at the description, it appears to be a nice GUI to some very simple models that could be easily constructed in R.
2012 Oct 14
4
Date Math
Hello, I have a time series object (xts) that I iterate over in a loop. Works fine. My challenge is that I want to be able to reference other entries in the series by math. i.e. For today's observation, what were the last 5 observations? If indexed numerically, it is trivial, but I can figure out how to do this with dates. This is slightly more difficult as there may not be an
2012 Oct 09
4
Convert COLON separated format
I have a bunch of data sets that were created for the libsvm tool. They are in "colon separated sparse format". i.e. 1 5:1 27:3 345:10 Is a row with the label of "1" and only has values in columns 5, 27, and 345. I want to read these into a data.frame in R. Is there a simple way to do this? -- Noah Silverman, M.S. UCLA Department of Statistics 8117 Math Sciences
2012 May 18
4
Menus - best practices?
Hello, I need to design a fairly simple front-end for someone to use an R script system that I've built. My thought was to just use the text based menus available in the base R package, perhaps in some kind of loop. How have other people done this? Any "best practices" that you can recommend? Thanks! -- Noah Silverman UCLA Department of Statistics 8117 Math Sciences Building
2009 Sep 11
4
R on Multi Core
Hi, Our discussions about 64 bit R has led me to another thought. I have a nice dual core 3.0 chip inside my Linux Box (Running Fedora 11.) Is there a version of R that would take advantage of BOTH cores?? (Watching my system performance meter now is interesting, Running R will hold a single core at 100% perfectly, but the other core sites idle.) Thanks! -- Noah
2009 Aug 05
1
Question with apply function
In my continuing quest to generate some summary data, I've come across some useful suggestions in pasts posts. The apply operation returns an error, and I can't figure out why. Can someone help me fix this? testlogdata <- cbind(testlogdata, range_group=cut(testlogdata$lrm_score, breaks=c(.9, .8, .7, .6, .5, .4, .3, .2, .1))) apply(testlogdata, 2, function(x){tapply(x,
2011 Oct 16
2
Use of ICA for sound
Hi, I'm looking at the "cocktail party" classic problem. I can see how to use ICA to separate the components. But, How do I then create new wav files of the separated sounds so that they can be played? Thanks -- Noah Silverman UCLA Department of Statistics 8208 Math Sciences Building Los Angeles, CA 90095 [[alternative HTML version deleted]]