this is the problem:
load this R data frame over the internet and save it to your hard drive.
http://rss.acs.unt.edu/Rdoc/library/twang/data/raceproling.RData

please show how to save a dataset of males only (the variable male=1) to a new 
dataframe. Then do the same thing for females (male=0). Then show how to 
recombine the two datasets to belike the original one except that the female 
observations come rst, then the male observations. This resultingdataset 
should be the same size as the original.
this is what i did so far:
# loading the R data frame over the internet
and saving it to your hard drive

 

>rp<-url("http://rss.acs.unt.edu/Rdoc/library/twang/data/raceprofiling.RData";)

 

>load(rp)

 

>str(raceprofiling)

 

#this shows that in the RData file there are
5000 obs. of 10 variables.

 

# For
the fourth dataset, please show how to save a dataset of males only (the
variable male=1)

#to a new #data frame.

 

>attach(raceprofiling)

 

>s<-male[male==1]

 

>news<-data.frame(s)

 

#The same thing for females (male=0). 

 

>r<-male[male==0]

 

>newr<-data.frame(r)

now to merge:
I tried >merge(newr,news)
but this does not give the same observation as the original file. I also tried 
rbind, but this gives me error. Please help                                     
   
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to