Assigning values to variables in R programming - assign() Function Last Updated : 12 Jul, 2025 Comments Improve Suggest changes Like Article Like Report In R programming, assign() method is used to assign the value to a variable in an environment. Syntax : assign(variable, value) Return : Return the variable having value assigned. Example 1: Python3 # Using assign() method assign("gfg", 10) print(gfg) Output: [1] 10 Example 2: Python3 # Using assign() method assign("gfg", 20.12345) print(gfg) Output: [1] 20.12345 Comment More infoAdvertise with us Next Article Assigning Vectors in R Programming J jitender_1998 Follow Improve Article Tags : R Language R-Variables Similar Reads Assigning Vectors in R Programming Vectors are one of the most basic data structure in R. They contain data of same type. Vectors in R is equivalent to arrays in other programming languages. In R, array is a vector of one or more dimensions and every single object created is stored in the form of a vector. The members of a vector are 5 min read R Variables - Creating, Naming and Using Variables in R A variable is a memory location reserved for storing data, and the name assigned to it is used to access and manipulate the stored data. The variable name is an identifier for the allocated memory block, which can hold values of various data types during the programâs execution.In R, variables are d 5 min read R Variables - Creating, Naming and Using Variables in R A variable is a memory location reserved for storing data, and the name assigned to it is used to access and manipulate the stored data. The variable name is an identifier for the allocated memory block, which can hold values of various data types during the programâs execution.In R, variables are d 5 min read Applying a Function over an Object in R Programming - sapply() Function sapply() function in R Language takes list, vector or data frame as input and gives output in vector or matrix. It is useful for operations on list objects and returns a list object of same length of original set. Syntax: sapply(X, FUN) Parameters: X: A vector or an object FUN: Function applied to e 1 min read 8 Coding Style Tips for R Programming R is an open-source programming language that is widely used as a statistical software and data analysis tool. R generally comes with the Command-line interface. R is available across widely used platforms like Windows, Linux, and macOS. Also, the R programming language is the latest cutting-edge to 5 min read Functions in R Programming A function accepts input arguments and produces the output by executing valid R commands that are inside the function. Functions are useful when we want to perform a certain task multiple times.In R Programming Language when we are creating a function the function name and the file in which we are c 5 min read Like