Displaying 20 results from an estimated 300 matches similar to: "working with tables"
2012 Nov 21
1
lists as matrix cells ?
Dear R experts,
since more or less half a year I am using R.
In many of my computations I construct huge matrices. Often I do so using
'cbind' on named lists:
do.call( 'cbind',
list(
"Column_A"=list("Row_one"=1.0, "Row_two"=2.0, "Row_three"=3.0),
"Column_B"=list("Row_one"=4.0, "Row_two"=5.0,
2012 Apr 18
1
Re: validates_uniqueness_of question
Hi All,
I am trying write a validation rule where I need to ensure that when a
certain value is updated or created in a particular columns, a number of
other columns columns are unique and that another column does not contain a
certain value.
I have been able to use the validates_uniqueness_of :column_a (to be
updated or inserted) with , :scope =>
[ :column_b , :column_c , :column_d ]
2006 May 23
3
ez-where headscratch
Hi there,
I''m puzzled by this apparently simple query I can''t manage to reassemble
using ez_where plugin.
cond = Caboose::EZ::Condition.new :my_table do
start_on < Time.now
any {end_on > Time.now; end_on.nil?}
end
I keep getting the following result :
>> cond.to_sql
=> ["my_table.start_on < ? AND (my_table.end_on > ?)", Tue May 23
2009 Oct 01
1
Help me replace a for loop with an "apply" function
...if that is possible
My task is to find the longest streak of continuous days a user participated
in a game.
Instead of writing an sql function, I chose to use the R's rle function, to
get the longest streaks and then update my db table with the results.
The (attached) dataframe is something like this:
day user_id
2008/11/01 2001
2008/11/01 2002
2008/11/01 2003
2005 May 19
5
[OT] Sqlite2 question
So, under Sqlite2, if I want to update a database''s schema, I have to
dump the DB, modify the table''s structure, then go and modify EVERY
insert statement.
The insert statements look like (from memory):
INSERT INTO my_table VALUES (''some_id'', ''some_val'', '''', '''', '''',
''some_other
2007 Aug 30
1
belongs_to with foreign keys that reference non primary key columns
Hello,
I have a situation where the foreign key into a table doesn''t
correspond to that table''s primary key:
my_table
-------------
id (pk)
name
...
other_table
--------------
id (pk)
my_table_name (fk references my_table(name))
...
I want to be able to say something like:
class OtherTable < ActiveRecord::Base
belongs_to :my_table, :foreign_key => { :my_table_name
2006 Apr 10
1
Add Column After Column in Migrations
Adding a column to a table just places the column at the end, but I
like to keep related columns together. Is there a way to specify
where the column is added in a table with migrations? For example, in
MySQL you can do:
ALTER TABLE my_table ADD COLUMN new_column INT AFTER other_column
I was hoping migrations would support something like this:
add_column :my_table, :new_column, :integer,
2010 Jun 10
1
Can RMySQL be used for a paramterized query?
I have not found anything about this except the following from the DBI
documentation :
Bind variables: the interface is heavily biased towards queries, as opposed
> to general
> purpose database development. In particular we made no attempt to define
> “bind
> variables”; this is a mechanism by which the contents of R/S objects are
> implicitly
> moved to the database during SQL
2018 Feb 15
3
[Bug 1226] New: Segmentation fault when printing a rule checking byte zero of NFT_PAYLOAD_LL_HEADER
https://bugzilla.netfilter.org/show_bug.cgi?id=1226
Bug ID: 1226
Summary: Segmentation fault when printing a rule checking byte
zero of NFT_PAYLOAD_LL_HEADER
Product: nftables
Version: unspecified
Hardware: x86_64
OS: Debian GNU/Linux
Status: NEW
Severity: normal
Priority: P5
2006 Jun 14
6
find and LIKE ''xxx%'' clause
Hi there !
I try to figure out how to do something like this in Rails :
SELECT * FROM my_table WHERE name LIKE ''GOGONAM%''
My problem is the % and the quotes.
>From now, I do like this :
searched_name = params[:name]+''%''
user = MyTable.find(:all, :conditions => ["name LIKE ?", searched_name])
But is there a more gracefull way to do a LIKE
2011 Sep 12
0
Migrate column from text to binary (PostgreSQL)
Hello,
So I''ve realized one of the columns in a table has to be binary
instead of text. However, a straightforward
change_column :my_table, :my_column, :binary
fails under PostgreSQL (9.x series) The error message being:
PGError: ERROR: column "my_column" cannot be cast to type bytea
: ALTER TABLE "my_table" ALTER COLUMN "my_column" TYPE bytea
Now
2006 Jul 18
2
Scaffold a Plural table w/ No Pluralization in environment
Hi guys,
I have a situation here. I have my project set to no pluralization due
to legacy tables in environment.rb. Now, I have some new tables which
I''m starting to pluralize. When I do a generate a scaffold to this new
table:
script/generate scaffold my_tables table
it seems to work out fine for certain sections like
http://mysite.com/railsapp/new (which also inserts properly to
2006 Jan 17
2
How to run direct sql
How can i run and get the value from the following sql:
select avg(my_field) from my_table where which_year=''0506'' and
which_week <= 21 and my_foreign_key_id=10
cheers
--
Posted via http://www.ruby-forum.com/.
2004 Mar 17
1
help with file
Hi,
I am new at R, and I need some help with some basic stuff.
I want to do clustering of data. It works perfectly, but now I want to
export my file form R to my Linux directory. The problem is that the file
is generated only with the cluster numbers, but it does not carry over the
identifiers. Let me show you what I did :
1. demo<-read.table("my_table", sep=",",
2006 Aug 04
3
Migration::alter statements ??
Hi,
Where to put the execute statements in migration scripts?
e.g, I would like to create a table and add a foreign_key reference.
def self.up
?? execute "alter table ...."
create_table :my_table do |t|
t.column :user, :string
end
?? execute "alter table ...."
end
Should the execute statement be above the table creation or below the table
creation? Logically I
2006 Nov 08
0
Fw: data frames re-ordering and naming columns
Thank you for help with the first part. The second part I do not understand. All I get is "3" "3". Presumably this is the factor that you refer to. Is there no simple way of extracting the text alone
----- Forwarded Message ----
From: Peter Alspach <PAlspach@hortresearch.co.nz>
To: Jabez Wilson <jabezwuk@yahoo.co.uk>
Sent: Tuesday, 7 November, 2006 7:46:02 PM
2007 Mar 16
0
find() and SQL functions
Hi,
I have a complex SQL request to perform. I don''t want to manually do the
whole query (find_by_sql) because of the complex joins, but I want to
use MySQL functions, such as:
Model.find(:all,
:include => [../..],
:conditions => ["(../..) AND YEAR(STR_TO_DATE(my_table.my_row,''%Y-%m-%d %H:%i:%s'')) = #{year})"],
:select
2008 Nov 28
0
ranking the results of a questionnaire
dear experts,
I reproduced an experiment (questionnaire) some times.
The result of the experiment is a vector of 5 factors, say (A,B,C,D,E).
In the original article the result is given in 5 pairs of mean and stDev for
A .. E, e.g. mean_A=37.4 and sd_A=8.1.
The interval for A,B,C,D,E values is 0..50. The original data frame is not
available.
For a comparison of my results
2008 Nov 28
1
True ActiveRecord result set iteration
Hello,
For an internal project we were looking for a solution which extends
ActiveRecord by an iterator function. Using find(:all) is no fun if you
have to process some 10.000 records.
Until now there have been two ways of dealing with that scenario:
- write your logic a second times (e.g. use stored procedure)
- bet on AR plugins which work around that limitation by fetching IDs and
2009 Jan 14
5
How to compute p-Values
Hello.
How can I compute the Bootstrap p-Value for a one- and two sided test, when I have a bootstrap sample of a statistic of 1000 for example?
My hypothesis are for example:
1. Two-Sided: H0: mean=0 vs. H1: mean!=0
2. One Sided: H0: mean>=0 vs. H1: mean<0
I hope you can help me
Thanks in advance
Regards,
Andreas