All Questions
236 questions
2
votes
2
answers
80
views
How to write an R function that iterates through a data frame of formulas to fit multiple model variations
I have a list of many combinations of model variables that I'm testing for model fit. I need to figure out how to write an R code that iterates through each one in the model fit. This is what I have ...
0
votes
1
answer
84
views
How can these specific functions be convereted from using recursion to using iteration?
I've been working on porting a library from C to CUDA. Two functions that I need to port make use of recursion, which CUDA doesn't seem to be playing nicely with. I therefore want to convert these ...
0
votes
1
answer
25
views
Expected output not returned for spiral coordinate computation functions (iterative and recursive)
I'm trying to compute the x-coordinate of the nth arm of a spiral using both an iterative and a recursive function. However, I am not getting the expected output from the code. I have written two ...
1
vote
2
answers
89
views
Iterate along the two vectors of different length using map()
I have two vectors of unequal length. One vector is a list of dataframes and the other vector is made up of unique values. How can I use map() to iterate the vectors over a custom function? Dummy data ...
-1
votes
1
answer
114
views
Repeating an iterating function N times [closed]
I have an iterative function, f(x) = ax + b, which I want to repeat N times. My steps are as follows
1.) Define the iterative function
2.) Assign a value to each repetition
3.) Stop at the Nth ...
0
votes
0
answers
55
views
writing an r function so it can recieve a list of names to run
I'm a student trying to learn some of r for my biological analysis, but I don't really know coding. I'm currently working on a function that recieves as input an bird species name and gives as output ...
0
votes
1
answer
106
views
Javascript learning 2nd iteration of if for loop - School work
Updated: Halfway Solved:
I was able to solve the main function of getting the start variables to reach the end nodes. I am lost again on how to track the path i took and and it to console log or a ...
0
votes
2
answers
68
views
Iteration and function sequence in Javascript
This is a true or false quiz. I need the score for the final answer to be updated before the alerts display either the winning or losing alerts.
The below code results in 9 of the 10 scores being ...
2
votes
1
answer
56
views
How to convert a recursion with multiple recursive calls into an iteration? I already know how to do it when there is only one recursive call
Here is how I would convert a recursive function that only has one recursive call (I'll use JavaScript)
function f(n){
if(n>0){
f(n-1);
doStuff(n); //this could be anything
}...
0
votes
1
answer
31
views
Went off the rails with a prime number Generator
I am doing a prime number generator for an assignment. I have been doing it most the day and am starting to think i got confused. It is intended to take an input and list all the numbers that are ...
1
vote
1
answer
74
views
Pass a Previous Value to function MATLAB
I have the following function:
y(t) = alpha*y(t-1) + beta*y(t-1) + delta
where alpha,beta, and delta are constants.
I am assuming that y(0) = 0. I'm trying to create a MATLAB function to represent y(...
0
votes
2
answers
65
views
Reading file and list/tuple iteration
I need to take the data from a file, remove the lines that begin with a comment hash, then read that file into a list. Then convert that list into a list tuples of start times, end times, and step ...
0
votes
1
answer
52
views
For Loops Over Lists
I am trying to read a file, remove the lines that begin with a "#" and then store the remaining lines in a list where I will try and split them into tuples.
The file "in.dat" is ...
0
votes
2
answers
35
views
Defining Function Arguments and List Iteration
I am EXTREMELY new to Python but have experience in javascript. Below is a portion of my program that is not running as the argument "data" in "remove_comment_lines" is not defined....
0
votes
0
answers
13
views
Creating multiple dataframe in faster way with function? [duplicate]
I need to create multiple dataframe (let say 30 dataframe) in faster way rather manually create one-by-one dataframe. anyone has answer or reference links? Thank you in advance
def dvd(y):
df = ...