Convert NA into Factor Level in R Last Updated : 02 Jun, 2022 Comments Improve Suggest changes Like Article Like Report In this article, we will discuss how to convert NA into factor level with its working example in the R programming language. addNA() is the method that will convert NA into factor level. Syntax: addNA(data) where data is the factor data. Example 1: In this example, we will create factor data with 5 elements and convert NA into factor level. R data = factor(c("bhanu", "sravan", "bbby", "sravan", "bhanu")) # display print(data) # convert NA to factor level print(addNA(data)) Output: [1] bhanu sravan bbby sravan bhanu Levels: bbby bhanu sravan [1] bhanu sravan bbby sravan bhanu Levels: bbby bhanu sravan <NA> Example 2: In this example, we will create factor data with 5 elements and convert NA into factor level. R data = factor(c("bhanu", "sravan", "bbby", "sravan", "bhanu", "bhanu", "sravan", "bbby", "sravan", "bhanu")) # display print(data) # convert NA to factor level print(addNA(data)) Output: [1] bhanu sravan bbby sravan bhanu bhanu sravan bbby sravan bhanu Levels: bbby bhanu sravan [1] bhanu sravan bbby sravan bhanu bhanu sravan bbby sravan bhanu Levels: bbby bhanu sravan <NA> Comment More infoAdvertise with us Next Article How to convert factor levels to list in R ? G gottumukkala_sivanagulu Follow Improve Article Tags : R Language R Programs R-Factors R Factor-Programs Similar Reads How to convert factor levels to list in R ? In this article, we are going to discuss how to convert the factor levels to list data structure in R Programming Language. We can get the levels of the vector using factor() function Syntax: factor(vector) Return type: vector elements with levels. If we want to get only levels, Then we can use leve 2 min read How to count values per level in a factor in R In this article, we will discuss how to count the values per level in a given factor in R Programming Language. Method 1 : Using summary() method summary() method in base R is a generic function used to produce result summaries of the results of the functions computed based on the class of the argum 5 min read Get All Factor Levels of DataFrame Column in R The data frame columns in R can be factorized on the basis of its factor columns. The data frame factor columns are composed of factor levels. Factors are used to represent categorical data. Each of the factor is denoted by a level, computed in the lexicographic order of appearance of characters or 3 min read Convert dataframe to list of vectors in R In this article, we will learn how to convert a dataframe into a list of vectors, such that we can use columns of the dataframes as vectors in the R Programming language. Dataframe columns as a list of vectors as.list() function in R Language is used to convert an object to a list. These objects can 3 min read How to Reorder Factor Levels in R? In this article, we will be looking at the approach to reorder factor levels using functions in R Programming language. Using factor() function to reorder factor levels is the simplest way to reorder the levels of the factors, as here the user needs to call the factor function with the factor level 2 min read How to Convert Character to Factor in R? The as.factor() method in R Programming Language is used to convert the character vector to factor class. Converting Character Vector To Factor Syntax: as.factor(char-vec) where char-vec is the character vector The class indicative of the data type of the vector can be obtained using the class() me 2 min read Like