You need the is.na() function:
> dataset <- data.frame(No = 1:4, Name = c("Smith", "Mayor", "Miller",
> "Baltic"), Turnover = c(1500, 200, NA, 750))
> dataset
No Name Turnover
1 1 Smith 1500
2 2 Mayor 200
3 3 Miller NA
4 4 Baltic 750
[1] TRUE TRUE FALSE TRUE
>
Dear All,
I am new to "R" and search for a solution to exclude cases if a certain
variable contains NA for a case.
Example
No Name Turnover
1 Smith 1500
2 Mayor 200
3 Miller
4 Batic 750
I would like to create a subset excluding case 3 Miller NA.
I tried to following:
new_dataset <-
use the 'is.na' function:
new_dataset <- subset(dataset, subset = !is.na(Turnover))
Jim Holtman
Data Munger Guru
What is the problem that you are trying to solve?
Tell me what you want to do, not how you want to do it.
On Thu, Dec 17, 2015 at 7:50 AM, wrote:
> Dear
On Thu, Dec 17, 2015 at 01:50:29PM +0100, g.maub...@weinwolf.de wrote:
> Dear All,
>
> I am new to "R" and search for a solution to exclude cases if a certain
> variable contains NA for a case.
> ...
> I would like to create a subset excluding case 3 Miller NA.
>
> I tried to following:
>
>
4 matches
Mail list logo