Skip to content
Prev 325620 / 398503 Next

Elementary Help

HI,
Probably, this is the case.? It is better to provide a reproducible example data as mentioned in the posting guide.
set.seed(24)
dat1<- data.frame(ID=c(1:3,5:8,10:14),value=sample(1:40,12,replace=TRUE))
?IDs<- 1:14? #the possible ID list
setdiff(IDs,dat1$ID)
#[1] 4 9
length(setdiff(IDs,dat1$ID))
#[1] 2
A.K.

Hi, Unfortunately somehow it won't help. The unused values are not NA, 
the unused values are simply not there. Since these are student Ids, for
 instance there is no 4,8,9 etc... I need to find out which of these are
 not there. 



----- Original Message -----
From: arun <smartpink111 at yahoo.com>
To: R help <r-help at r-project.org>
Cc: 
Sent: Tuesday, June 18, 2013 10:32 AM
Subject: Re: Elementary Help

Hi,
May be this helps:
set.seed(24)
dat1<- data.frame(ID=1:200,value=sample(c(5:200,NA),200,replace=TRUE))
?which(is.na(dat1$value))
#[1]? 56 146 184
sum(which(is.na(dat1$value)))? #Not clear about the 2nd part of the question
#[1] 386

?sum(is.na(dat1$value))
#[1] 3
table(is.na(dat1$value))
#FALSE? TRUE 
#? 197???? 3 
A.K.
easy for most of you. I have a range of values in a column ranging from 5 to 200. >Some of the values are missing, that is, not all student 
numbers are there. How do I find which are these missing numbers and 
obtain the sum of >these integers?