colnames(x1)[2];x3[,c(1,7,2:6)]})
names(lst2)<- colnames(dat1)[-1]
identical(lst1,lst2)
#[1] TRUE
A.K.
____________
From: Ye Lin
To: arun
Sent: Friday, April 19, 2013 5:49 PM
Subject: Re: [R] count each answer category in each column
Hey A.K
I modified the scripts
$Rate
# Var1 Rate A B C
#1 Bad 2 0 2 0
#2 Good 2 2 0 0
#3 1 0 0 1
A.K.
____
From: Ye Lin
To: arun
Sent: Friday, April 19, 2013 1:44 PM
Subject: Re: [R] count each answer category in each column
Yes, but I am wondering if I can calculate how many ki
male 1 NA NA
#2 Male 1 NA NA
#3 0 0 0
#4 11-20 NA 2 NA
#5 Bad NA NA 2
#$C
# Var1 Gender Age Rate
#1 Male 1 NA NA
#2 0 0 1
#3 >20 NA 1 NA
A.K.
____________
From: Ye Lin
To: arun
Cc: R help
Thanks A.K
Is it possible to apply this to a more complicated situation , for example,
I have an ID column for each row, say:
ID Gender Age Rate
A Female0-10 Good
A Male0-10 Good
B Female 11-20 Bad
B Male 11-20 Bad
C Male
Thanks David! I do get confused sometimes when sth can be easily and
directly done in Excel which is what I am familiar with, but I find it
takes more time for me to operate that in R.
On Thu, Apr 18, 2013 at 4:27 PM, David Winsemius wrote:
>
> On Apr 18, 2013, at 3:46 PM, Ye Lin wrote:
>
> > He
l Message -
From: arun
To: Ye Lin
Cc: R help
Sent: Thursday, April 18, 2013 7:04 PM
Subject: Re: [R] count each answer category in each column
Hi,
Try this:
Assuming that "table" is "data.frame"
dat1<-read.table(text="
Gender Age Rate
Female 0-10 Good
M
On 04/19/2013 08:46 AM, Ye Lin wrote:
Hey,
Is it possible that R can calculate each options under each column and
return a summary table?
Suppose I have a table like this:
Gender Age Rate
Female0-10 Good
Male0-10 Good
Female 11-20 Bad
Male 11-20 Bad
Male>20
On Apr 18, 2013, at 3:46 PM, Ye Lin wrote:
> Hey,
>
> Is it possible that R can calculate each options under each column and
> return a summary table?
>
> Suppose I have a table like this:
>
> Gender Age Rate
> Female0-10 Good
> Male0-10 Good
> Female 11-20 Bad
> Male
Hi,
Try this:
Assuming that "table" is "data.frame"
dat1<-read.table(text="
Gender Age Rate
Female 0-10 Good
Male 0-10 Good
Female 11-20 Bad
Male 11-20 Bad
Male >20 N/A
",sep="",header=TRUE,stringsAsFactors=FALSE,na.strings="N/A")
lapply(seq_len(ncol(dat1)),fun
9 matches
Mail list logo