Questions tagged [seq]

seq is short for sequence. A sequence is an ordered list of objects (or events). Like a set, it contains members (also called elements or terms), and the number of terms (possibly infinite) is called the length of the sequence. Unlike a set, order matters, and exactly the same elements can appear multiple times at different positions in the sequence. Sometimes, sequence is used as a generic name for both list, array and set for convenience.

730 questions
0
votes
1 answer

What is the defference between seq() and sequence() in R?

I am new to R and am wondering what is the difference between seq() and sequence(). Both entered into R give different results: > seq(c(10,5)) [1] 1 2 > sequence(c(10,5)) [1] 1 2 3 4 5 6 7 8 9 10 1 2 3 4 5 Can anyone help me with…
rocc
  • 153
  • 1
  • 7
0
votes
0 answers

seq() in R producing mix of numbers and characters

Strange one this. seq() is creating a mix of numbers and characters, which really screws some things up! If I create the following sequence: tmp <- seq(0.1, 2, by=0.1) Then I get a sequence! [1] 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1.0 1.1 1.2 1.3…
0
votes
1 answer

Converting date in For Loop in R - origin must be supplied

I have a sequence of dates in R, and for each date I need to get the year, month, and day. I tried to use the strftime function to print out the year, but R behaves very strangely. This code fails: # sequence of dates dates <-…
jirikadlec2
  • 1,256
  • 1
  • 23
  • 36
0
votes
1 answer

How to generate a sequence based on two columns in R?

Below you can recreate my data in R. I would like to generate a sequence of numbers based on two individual columns. In this example of real data my column names are : df= or10x1BC "Tank" "Core" "BCl" "BCu" "Mid" "TL" "SL" I wish to use the…
MockCommunity1
  • 31
  • 1
  • 1
  • 10
0
votes
1 answer

Generate new scala sequence from another sequence

I have a sequence of ids and a function which return an Option[workItem] for each id. All I want to do is generate a sequence of workItem from these two things. I tried various combinations of maps, foreach and for comprehension and nothing…
ocwirk
  • 1,079
  • 1
  • 15
  • 35
0
votes
3 answers

many to many join (same ID with different date)

I'm doing an analysis using SQL and R, I want to join two tables like below listed: Table 1: ID date a11 20150302 a11 20150302 a22 20150303 a22 20150304 a33 20150306 a44 20150306 a55 20150307 a66 20150308 a66 20150309 a66 20150310 Table 2 ID …
WayToNinja
  • 285
  • 4
  • 14
0
votes
1 answer

How to implement an iterator in Scala making use of sequences as does this F# code?

I was wondering what the equivalent Scala code would be for this short F# snippet: seq { for i in 1..10 do printfn "%d" yield i } Is it actually possible to have something like that in Scala? What I'm actually attempting to implement,…
devoured elysium
  • 101,373
  • 131
  • 340
  • 557
0
votes
2 answers

Two-level 'for' loop of a customised list

Using a two-level for loop and seq works fine, and the code for i in `seq 0 3`; do for j in `seq 0 3`; do echo $i $j; done; done gives the expected output: 0 0 0 1 1 0 1 1 But if I want a more customised list of numbers: for i in '-1 4.5'; do for…
jorgen
  • 3,425
  • 4
  • 31
  • 53
0
votes
1 answer

Extract sequence of positive hit from vcountPattern in R

I conducted small RNA sequencing and try to analyze result fastq file. First I imported the fastq file into R using ShortRead package and converted to DNAstringSet reads <- readFastq("test.fq") seq <- sread(reads) To look for reads that contain…
Zipsa
  • 77
  • 1
  • 9
0
votes
1 answer

F# Threading Changing State Through Unfold

I'm trying to process a sequence of items whereby the process step relies on some additional cumulative state from the prior items (ordering isn't important). Essentially: I have a Seq<'A> I have a (Type * int) list referred to as the skip list I…
Clint
  • 6,133
  • 2
  • 27
  • 48
0
votes
3 answers

How to repeat a sequence of numbers to the end of a column?

I have a data file that needs a new column of identifiers from 1 to 5. The final purpose is to split the data into five separate files with no leftover file (split leaves a leftover file). Data: aa bb cc dd ff nn ww tt pp with identifier column: aa…
Justin Buchanan
  • 107
  • 1
  • 8
0
votes
1 answer

For each element of given vector, generate sequence with X, X-1, ..., X-(N-1)

So I have been trouble with creating a counter, hopefully you all will be able to help. Lets say I have a vector x <- c(40,10,60) The desired output would be a new matrix 3 x n each row being a new date looking something like this.. 40 39 38 37…
Adam Warner
  • 1,334
  • 2
  • 14
  • 30
0
votes
1 answer

replacing nested for loop with sapply in R

So I have 10 parameters, with 7 fixed and 3 varying using seq. Each varying parameter has 10 possibilities. Right now I create an empty data frame and fill it after going through a bunch of functions and generating an output for each combination of…
adaml768
  • 29
  • 1
  • 7
0
votes
1 answer

scapy send fake http response issue , whireshark shows the seq and ack is very big than i set

I'm doing a test about sending me the fake http response by using scapy, however whireshark shows the fake response is "TCP ACKed unseen segment", here is my code: pkgs = sniff(iface="eth0",filter="src host 192.168.1.153 and dst host…
Flavin
  • 11
0
votes
0 answers

R Sequence Generation For a subset

I have requirement for sequence generation in R, but it needs to be unique in combination with another field. For example, my data: GrpID Data NewSeqId 100 683 1 100 534 2 100 234 3 200 456 1 200 23 …