search for: logic_fn

Displaying 4 results from an estimated 4 matches for "logic_fn".

2017 Jul 28
4
R Programming help needed - Returning dataframes + 2 Variables dynamically
c() is used for constructing vectors. Or in other words using the method c(x,y) provides a vector of length 2 (hopefully). Therefore, you are pushing a single vector to your function and not two arguments as you want. It should be Logic_fn(x,y) not Logic_fn(c(x,y)). Furthermore, i would recommend reading up on how function constructs work. Two return statements within a function are redundant because the function will exit after the first return statement, and anything else just creates more ambiguity. If you want to return the x y...
2017 Jul 28
0
R Programming help needed - Returning dataframes + 2 Variables dynamically
Hi, That was very useful information. Thanks. But still I am not able to get the desired output with updated code. Kindly help if you have any further thoughts ... Updated code : x <- 0 y <- 0 Logic_fn <- function(x,y){ print("Passed Values") print(x) print(y) x <- x + 1 y <- y + 1 print("After addition :") print(x) print(y) test_data <- rbind(x,y) test_data <- data.frame(test_data) return(list(x,y,test_data)) } for ( i in 1:1 ) { test_data <- Logic_fn(x,...
2017 Jul 28
1
R Programming help needed - Returning dataframes + 2 Variables dynamically
...3bi.com> wrote: > > Hi, > > > That was very useful information. Thanks. > > But still I am not able to get the desired output with updated code. > > Kindly help if you have any further thoughts ... > > Updated code : > x <- 0 > y <- 0 > > Logic_fn <- function(x,y){ > > print("Passed Values") > print(x) > print(y) > x <- x + 1 > y <- y + 1 > > print("After addition :") > print(x) > print(y) > > test_data <- rbind(x,y) > test_data <- data.frame(test_data) > return(...
2017 Jul 28
2
R Programming help needed - Returning dataframes + 2 Variables dynamically
Hi, Can someone please help me on below issue I am facing : I am trying to play with returning a dataframe+2 variables using a fn. But facing an issue : Error in Logic_fn(c(x, y)) : argument "y" is missing, with no default This is the code I am using : x <- 0 y <- 0 Logic_fn <- function(x,y){ x <- x + 1 y < y + 1 test_data <- rbind(x,y) test_data <- data.frame(test_data) return(test_data) return(c(x,y)) } for ( i in 1:1) { test_...