Functions in R - English
- subtitles off
- captions off
- English
- Questions posted on Forums
- R Tutorials - English
-
Create Fibonacci series
How to create a fibonacci series using FUNCTION?
12-13M 50-60S harshal1999
Answer last updated on: Oct. 2, 2023, 10:08 p.m.
-
related print options
How to print series in a line like 1, 2, 3, 4, 5, 6 instead of 123456
02-03M 20-30S ritumeena_Akapoor
Answer last updated on: Sept. 6, 2021, 3:38 p.m.
-
related print options
How to print series in a line like 1, 2, 3, 4, 5, 6 instead of 123456
02-03M 20-30S ritumeena_Akapoor
Answer last updated on: Sept. 6, 2021, 3:38 p.m.
-
how i make function fibonacci (assignment's Q2)
Create a function which takes a natural number as an argument, and prints Fibonacci series. For example, consider fibonacci(5). It should print the first 5 elements of Fibonacci series, i.e. 1, 1, 2, 3, 5??????
09-10M 20-30S tanishagoyal
Answer last updated on: Aug. 31, 2021, 6:26 p.m.
-
assignment on fibbonacci series
on giving the following input fibbonacci <- function(t1,t2,t3...........tn){ tn <- 0 t1=0 t2=1 t3=t1+t2 for(n in t1:tn){ t(n)=t(n-2)+t(n-1) } return(tn)}fibbonacci(t1,t2,t3.........tn)the following comments appear-fibbonacci <- function(t1,t2,t3...........tn){+ tn <- 0+ t1=0+ t2=1+ t3=t1+t2+ for(n in t1:tn){+ t(n)=t(n-2)+t(n-1)+ }+ return(tn)+ }> fibbonacci(t1,t2,t3.........tn)Error in t(n) <- t(n - 2) + t(n - 1) : could not find function "t<-">
11-12M 20-30S Joohi
Answer last updated on: Dec. 17, 2020, 11:52 p.m.
-
fibonacci series correct or not
fibonacci <- function(num1,num2){result <- num1+num2for(i in 1){result <- c(num1,num2,result,result+i,result+result+i)}return(result)}fibonacci(1,1)Sir I am getting the result 1,1,2,3,5from the above functionis it correct
11-12M 10-20S manishakdey@gmail.com
Answer last updated on: July 5, 2020, 12:11 a.m.
-
Doubt in functtion
n <- as.integer(readline("enter the number "))fibonacci <- function(n) { num1 <-0 num2<-1 for( i in 1:n){ print(num2) num3 <-num2 +num1 num1 <-num2 num2 <-num3 } }fibonacci() output is:Error in fibonacci() : argument "n" is missing, with no default
08-09M 0-10S archana.naware@gmail.com
Answer last updated on: May 12, 2020, 4:24 p.m.
-
functions
fib <- function(n){fib[0] <-1fib[1] <- 1for (i in 2:n) { fib[i] <- fib[i - 2] + fib[i - 1]}print(fib)}fib(5)Error in fib[0] <- 1 : object of type 'closure' is not subsettablepls help
02-03M 10-20S suhasini@comp.sce.edu.in
Answer last updated on: May 4, 2020, 6:11 p.m.
-
Functions
Create a function to create an employee data frame (Name,Gender,Age,Designation & SSN). Function should return the dataframe employee. In main R script print Name and Age of employees.
03-04M 40-50S SUBHO98
Answer last updated on: May 2, 2020, 1:04 a.m.
-
Functions
Create a function which computes combination of two numbers
11-12M 0-10S bvs.nnsvidya@gmail.com
Answer last updated on: April 30, 2020, 2:24 p.m.
-
1Overview of R and RStudio
-
2Installing R and RStudio on Linux
-
3Installing R and RStudio on Windows
-
4Introduction to basics of R
-
5Introduction to Data Frames in R
-
6Introduction to RStudio
-
7Introduction to R script
-
8Working directories in RStudio
-
9Indexing and Slicing Data Frames
-
10Creating Matrices using Data Frames
-
11Operations on Matrices and Data Frames
-
12Merging and Importing Data
-
13Data types and Factors
-
14Lists and its Operations
-
15Plotting Histograms and Pie Chart
-
16Plotting Bar Charts and Scatter Plot
-
17Introduction to ggplot2
-
18Aesthetic Mapping in ggplot2
-
19Data Manipulation using dplyr Package
-
20More Functions in dplyr Package
-
21Pipe Operator
-
22Conditional Statements
-
Functions in R
Questions posted on ST Forums:
12435 visits
Outline:
Define a function About built-in functions and user-defined functions Need for a user-defined function Syntax of a function Parts of a function Create a user-defined function with arguments Create a user-defined function without arguments About readline function Scope of variables Use of return function
Width: | 890 | Height: | 626 |
---|---|---|---|
Duration: | 00:12:15 | Size: | 5.4 MB |
Show video info