sequences

Producing numeric sequences in R using standard patterns

时光总嘲笑我的痴心妄想 提交于 2019-12-04 03:07:46
I am working on a project where I need to enter a number of "T score" tables into R. These are tables used to convert raw test scores into standardized values. They generally follow a specific pattern, but not one that is simple. For instance, one pattern is: 34,36,39,42,44,47,50,52,55,58,60,63,66,68, 71,74,76,79,82,84,87,90,92,95,98,100,103,106 I'd prefer to use a simple function to fill these in, rather than typing them by hand. I know that the seq() function can create a simple seqeuence, like: R> seq(1,10,2) [1] 1 3 5 7 9 Is there any way to create more complex sequences based on specific

Deleting a table in PostgreSQL without deleting an associated sequence

烂漫一生 提交于 2019-12-04 02:14:00
I have a table, foo . For the purposes of a quick upgrade/deploy of my site, I made a new table, tmp_foo , to contain some new data, by doing: create table tmp_foo (like foo including constraints including defaults including indexes); Now each table has a PK id column that looks like: Column | Type | Modifiers -------------+-----------------------+-------------------------------------------------------------------------- id | integer | not null default nextval('foo_id_seq'::regclass) The important point is that both tables rely on the exact same sequence, foo_id_seq . There is no tmp_foo_id

Is there a way to get pg_dump to exclude a specific sequence?

人盡茶涼 提交于 2019-12-03 11:23:50
问题 I want to exclude a sequence from my pg_dump command which is putting the output into a plain file. Command: /Library/PostgreSQL/8.4/bin/pg_dump --host localhost --port 5433 --username xxx --format plain --clean --inserts --verbose --file /Users/xxx/documents/output/SYSTEM_admin_20131126015325.sql --exclude-table public.table1 --exclude-table public.table2 mydatabase I know there are switches for tables which i am using above and that you can enable/disable database objects in the tar format

Algorithm for music imitation? [closed]

江枫思渺然 提交于 2019-12-03 03:42:29
Closed . This question needs to be more focused. It is not currently accepting answers. Learn more . Want to improve this question? Update the question so it focuses on one problem only by editing this post . I'm interested in automatic music making. I was thinking about a program that is fed a large number of 1-bar arpeggios (= fixed length sequences of notes, for simplicity) and generates its own sequences, based on what it learnt. To start with, I know I could use letter (digram? trigram?) frequency analysis , only applied to note pitches, and then generate my sequence based on frequency

Is there a way to get pg_dump to exclude a specific sequence?

孤街醉人 提交于 2019-12-03 01:44:45
I want to exclude a sequence from my pg_dump command which is putting the output into a plain file. Command: /Library/PostgreSQL/8.4/bin/pg_dump --host localhost --port 5433 --username xxx --format plain --clean --inserts --verbose --file /Users/xxx/documents/output/SYSTEM_admin_20131126015325.sql --exclude-table public.table1 --exclude-table public.table2 mydatabase I know there are switches for tables which i am using above and that you can enable/disable database objects in the tar format in combination with pg_restore as stated in the pg_dump documentation but I will not be using pg

Programmatic access to On-Line Encyclopedia of Integer Sequences

醉酒当歌 提交于 2019-12-02 21:17:05
Is there a way to search and retrieve the results from On-Line Encyclopedia of Integer Sequences (http://oeis.org) programmatically? I have searched their site and the results are always returned in html. They do not seem to provide an API but in the policy statement they say its acceptable to access the database programmatically. But how to do it without screen scraping? Thanks a lot for your help. Alexander Craggs The OEIS now provides several points of access, not just ones using their internal format. These seem largely undocumented, so here are all of the endpoints that I have found:

Given a string of integers find out all the possible words that can made out of it in continuous order. [closed]

走远了吗. 提交于 2019-12-02 14:40:44
Given a string of integers how to find out all the possible words that can made out of it in continuous order. Eg: 11112 ans: AAAAB AKAB AAKB AAAL etc. public static void main(String[] args) { String str="11111124"; char strChar[]=str.toCharArray(); String target=""; for(int i=0;i<strChar.length;i++) { target=target+(char)Integer.parseInt(""+(16+strChar[i])); } System.out.println(target); } i am trying to find the solution for this but not able to find all combination Combining the comments saying that 163 can be 1,6,3 or 16,3 , but not 1,63 , and user3437460 's suggestion of using recursion:

Create numbered sequence for occurrences of a given nesting variable

℡╲_俬逩灬. 提交于 2019-12-02 08:38:29
问题 I'm hoping to add to a data set a variable that sequences the instances a certain grouping variable appears. For example: ids <- c(rep(1,4),rep(2,6),rep(3,2)) I'm wanting another variable that would count the instances each id appears. Creating a vector like this: 1,2,3,4,1,2,3,4,5,6,1,2 With them combined looking something like this: ids count 1 1 1 2 1 2 3 1 3 4 1 4 5 2 1 6 2 2 7 2 3 8 2 4 9 2 5 10 2 6 11 3 1 12 3 2 Any ideas? Many thanks! 回答1: I suggest ave with seq_along ids <- c(rep(1,4)

Ruby equivalent of C#'s 'yield' keyword, or, creating sequences without preallocating memory

瘦欲@ 提交于 2019-12-01 16:30:08
问题 In C#, you could do something like this: public IEnumerable<T> GetItems<T>() { for (int i=0; i<10000000; i++) { yield return i; } } This returns an enumerable sequence of 10 million integers without ever allocating a collection in memory of that length. Is there a way of doing an equivalent thing in Ruby? The specific example I am trying to deal with is the flattening of a rectangular array into a sequence of values to be enumerated. The return value does not have to be an Array or Set , but

Oracle sequences equivalent in MySQL

南楼画角 提交于 2019-12-01 14:03:34
问题 I have following table similar to Oracle user_sequences . I have logic of sequence prefix/suffix something, but for simplicity, I'm skipping as matters less here. create table my_seq( min_value integer, Max_value integer, last_value integer, increment_by tinyint, customer_id integer); Assume in current table there are two records. insert into my_seq(min_value,max_value,last_value,increment_by,customer_id) values(1,99999999,1,1,'foo#',1),(1,999999999,100,1,'foo#',2); My foo table structure is