Displaying 20 results from an estimated 42 matches for "hispanic".
2008 Jan 07
1
recode() function results in logical output, not factor output
Dear R Users:
I have race-ethnicity groups identified in the factor variable Ethnic_G.
I need to collapse Ethnic_G into a new variable with only two factors, 1 (White, non-Hispanic) and 2 (Minority).
As seen in the code and output below, the recoded race-ethnicity variable is put into logical format, not factor format.
I've used library(car) and the package was updated.
Any ideas on how to fix this problem would be apprecidated.
Thanks in advance!
Best wishes....
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 Yes No
1 White non-Hispanic 446 5473
2 Other non-Hispanic 29 211
3...
2018 Oct 16
2
Comprobar los nombres de columnas entre varios dataframes
Buenas tardes,
Quiero aplicar la función rbind y necesito tener los mismos nombres de
columnas. Como tengo unas 195 variables en cada dataframe, necesito
hacerlo de una forma rápida. Tengo 9 bases de datos y tengo que fusionar
todas. ¿Como puedo comprobar que los nombres de las variables son los
mismos? Y de lo contrario, ¿como detecto las diferencias?
He probado con
2010 Jul 02
1
help with the xtable package
...tli.table)[c(2, 6)] <- 0
> print(tli.table, floating = FALSE)
% latex table generated in R 2.11.0 by xtable 1.5-6 package
% Thu Jul 1 20:43:43 2010
\begin{tabular}{rrlllr}
\hline
& grade & sex & disadvg & ethnicty & tlimth \\
\hline
1 & 6 & M & YES & HISPANIC & 43 \\
2 & 7 & M & NO & BLACK & 88 \\
3 & 5 & F & YES & HISPANIC & 34 \\
4 & 3 & M & YES & HISPANIC & 65 \\
5 & 8 & M & YES & WHITE & 75 \\
6 & 5 & M & NO & BLACK & 74 \\
7 & 8 &...
2009 Jun 04
4
Binning or grouping data
...p rather than as discrete set. I'll provide a simple example
of the data for illustrative purposes.
Patient ID | Charges | Age | Race
1 | 100 | 0 | Black
2 | 500 | 3 | White
3 | 200 | 5 | Hispanic
4 | 90 | 7 | Asian
5 | 400 | 10 | Hispanic
6 | 500 | 16 | Black
I'm trying to create three age categories--"0 to 4", "5 to 11" and "12 to
17"--and analyze their "...
2017 Jul 09
2
Help with ftable.svyby
...rror 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 hispanic"))
Error in rbind(matrix("", nrow = length(xcv), ncol = length(xrv)),
charQuote(makeNames(xrv)), :
number of columns of matrices must match (see arg 3)
When I do the follwing instead all is good. But it only works for small
subsets!
h<-svym...
2010 Mar 25
3
Returning Data Frame from Function for use Outside Function
..."14", "15", "16",
"17", "18", "19",
"20", "21", "22",
"23"), first=TRUE)
#f <- mpr100 ~ time + nhb + hispanic + other +
# rural + hrural +
# factor(age) + factor(gender) + factor(mstat) +
factor(svcpct2) + nvaclass +
# a1cgrp8 + anemdef + cbd + chf + chrnlung + htn_c +
# hypothy + obese + perivasc + pulmcirc + tumo...
2009 Oct 31
1
Help me improving my code
...lt; *1000
2 *if*1000 *· wrwage*1 *< *2000
3 *if*2000 *· wrwage*1 *< *3000
4 *if*3000 *· wrwage*1 *< *4000
5 *ifwrwage*1 *¸ *4000.
Estimate an order logit model using the new created discrete variable as the
dependent variable with the following control variables:
black = 1 if black
hispanic = 1 if hispanic
otherrace = 1 if black = 0 and hispanic = 0
female = 1 if female
wba = claimant's UI weekly bene¯t amount (*=week*)
age = age of claimant when claim is ¯led (years)
bp1000 = base period wages (thousand $)
inuidur1 = duration of unemployment (weeks)
I have written the prog...
2007 Jul 03
1
Please help with legend command
Hi R-ers:
I'm drawing a plot and have used different line types (lty) for
different race/ethnicity groups. I want a legend that explains what line
types correspond to the different race/ethnicity groups. I used the
following code:
legend( 1992 , 42 , c("Hispanic" , "non-Hispanic white (NHW)" ,
"non-Hispanic black" , "AI/AN" , "Asian" ) , lty=1:5 ,cex = .6 , bty='n'
)
Guess what? The legend "box" was so narrow that the line types that show
up in that legend box look essentially the same, becaus...
2017 Jul 09
0
Help with ftable.svyby
...able(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 hispanic"))
>
> Error in rbind(matrix("", nrow = length(xcv), ncol = length(xrv)),
> charQuote(makeNames(xrv)), :
> number of columns of matrices must match (see arg 3)
>
> When I do the follwing instead all is good. But it only works fo...
2007 Oct 28
1
tree problem
...n a data set. The data set has 3924
observations. Partitioning seems to work for small subsets of the data,
but when I use the entire data set, no partitioning occurs. The
variables are:
RESP respondent to a survey (0 = not a respondent, 1 =
respondent)
AGE_P Age (continuous)
ORIGIN_I Hispanic Ethnicity (1 = Hispanic, 2 = non-Hispanic)
RACRECI2 Race Recode (1 = White, 2 = Black, 3 = Other)
parents Parent(s) present in the family (1 = Yes, 2 = No)
educ Education Recode (1 = HS, GED, or less, 5 = some college, 6 =
Bachelor's or AA degree, 9 = Master's & higher
Here are 2 c...
2009 Nov 09
2
Complicated For Loop (to me)
...will subset my data into specific sets by
regions and by race/ethnicity. I'm trying to do this fairly compactly, and
I cannot get this to work.
A "simple" version of the code that I am trying to run is:
names <- c("white", "black", "asian", "hispanic")
for(j in names){
for(i in 1:9){
names.cd[i].es.wash <- 1
es.cd[i].names.w <- names.cd[i].es.wash +1
} ; }
I want the loop to create these variables so that I would have for example:
"white.cd1.es.wash" through "white.cd9.wash" and then the same for black,
hispanic...
2009 Oct 02
3
Tabulating using arbitrary numbers of factors
Dear R-help,
First of all, thank you VERY much for any help you have time to offer. I
greatly appreciate it.
I would like to write a function that, given an arbitrary number of factors
from a data frame, tabulates the number of occurrences of each unique
combination of the factors. Cleary, this works:
> table(horse,date,surface)
<SNIP>
, , surface = TURF
2008 Sep 23
3
odds ratio: how to create reference
...obabilities, say
estimated by a logit model. i know i can also state them as an odds
ratio.
Now i?d like to state these odds ratios as a reference to a specific
outcome of my investigated variable.
for example, if my covariate of interest is race and possible outcomes
are white, black and hispanic, whereas the latter are minorities in my
case - how can i state the odds ratio in such a way that white is the
reference (always 1) and other races' odds ratio are relative to the
reference. e.g. hispanics are 1.5 times more likely to ...
Is creating 3 binary dummies for race the right w...
2010 Mar 25
0
Counting a number of "elements" in an object
I apologize if this has been answered. I have researched this to the best of
my ability, that's not to say the answer isn't in the archives just I am a
new user and I don't know the proper terms to search under.
I have an object:
f <- mpr100 ~ time + nhb + hispanic + other +
rural + hrural +
factor(age) + factor(gender) + factor(mstat) +
factor(svcpct2) + nvaclass +
a1cgrp8 + anemdef + cbd + chf + chrnlung + htn_c +
hypothy + obese + perivasc + pulmcirc + tumor +...
2010 Dec 21
0
"variable lengths differ (found for '(weights)')" error in Zelig library
Dear R users,
I am trying to estimate to estimate the average treatmen effect on the
treated (ATT) using first the MatchIt software to weight the data set and,
after this, the Zelig software as shown in Ho et al. (2007). See here for an
explanation of how to apply this technique in R:
http://imai.princeton.edu/research/files/matchit.pdf
I encounter a slight problem when I apply the weights that
2011 Jan 25
0
Problem with matchit() and zelig()
Dear all,
Does anybody know why the following code returns an error message?
>library(MatchIt)
>library(Zelig)
>data(lalonde)
>
>m.out1<-matchit(treat~age+educ+black+hispan+nodegree+married
+re74+re75, method="full", data=lalonde)
>
>z.out1<-zelig(re78~age+educ+black+hispan+nodegree+married+re74+re75,
data=match.data(m.out1, "control"),
2011 Jun 26
2
how to extract data from a function printout - example provided
Hi there,
Does anyone know how to extract data from a function that prints out two or more summaries? In the function below (the whole code is provided) we get 5 different tables of data. I would like to split each of these tables in a separate file (while the function itself shouldn't be changed), so that further analysis on each data set could be carried out. Your help is deeply
2010 Oct 02
3
Non-Parametric Adventures in R
...barplot so that's great
-----------------------------------------------------------------------------------------------------
3) I was able to code my data so it shows up in tables better with
X$race <- factor(X$race, levels = c(0,2), labels = c("African
American","White,Non-Hispanic"))
----------------------------------------------------------------------------------------------------
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
--------------------------------------------------...
2011 Feb 01
1
dotchart {graphics} 2.11.1 vs. 2.12.1
I have a factor vector of subject races (Asian, Black, Hispanic, White; n=30) that I want to plot with a Cleveland dotplot or dotchart.
I tried the following in R2.12.1 :
> dotchart(table(school$Race))
Error in plot.xy(xy.coords(x, y), type = type, ...) : invalid plot type
Using the same data set in R2.11.1 the operation succeeded (I tried several variat...