Displaying 20 results from an estimated 600 matches similar to: "Please help with legend command"
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
2009 Nov 09
2
Complicated For Loop (to me)
Hello,
I'm trying to run a loop that 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){
2007 Oct 28
1
tree problem
I am trying to use tree to partition 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
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
2007 Feb 22
2
question about boxplot
Here is a question from an old guy:
I want to use the boxplot function as follows:
boxplot( p.prop ~ R + bins )
This command makes nice boxplot for the factor "R" crossed with the factor "bins".
I am having alot of trouble getting control of the labels on the X axis. I want to control it more by specifying what the labels are, controling the 'size' of those
2009 Apr 03
1
US county map question
Hi R-help:
I'm just an old guy and new to this list... But have been using R for
years now.
I want to make a map of counties in the US with shaded colors that
depend on the level of variable "Y" that I want to map.
I have the US county and state fips codes and the Y variable.
How do I do this?
Please reply to pzs6@cdc.gov
Thanks,
Phil Smith
pzs6@cdc.gov
[[alternative HTML
2007 Aug 23
1
state map question
Hi R-Help:
I want to produce a map of the US with different colors for selected
states.
I installed the map package, and then used:
library(maps)
I can see that by using
map( 'state' )
you get the state boundaries, also.
How do I fill in different colors for the different states? I see there
is a col parameter for map, but can't see how to get it to work!
Please reply
2011 Jun 27
1
Recoding several variables into one use the most recent data
Hi,
I have the following data management issue. I am trying to combine multiple
years of ethnicity data into one variable called ethnic. The data looks
similar to the following
id ethnic07 ethnic08 ethnic09 ethnic10
1 1 1 1 1
2 1 1 2 2
3 3 4 4
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
2010 Jul 02
1
help with the xtable package
HI, Dear R community,
I am using the xtable to create the table, but how can I see the table?
The following is the codes I used:
> data(tli)
> tli.table <- xtable(tli[1:10, ])
> digits(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
&
2012 Nov 26
1
Plotting an adjusted kaplan-meier curve
Dear R-users
I am trying to make an adjusted Kaplan-Meier curve (using the Survival package) but I am having difficulty with
plotting it so that the plot only shows the curves for the adjusted results.
My data come from a randomised controlled trial, and I would like the adjusted Kaplan-Meier
curve to only show two curves for the adjusted survival: one for those on treatment (Treatment==1)
2017 Jul 09
2
Help with ftable.svyby
Hi all,
When I try the following with pkg Survey it returns the error 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
2012 Nov 26
1
Plotting an adjusted survival curve
First a statistical issue: The survfit routine will produce predicted survival curves for
any requested combination of the covariates in the original model. This is not the same
thing as an "adjusted" survival curve. Confusion on this is prevalent, however. True
adjustment requires a population average over the confounding factors and is closely
related to the standardized
2009 Oct 31
1
Help me improving my code
Hi,
I am new to R. My problem is with the ordered logistic model. Here is my
question:
Generate an order discrete variable using the variable
wrwage1 = wages in first full calendar quarter after benefit application
in the following way:
*
wage*1*Ordered *=
1 *if*0 *· wrwage*1 *< *1000
2 *if*1000 *· wrwage*1 *< *2000
3 *if*2000 *· wrwage*1 *< *3000
4 *if*3000 *· wrwage*1 *<
2010 Mar 25
3
Returning Data Frame from Function for use Outside Function
I have a function (see below) that does some bootstrapping (I am happy to
expand offline why I could use existing functions.) I put my results into
and empty matrix and add a row of results with each iteration. My problem is
i am a new user to R and I don't understand data frames, matrices, elements,
and vectors well. What I would like is to have a data frame I can manipulate
outside of the
2009 Jun 04
4
Binning or grouping data
Newbie here. Many apologies in advance for using the incorrect lingo. I'm
new to statistics and VERY new to R.
I'm attempting to "group" or "bin" data together in order to analyze them as
a combined group rather than as discrete set. I'll provide a simple example
of the data for illustrative purposes.
Patient ID | Charges | Age | Race
1 |
2007 Oct 27
2
Current value of object.method in helper
Hi,
I am currently working to generate selection from my validation table
where code and description pairs are stored. This works fine except
when the current value is not exist in validation table. There are
some old data which contains values that are no longer used and not in
my validation table. I do not want to add old values in my validation
table; however, I would like to display these
2017 Jul 09
0
Help with ftable.svyby
try resetting your factor levels and re-run?
q50 <- update( q50 , INCOME = factor( INCOME ) , AGECL = factor( AGECL ) ,
RACECL = factor( RACECL ) )
On Sun, Jul 9, 2017 at 2:59 PM, Orsola Costantini via R-help <
r-help at r-project.org> wrote:
> Hi all,
>
> When I try the following with pkg Survey it returns the error below:
>
> ftable(svyby(~INCOME, ~AGECL+RACECL,
2010 Jun 28
2
Lattice and Beamer
Two things I think are some of the best developments in statistics and production are the lattice package and the beamer class for presentation in Latex. One thing I have not become very good at is properly sizing my visuals to look good in a presentation.
For instance, I have the following code that creates a nice plot (sorry, cannot provide reproducible data).
2011 Jun 05
1
Negating two identical characters with regular expressions
Hello all,
Let's say I have a character string
"Race-ethnicity-----coding information"
I want to extract all text before the multiple dashes, including the word
"ethnicity."
I wrote a handy function to extract the first matched text:
grepcut <- function(pattern,x){
start.and.length <- regexpr(pattern,x)
substring(x,start.and.length,start.and.length