Displaying 4 results from an estimated 4 matches for "regati".
Did you mean:
pregati
2017 Jul 28
0
R Programming help needed - Returning dataframes + 2 Variables dynamically
...test_data))
}
for ( i in 1:1 ) {
test_data <- Logic_fn(x,y)
print("Returned Values :")
print(x)
print(y)
}
Wrong output :
[1] "Passed Values"
[1] 0
[1] 0
[1] "After addition :"
[1] 1
[1] 1
[1] "Returned Values :"
[1] 0
[1] 0
With Regards,
Vijaya Kumar Regati
Technical Lead, M3bi India Private Ltd
Work: 040-67064732
________________________________
From: Koustav Pal <koustavpal.devel at gmail.com>
Sent: Friday, July 28, 2017 12:25:54 PM
To: Vijaya Kumar Regati
Cc: vijaykr.sas at gmail.com; r-help at R-project.org
Subject: Re: [R] R Programming he...
2017 Jul 28
4
R Programming help needed - Returning dataframes + 2 Variables dynamically
...nction is to assign the first
argument to the first declared variable and the second to the second. So,
if you called Logic_fn(y,x), then y will be assigned to x and x to y. So to
avoid such a scenario you can mention it explicitly as Logic_fn(y=y,x=x).
On Jul 28, 2017 8:39 AM, "Vijaya Kumar Regati" <VijayaKumar.Regati at m3bi.com>
wrote:
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...
2017 Jul 28
1
R Programming help needed - Returning dataframes + 2 Variables dynamically
...he list you assign to test_data, the original x and y are not modified, i.e the returned value for x will be test_data[[1]] and for y will be test_data[[2]]. Using the same variable names in the function and test is perhaps what is leading to confusion.
> On 28 Jul 2017, at 09:13, Vijaya Kumar Regati <VijayaKumar.Regati at m3bi.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 <-...
2017 Jul 28
2
R Programming help needed - Returning dataframes + 2 Variables dynamically
...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_data <- Logic_fn(c(x,y))
test_data[1]
test_data[2]
test_data
}
With Regards,
Vijaya Kumar Regati
Disclaimer: IMPORTANT NOTICE: This e-mail (including any attachments) are confidential, may contain proprietary or privileged information and is intended for the named recipient(s) only. If you are not the intended recipient, any disclosures, use, review, distribution, printing or copying of the...