## Given two Year + 1/3/5 integers, generate a vector of all Year + 1/3/5 integers between them (inclusive)

array multiplication works if the two operands
after this command: v = 111:-11:1; how many elements will v have?
matlab

My start on an example:

```yr_min <- 20181
yr_max <- 20195

as.numeric(paste0(rep(
seq(as.numeric(substr(yr_min, 1, 4)),
as.numeric(substr(yr_max, 1, 4))),
each = 3),
c(1, 3, 5)))

 20181 20183 20185 20191 20193 20195
```

What is wrong with the above code? It will not generalize beyond situations where `yr_min` ends in a `1` and `yr_max` ends in a `5`.

For example:

```yr_min <- 20183
yr_max <- 20193

as.numeric(paste0(rep(
seq(as.numeric(substr(yr_min, 1, 4)),
as.numeric(substr(yr_max, 1, 4))),
each = 3),
c(1, 3, 5)))

 20181 20183 20185 20191 20193 20195
```

The desired output is

``` 20183 20185 20191 20193
```

Matlab: A Practical Introduction to Programming and Problem Solving, Both of these create a row vector variable that has four elements; each value is stored For example, 1:5 results in all of the integers from 1 to 5 inclusive: >> vec = 1:5 vec = 1 2 3 4 5 Note For example, to create a vector with all integers from 1 to 9 in steps of 2: >> nv = 1:2:9 the result would be 1 3 5 QUICK QUESTION! Write a script.Create a vector of five random integers, each in the range from -10 to 10.Perform each of the following:•Subtract 3 from each element•Count how many are positive•Get the minimum

I would recommend using bona fide dates in your calculation. This allows us to take advantage of base R's `seq` function:

```x <- seq(as.Date("2018/3/1"), as.Date("2019/3/1"), by="month")
x[format(x, "%m") %in% c("01", "03", "05")]

 "2018-03-01" "2018-05-01" "2019-01-01" "2019-03-01"
```

If you really want the exact format you have, you can easily do that with another call to `format`:

```y <- x[format(x, "%m") %in% c("01", "03", "05")]
format(y, "%Y%m")

 "201803" "201805" "201901" "201903"
```

Or, for your exact output:

```sub("(?<=\\d{4}).", "", format(y, "%Y%m"), perl=TRUE)

 "20183" "20185" "20191" "20193"
```

Programming with Sets: An Introduction to SETL, To describe the set of all integers lying in the range M to N inclusive, where M and N are Sets of integers of the form {1,3,5,7,9} or {10, 5,0, -5,-10, –15) that is to say, sets that These notations will be used frequently in what follows. appear: {4,5,6,7,1,2,8,3,9,10} (or some other permutation of the integers from 1 to 10). Write a function called int_col that has one input argument, a positive integer n that is greater than 1, and one output argument v that is a column vector of length n containing all the positive integers smaller than or equal to n, arranged in such a way that no element of the vector equals its own index.

predefined data:

```end_vec <- c(1, 3, 5)
yr_min  <- 20183
yr_max  <- 20193
```

code:

```ans<-
c(
sapply(c(yr_min, yr_max), function(x) {n<-nchar(x);as.numeric(paste0(substr(x,1,n-1),end_vec))})
)

ans[dplyr::between(ans, yr_min, yr_max)]
```

result:

```#  20183 20185 20191 20193
```

Make the vector [1 2 3 4 5 6 7 8 9 10] - MATLAB Cody, More from this Author95 · Find state names that start with the letter N. 567 Solvers​. Pangrams! 2608 Solvers. Renaming a  I have a question about creating vectors. If I do a <- 1:10, "a" has the values 1,2,3,4,5,6,7,8,9,10. My question is how do you create a vector with specific intervals between its elements.

how can i solve this ,can anyone provide me with code? whats , If these three represent a valid date, return a logical true, otherwise false. If any of the inputs is not a positive integer scalar, return false as well. Note that every year that is exactly divisible by 4 is a leap year, except for years that are exactly if month==2 && day>28 (any(month == [1,3,5,7,8,10,12]) && day <= 31) || . Given starting and end points, write a Python program to print all odd numbers in that given range. Example: Input: start = 4, end = 15 Output: 5, 7, 9, 11, 13, 15 Input: start = 3, end = 11 Output: 3, 5, 7, 9, 11. Example #1: Print all odd numbers from given list using for loop

A Tutorial Introduction to R, 9.1.1 Element recycling; 9.1.2 Functions for creating vectors; 9.1.3 Vector indexing You can download precompiled binaries for most major platforms from any CRAN mirror. To analyze these data in R , first enter them as numerical vectors: x <- c(1,3,5,7,9,11) y <- c(6.5,4.3,9.1,-8.5,0,3.6) z <- c("dog","​cat","dormouse"  CS-10-003 Introduction to Computer Science for Science, Mathematics, and Engineering I: Chapter 6: Vectors: Participation Activities study guide by mcttan includes 76 questions covering vocabulary, terms and more. Quizlet flashcards, activities and games help you improve your grades.

MATLAB tutorial, Greatly borrowed from MIT's MATLAB on Athena tutorial Creating and Working with Matrices If called with a matrix as its argument, max returns a row vector in which each element is All of these work for two scalars, including complex scalars. MATLAB has several operators that round fractional numbers to integers. Given two vectors A⃗ =4.00i^+7.00j^ and B⃗ =5.00i^−2.00j^ , find the vector product A⃗ ×B⃗ (expressed in unit vectors). Express your answer in terms of the unit vectors i^, j^, and k^. Use the 'unit vector' button to denote unit vectors in your answer. Express your answer using three significant figures.

##### Comments
• It seems easier to just generate the sequence of base decades 20180, 20190... and add the offsets 1,3,5 yourself. Or else generate the entire sequence of years `seq(yr_min, yr_max)` and `Filter()` out anything which isn't 1,3,5 modulo 10.
• Oh, was this supposed to represent year-month like 2018 Jan, Mar, May, 2019 Jan, Mar, May? It would break on two-digit months, as @TimBiegeleisen suggests. (You didn't tell us so I just coded what you originally asked for)
• Before someone decides to tell me that I'm wrong for not choosing the highest-voted answer, I want to say that I'm actually really happy with this answer. It's a really clever use of modular arithmetic, and for collaboration, it is the easiest to read and modify.
• @Clarinetist: Thanks. More about functional programming in R: `Filter(), Map(), Reduce()...`
• As the others say, you can exploit that you only need step 2: `seq(yr_min, yr_max, by=2)`
• This is -almost- perfect, but I cannot have the extra zero in there - i.e., the output needs to be `20183`, `20185`, etc.
• @Clarinetist I gave you an update, but I think that two digits is actually more appropriate, because perhaps at a later date you could have October through December, which are two digit months.
• I do not set any of the formatting that has been laid out here (this is for a SQL query). These numbers do not represent months, but rather, partitions of the year into three segments. Mathematically, the problem is laid out in the original question.
• I have an interest in SQL, and maybe you should add some details about that to your question. Note that most SQL databases have the ability to generate dates, so you might not even need R.
• I don't have access to a program like SQL Developer or SQL Server Management Studio in this situation for accessing these particular data, otherwise I would use it.