Arun, thanks for clearing that up. I was making assumptions about R that I
shouldnât have when it comes to column(variable) assignments. Hope everyone
has a good Monday. BNC
From: arun kirshna [via R] [mailto:ml-node+s789695n4671473...@n4.nabble.com]
Sent: Friday, July 12, 2013 11:59 PM
To:
9 5 6 112
with(dat3,7)
#[1] 7
with(dat3,`7`)
#Error in eval(expr, envir, enclos) : object '7' not found
A.K.
- Original Message -
From: bcrombie
To: r-help@r-project.org
Cc:
Sent: Friday, July 12, 2013 4:45 PM
Subject: Re: [R] create new matrix from user-defined function
AK, I decided to convert your âwithâ statement back to index-by-number, and
I did look up the ?with help info, but Iâm confused about my replacement code
below. I got the wrong answer (R didnât apply the function to my column 1
variable âA_CaseIDâ). What am I doing wrong? Do I nee
-
From: "Crombie, Burnette N" <[hidden
email]>
To: arun <[hidden email]>
Cc: R help <[hidden email]>
Sent: Thursday, July 11, 2013 4:40 PM
Subject: RE: [R] create new matrix from user-defined function
You understood me perfectly, and I agree is it easier to index usi
ombie, Burnette N"
To: arun
Cc: R help
Sent: Thursday, July 11, 2013 4:40 PM
Subject: RE: [R] create new matrix from user-defined function
You understood me perfectly, and I agree is it easier to index using numbers
than names. I'm just afraid if my dataset gets too big I'll mess up
Oh, also thanks for the speed comparisons. Missed that in my first
read-through. Very interesting and informative. BNC
-Original Message-
From: Crombie, Burnette N
Sent: Thursday, July 11, 2013 4:40 PM
To: 'arun'
Cc: R help
Subject: RE: [R] create new matrix from us
t(dtTest[D!=B+C],select=1))
# user system elapsed
# 0.508 0.000 0.477
identical(res1,res2)
#[1] TRUE
setnames(res3,"A","MW_EEsDue_ERRORS")
identical(res1,as.data.frame(res3))
#[1] TRUE
A.K.
- Original Message -
From: bcrombie
To: r-help@r-project.org
Cc:
Sent: T
Wednesday, July 10, 2013 12:19 PM
> To: [hidden email]
> Subject: [R] create new matrix from user-defined function
>
> #Let's say I have the following data set:
>
> dat3 = data.frame(A_CaseID = c(1881, 1882, 1883, 1884, 1885),
> B_MW_EEsDue1 = c(2
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of bcrombie
> Sent: Wednesday, July 10, 2013 12:19 PM
> To: r-help@r-project.org
> Subject: [R] create new matrix from user-defined function
>
> #Let
#Let's say I have the following data set:
dat3 = data.frame(A_CaseID = c(1881, 1882, 1883, 1884, 1885),
B_MW_EEsDue1 = c(2, 2, 1, 4, 6),
C_MW_EEsDue2 = c(5, 5, 4, 1, 6),
D_MW_EEsDueTotal = c(7, 9, 5, 6, 112))
dat3
# A_CaseID B_MW_EEsDue1 C_MW_E
Hi,
You could try:
mat1<-matrix(dat3[rowSums(dat3[,2:3])!=dat3[,4],1],ncol=1,dimnames=list(NULL,"MW_EEsDue_ERRORS"))
mat1
# MW_EEsDue_ERRORS
#[1,] 1882
#[2,] 1884
#[3,] 1885
A.K.
#Let's say I have the following data set:
dat3 = data.frame(A_CaseID = c(
11 matches
Mail list logo