Convert an Integer to a Binary value in R Programming – as.binary() Function Last Updated : 16 Jun, 2020 Improve Improve Like Article Like Save Share Report as.binary() function in R Language is used to convert an integer value to a binary value. Syntax: as.binary(x) Parameters: x: Integer value Example 1: # R Program to convert # an integer to binary # Loading library library(binaryLogic) # Calling as.binary() function as.binary(1) as.binary(10) as.binary(-1) as.binary(0xAB) Output: [1] 1 [1] 1 0 1 0 [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [1] 1 0 1 0 1 0 1 1 Example 2: # R Program to convert # an integer to binary # Loading library library(binaryLogic) # Creating a vector x1 <- c(1, 10, -1, 2, 5) # Calling as.binary() function as.binary(x1) Output: [[1]] [1] 1 [[2]] [1] 1 0 1 0 [[3]] [1] 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 [[4]] [1] 1 0 [[5]] [1] 1 0 1 Like Article Suggest improvement Previous Calculate the Root of a Equation within an interval in R Programming - uniroot() Function Next Check if an Object is of Type Numeric in R Programming - is.numeric() Function Share your thoughts in the comments Add Your Comment Please Login to comment...