How to created dummy variables with some conditions using a loop in R?

I am trying to create a bunch of dummy variables with 2 conditions each based on the name of the variable But i am not sure how to proceed

   I have the following dataset "dat"    ID Entry   Exit   y2000 y2001 y2002 y2003 ....   1   1999  2010     0      0     0     0   2   2000  2001     0   ......   3   2002  2003     0  ........   4   1999  2002   5   ..... 

at the moment all the y”i” variables are equal to 0 basically, what I want is to assign value 1 to variable y2000 if entry is lower or equal to 2000 and exit is higher or equal to 2000 similarly, for variable y2001 i want to assign value 1 if entry is lower or equal to 2001 and exit is higher or equal to 2001 and so on.

I can do it for a signle variable as follows:

      dat$  y2000[dat$  exit >= 2000 & dat$  enter <= 2000] <- 1 

but I d like to do this in a loop for each variable of the type y”i”, how can I do?

thank you in advance for yout help

Sufficient conditions for (pointed) quiver representations to be “nondegenerate”

I am interested in the following problem. Suppose we have a quiver $ Q$ , together with a quiver representation $ V$ of $ Q$ . Let us say that, at each vertex $ p \in Q_0$ , we choose an element $ \alpha_p \in V^*_p$ , where $ V_p^*$ is the dual space of $ V_p$ . Let us call $ (V, (\alpha_p))$ a “pointed” quiver representation of $ Q$ .

I am interesting in the following concept. Call $ (V, (\alpha_p))$ nondegenerate at $ p \in Q_0$ if the set of all $ f_e^*(\alpha_{p’})$ is in general linear position, as $ e$ ranges over all directed edges starting at $ p$ , where $ p’$ is the endpoint of $ e$ , which of course depends on $ e$ (and $ f_e$ is the linear map attached to the edge $ e$ by the quiver representation). $ (V, (\alpha_p))$ is said to be nondegenerate if it is nondegenerate at all $ p \in Q_0$ .

I am interested in finding sufficient conditions for a pointed quiver representation to be non-degenerate.

Has this concept been studied before? If so, can someone point me to the right locations in the literature? If not, does anyone have any idea how to find such (non-trivial) sufficient conditions?

Sufficient conditions for (pointed) quiver representations to be “nondegenerate”

I am interested in the following problem. Suppose we have a quiver $ Q$ , together with a quiver representation $ V$ of $ Q$ . Let us say that, at each vertex $ p \in Q_0$ , we choose an element $ \alpha_p \in V^*_p$ , where $ V_p^*$ is the dual space of $ V_p$ . Let us call $ (V, (\alpha_p))$ a “pointed” quiver representation of $ Q$ .

I am interesting in the following concept. Call $ (V, (\alpha_p))$ nondegenerate at $ p \in Q_0$ if the set of all $ f_e^*(\alpha_{p’})$ is in general linear position, as $ e$ ranges over all directed edges starting at $ p$ , where $ p’$ is the endpoint of $ e$ , which of course depends on $ e$ (and $ f_e$ is the linear map attached to the edge $ e$ by the quiver representation). $ (V, (\alpha_p))$ is said to be nondegenerate if it is nondegenerate at all $ p \in Q_0$ .

I am interested in finding sufficient conditions for a pointed quiver representation to be non-degenerate.

Has this concept been studied before? If so, can someone point me to the right locations in the literature? If not, does anyone have any idea how to find such (non-trivial) sufficient conditions?

Is this possible to represent any word or massage for grep output (which is not available in OR conditions searching)

I have file with 5 numeric no. Like below

Line 1 – 6 rahul Line 2 – 4 anil Line 3 – 8 ravi Line 4 – 9 sagar Line 5 – 3 pravin

Here if I’m using grep ‘8\|9\|2’ file >file1.txt It will redirect only matching record i.e. Line 4 – 9 sagar Line 5 – 3 pravin To file1.txt only But here I want ” 2 — this record is not available from your searching strings ” Massage from grep command

Managing various printing conditions cleany?

I have this code here which prints the data I have available that currently imo looks bad and cluttered:

has_printed = 0 output = ''  is_banner_printed = 0 if time.time() > next_print_time:     output = output + (' ' + datetime.now().strftime("%I:%M:%S %p") + ' ---------------------------------------------------------------------------------c')     is_banner_printed = 1  if is_banner_printed or not(len(self.post_list)):     print(output)  output = '' for i, post in enumerate(self.post_list):      post.update()      output = output + ('   Age: ' + datetime.fromtimestamp(self.utils.get_submission_age(post.created_utc)).strftime("%M:%S") +                        ' | URL: http://url.com/' + post.id +                        ' | Score: ' + str(post.score).ljust(6, ' ') + ... )     if i == 0:         output = '\n' + output     output = output + '\n'  if output is not '' and time.time() > next_print_time and is_banner_printed:     print(output)     has_printed = 1     next_print_time = time.time() + self.PRINT_RATE  if has_printed:     print(' ---------------------------------------------------------------------------------------------c\n\n\n') elif is_banner_printed and output is '':     print('')     next_print_time = time.time() + self.PRINT_RATE 

I wonder if it’s possible to clean this mess to make the actual code readable?

Multiple IF conditions nested with a CONCATENATE

I have a formula as follows which I’m using for a scheduling system within Google Sheets:

=IF(B2="","",(CONCATENATE($  B$  1&" "&B2&CHAR(10)&$  C$  1&" "&C2&CHAR(10)&$  D$  1&" "&D2&CHAR(10)&$  E$  1&" " &E2&CHAR(10)&$  F$  1&" " &F2&CHAR(10)&$  G$  1&" " &G2))) 

Currently, my formula works b2 has a value inside it which is great, what I want, however, is for the formula only to show if one value is inside either.

B2, C2, D2, E2, F2 or G2.

so if c2 has a value I want the formula to parse.

I’ve tried

=IF(B2,C2,E2) etc with no luck.  

I’ve also tried:

=IF(OR(B2="",C2="") which parsed the formula but kept it visible even with no data.

Reason for this is that I pull these fields into a master schedule and I only want it to show when one of the fields is populated if that makes sense? otherwise, the schedule will look far to busy.

https://docs.google.com/spreadsheets/d/1KE3VOI43M4-QlWB0EZldCqR73d3RHDnRnUNlv1MqLMo/edit?usp=sharing

Document for you guys.

WooCommerce – Show different terms and conditions for different user roles

I’m setting up a WooCommerce shop and it will have two types of customer/user roles – a standard retail customer/user role and a wholesale customer/user role.

Here’s the snag that I’ve hit – when a Wholesale customer is logged in, I need the Terms and Conditions link on the checkout page to go to a different T&C’s page.

I’ve tried a couple of different functions in functions.php to replace the link text but they don’t work.

Does anyone out there have any suggestions that I can try??

Thanks,

Bev

How many combinations will be generated if below conditions are put?

I need a generalized formula for a set having size(s) having below restrictions,

for ex. X = 2,7,11,17,26

I want only the first combination 2+7 & ignore all of the combinations that start from 2+? (2-num combinations only) same for 3-num consider 2+7+11 & ignore all 2+7+?

enter image description here

Formula should be applicable for any set X without size restriction.