similar to: R code for overlapping variables -- count

Displaying 20 results from an estimated 10000 matches similar to: "R code for overlapping variables -- count"

2024 Jun 02
1
R code for overlapping variables -- count
?s 18:34 de 02/06/2024, Leo Mada via R-help escreveu: > Dear Shadee, > > If you have a data.frame with the following columns: > > n = 100; # population size > x = data.frame( > ??????Sex = sample(c("M","F"), n, T), > ??????Country = sample(c("AA", "BB", "US"), n, T), > ??????Income = as.factor(sample(1:3, n, T)) > )
2024 Jun 03
1
R code for overlapping variables -- count
If they are binary (0/1 dummies), can't you just "&" them as in table(Female & USA & MidIncome) (or sum() if you don't care about the number of 0s) -pd > On 2 Jun 2024, at 00:31 , Shadee Ashtari <shadee.ashtari at gmail.com> wrote: > > Hi! > > I am trying to find the code for how to get counts for intersectional > variables. For example,
2024 Jun 01
2
R code for overlapping variables -- count
Hi! I am trying to find the code for how to get counts for intersectional variables. For example, I have three unique categorical variables -- "Female," "USA," and "MidIncome" -- and I'm trying to see how many people I have at the intersection of the three. Thank you so much, Shadee [[alternative HTML version deleted]]
2023 Oct 16
1
Create new data frame with conditional sums
If one makes the reasonable assumption that Pct is much larger than Cutoff, sorting Cutoff is the expensive part e.g O(nlog2(n) for Quicksort (n = length Cutoff). I believe looping is O(n^2). Jeff's approach using findInterval may be faster. Of course implementation details matter. -- Bert On Mon, Oct 16, 2023 at 4:41?AM Leonard Mada <leo.mada at syonic.eu> wrote: > > Dear
2023 Oct 16
1
Create new data frame with conditional sums
Dear Jason, The code could look something like: dummyData = data.frame(Tract=seq(1, 10, by=1), ?? ?Pct = c(0.05,0.03,0.01,0.12,0.21,0.04,0.07,0.09,0.06,0.03), ?? ?Totpop = c(4000,3500,4500,4100,3900,4250,5100,4700,4950,4800)) # Define the cutoffs # - allow for duplicate entries; by = 0.03; # by = 0.01; cutoffs <- seq(0, 0.20, by = by) # Create a new column with cutoffs dummyData$Cutoff
2024 Jun 02
1
Tools to modify highlighted areas in pdf documents?
? Sat, 1 Jun 2024 16:16:23 +0000 Leo Mada via R-help <r-help at r-project.org> ?????: > When highlighting pdf-documents with Microsoft Edge, the bounding box > is sometimes misplaced, and quite ugly so. It also lacks the ability > to draw lines or arrows. > > On the other hand, I did not get used to Acrobat Reader: it usually > involves much more effort to add specific
2023 Jan 12
1
return value of {....}
Dear Akshay, The best response was given by Andrew. "{...}" is not a closure. This is unusual for someone used to C-type languages. But I will try to explain some of the rationale. In the case that "{...}" was a closure, then external variables would need to be explicitly declared before the closure (in order to reuse those values): intermediate = c() { ??? intermediate
2024 Jan 30
2
Use of geometric mean for geochemical concentrations
Dear Rich, It depends how the data is generated. Although I am not an expert in ecology, I can explain it based on a biomedical example. Certain variables are generated geometrically (exponentially), e.g. MIC or Titer. MIC = Minimum Inhibitory Concentration for bacterial resistance Titer = dilution which still has an effect, e.g. serially diluting blood samples; Obviously, diluting the
2010 Sep 10
3
(no subject)
Hello, I'm trying to do bar plot where 'sex' will be the category axis and 'occupation' will represent the bars and the clusters will represent the mean 'income'. sex occupation income 1 female j 12 2 male b 34 3 male j 22 4 female j 54 5 male b 33 6
2023 Oct 21
1
Issue from R-devel: subset on table
My mistake! It does actually something else, which is incorrect. One could still use (although the code is more difficult to read): subset(tmp <- table(sample(1:10, 100, T)), tmp > 10) Sincerely, Leonard On 10/21/2023 10:26 PM, Leonard Mada wrote: > Dear List Members, > > There was recently an issue on R-devel (which I noticed only very late): >
2005 Feb 03
2
Surprising Behavior of 'tapply'
Dear all, I wanted to make a two-way-table of two variables with a counting variable stored in another column of a dataframe. In version 1.9.1, the behavior is as expected as shown in the simplified example code. > sex <- rep(c("F", "M"), 5) > income <- c(rep("low", 5), rep("high", 5)) > count <- 1:10 > mydf <-
2003 Sep 20
4
using aggregate with survey-design and survey functions
Hi R users, I am trying to use the aggregate function with a survey design object and survey functions, but get the following error. I think I am incorrectly using the syntax somehow, and it may not be possible to access variables directly by name in a survey-design object. Am I right? How do I fix this problem? I have used aggregate with "mean" and "weighted.mean", and
2007 Mar 27
3
Bridging R to OpenOffice
Dear members of the R Development Team, I am looking for people with a deep understanding of R internals to assist in bridging R to OpenOffice. While R is a state of the art statistical environment, less experienced users often find it difficult to work with R. Therefore, I believe that a bridge between R and a spreadsheet program will make this transition less painful. I sincerely believe
2008 May 04
2
Categorizing Fonts using Statistical Methods
Dear list members, Every "modern" OS comes with dozens of useless fonts, so that the current font drop-down list in most programs is overcrowded with fonts one never will use. Selecting a useful font becomes a nightmare. In an attempt to ease the selection of useful fonts, I began looking into sorting fonts using some statistical techniques. I summed my ideas on the OpenOffice.org
2012 Nov 27
1
Using factor variables with overlapping categories
ear folks ? I have a question, though it is more of a logic- or a good practices-question than a programming question per se. I am working with data from the American Community Survey summary file. It is mainly categorical count data. Currently I am working with about 40 tables covering about 35 variables, mainly in two-way tables, with some 3-way and a handful of four-way tables. I am going to
2009 Feb 09
1
How to create grouping in the residual plot
Dear all, I am working in a country level data. After running the regression, I would like to plot the residuals of each observation based on the group created for a particular variable. For example, one of my independent variable is "Income", I would like to plot the residual based on income categories (<5000, 5001-10,000, 10001-15,000 etc) with "different color" for each
2023 Mar 08
1
Default Generic function for: args(name, default = TRUE)
?.S3methods f <- function()(2) > length(.S3methods(f)) [1] 0 > length(.S3methods(print)) [1] 206 There may be better ways, but this is what came to my mind. -- Bert On Wed, Mar 8, 2023 at 11:09?AM Leonard Mada via R-help < r-help at r-project.org> wrote: > Dear R-Users, > > I want to change the args() function to return by default the arguments > of the default
2009 Feb 26
1
error message and convergence issues in fitting glmer in package lme4
I'm resending this message because I did not include a subject line in my first posting. Apologies for the inconvenience! Tanja > Hello, > > I'm trying to fit a generalized linear mixed model to estimate diabetes prevalence at US county level. To do this I'm using the glmer() function in package lme4. I can fit relatively simple models (i.e. few covariates) but when
2011 Aug 23
3
Change Variable Labels in Quantile Plot
I have spent hours on this ---looked through the quantreg manual and r-help site--- still couldn't figure out the answer. Can someone please help me on this? I plot the result from quantile regression and want to change the variable labels: temp<-rq(dep~inc+age50, data=newdata, tau=1:9/10) temp2<-plot(summary(temp)) dimnames(temp2)[[1]]<-c("Intercept", "Per Capita
2011 Aug 11
1
Subsampling data
*Dear R community* * * *I have two questions on data subsample manipulation. I am starting to use R again after a long brake and feel a bit rusty.* * * *I want to select a subsample of data for males and females separately* * * library(foreign) Datatemp <- read.spss("H:/Skjol/Data/HL/t1and2b.sav", use.value.labels = F) > table(Datatemp$sex) 1 2 3049 3702