loops

R - looping function in increments of 1

依然范特西╮ 提交于 2021-01-28 04:01:30
问题 I have the following function: position_tab <- filter(Tall, Time_point == 2) %>% group_by(Object) %>% summarise(minimum = min(Pixel_pos), maximum = max(Pixel_pos)) position_tab_2 <- mutate(position_tab, midpoint = minimum + ((maximum - minimum)/2)) Which produces: Object minimum maximum midpoint 1 4 22 13 2 39 85 62 etc.. This is filtering for a given timepoint, and creating a new dataframe with the midpoint variable added. Is there a way to loop this in increments of + one, so that the

R - looping function in increments of 1

…衆ロ難τιáo~ 提交于 2021-01-28 03:44:37
问题 I have the following function: position_tab <- filter(Tall, Time_point == 2) %>% group_by(Object) %>% summarise(minimum = min(Pixel_pos), maximum = max(Pixel_pos)) position_tab_2 <- mutate(position_tab, midpoint = minimum + ((maximum - minimum)/2)) Which produces: Object minimum maximum midpoint 1 4 22 13 2 39 85 62 etc.. This is filtering for a given timepoint, and creating a new dataframe with the midpoint variable added. Is there a way to loop this in increments of + one, so that the

Using a nested lookup table to find values above thresholds in second table and quantify them in R

僤鯓⒐⒋嵵緔 提交于 2021-01-28 02:42:17
问题 I’m analyzing river streamflow data with R language and I have two nested lists. First holds data (Flowtest) from different river reaches called numbers such as 910, 950, 1012 and 1087. I have hundreds of daily streamflow measurements (Flow), but as I’m preparing yearly statistics the exact day and month doesn’t matter. Each measurement (Flow) is referenced to a year (Year) in the Flowtest table. Flowtest <- list("910" = tibble(Year = c(2004, 2004, 2005, 2005, 2007, 2008, 2008), Flow=c(123,

How to take the last value of a for loop in Java?

风流意气都作罢 提交于 2021-01-28 02:36:43
问题 import java.util.Scanner; public class Problem1{ public static void main(String[] args){ //input Scanner kb = new Scanner(System.in); String word,letter; int counter=0, match,value; word=kb.next(); word=word.toLowerCase(); letter=kb.next(); letter=letter.toLowerCase(); //loop for (int i=0;i<word.length();i++) if (word.charAt(i)==letter.charAt(0)){ counter++; match=i; System.out.print(match); } if (counter==0) System.out.print(-1); } } I must execute this program in Codio. This program will

VBA Loop through excel workbooks in folder and copy data - Not looping through all files

与世无争的帅哥 提交于 2021-01-28 02:32:44
问题 I am trying to get a VBA macro to loop through all xls files in a specific folder. The below code works for the most part. However i have 42 files in this folder and the code only loops through about 26 of them. They are all the same file extension. My thoughts are it either isn't looping through all the files. Or it is looping through all the files however there is an issue with the last row variable and data is being pasted over. Sub CopyDataBetweenWorkbooks() Dim wbSource As Workbook Dim

How to format the condition in a dynamically generated conditionalPanel in Shiny?

送分小仙女□ 提交于 2021-01-28 01:12:19
问题 I am trying to create widgets in Shiny by using for loop. each block contains: label check box choices selector Two numeric inputs I want to do condition for showing or hiding the two numeric inputs according to the value of the check box and the value of the choices selector. In the for loop that I created I added an index for each widget variable. I am wondering how can I execute the condition of the conditional panel in the for loop knowing that the variables are indexed in their names.

Excel VBA: Screen doesn't refresh during loop

*爱你&永不变心* 提交于 2021-01-28 00:11:39
问题 I'm trying to make an image disappear and reappear while a loop is taking place. The code works as intended when I step through it, but when I run it the screen doesn't update until the loop is finished. I've tried adding things like DoEvents and ActiveWindow.SmallScroll as found here but nothing seems to work. I have a feeling this problem may have something to do with my PC/settings/version of Excel and that the loop may work on some peoples' machines. I've uploaded a sample file here if

Using a nested lookup table to find values above thresholds in second table and quantify them in R

前提是你 提交于 2021-01-27 23:09:54
问题 I’m analyzing river streamflow data with R language and I have two nested lists. First holds data (Flowtest) from different river reaches called numbers such as 910, 950, 1012 and 1087. I have hundreds of daily streamflow measurements (Flow), but as I’m preparing yearly statistics the exact day and month doesn’t matter. Each measurement (Flow) is referenced to a year (Year) in the Flowtest table. Flowtest <- list("910" = tibble(Year = c(2004, 2004, 2005, 2005, 2007, 2008, 2008), Flow=c(123,

On click, loop through each object key

点点圈 提交于 2021-01-27 21:51:37
问题 I'm still learning JS and something is harder to understand than others. Like so: I am trying to change the theme of google maps by allowing users to click on a custom button. I was using if else which works great but i wanted to add more themes and using a loop. Each time a user clicks, it selects: object key 0, then click again object key 2 and object key 3 and repeat I can get the object keys and values how I'm lost after that. This is the theme object let theme = { default: null, night:

Python using a loop to search for N number and return index

烈酒焚心 提交于 2021-01-27 20:24:09
问题 I have been programming for a total of three weeks. I am stuck on this problem right now: We will pass you 2 inputs: A list of numbers A number, N, to look for Your job is to loop through the list and find the number specified in the second input. Output the list element index where you find the number. If N is not found in the list, output -1. This is what I have so far: import and N were provided import sys N= int(sys.argv[2]) this is also provided numbers= [] for i in sys.argv[1].split(","