Displaying 20 results from an estimated 60000 matches similar to: "ActiveRecord trace sql"
2009 May 10
1
Select the rows in a dataframe that matches a criteria in another dataframe
Hi everyone! Thank you for the help you have been given to
me, and here I'm with another problem with my dataframes:
I have two dataframes (with much more observations), like
these:
Dataframe1
Firm Year cash
500400200 2007 100
500400200 2006 200
500400200 2005 400
500400300 2007 300
500400300 2006 240
500400300 2005 120
500400400
2011 May 19
2
balanced panel data
I have a dataframe with many firm-year observations and many variables.
Not all firms have information for all the years.
I want another dataframe with only those firms that have information all
years.
This is, I want a balanced panel data, but with the maximum number of years.
In my reprocucible example I want to keep firms 1,2 and 3 (period 2000 to
2004).
I need your help to create a
2005 Dec 29
9
Single Table Inheritance
Hi all,
Quick question for STI. With the following setup:
class Company < AR::Base; end
class Firm < Company; end
Why does Firm.find(:all) return all Companies, not just those that have
type==''Firm''?
--
Alex
2006 Apr 04
0
Parsing a SQL file directly into activerecord::executemethod - Not a vamp I swear
In an effort to not be a vamp. (Thanks Amy) Here is the error message =
I''m getting.
Mysql::Error: #42000You have an error in your SQL syntax; check the =
manual that corresponds to your MySQL server version for the right =
syntax to use near ''=A1=C9=A8[=A9=B4#Globals =
(ActiveRecord::StatementInvalid) SET @rightnow =3D current_timestamp;
It appears that Active Record is
2010 Nov 25
1
Help on running regression by grouping firms
Hi there,
I have a huge data set with multiple firms years and other firm characteristics. I want to run a regression on the dependent variable and other explanatory variables and calculate the residual terms by grouping the firms in same year and same industry.
What I want to do is to divide my obseravtion into sub sample that contains the observation with same fiscal year(FYEAR=1990) and same
2006 Apr 04
1
Parsing a SQL file directly into activerecord::execute method
Hello folks,
I''m trying to do something like:
1. db = ActiveRecord::Base.establish_connection(:adapter => "mysql",
:database => "app_development", :username => "root")
2. Cmd = File.read(''commands.sql'') <--- Command.sql contains multiple
valid SQL statement. I''ve tested this directly by piping it into MySQL
from the
2013 Apr 03
1
linear model coefficients by year and industry, fitted values, residuals, panel data
Hi R-helpers,
My real data is a panel (unbalanced and with gaps in years) of thousands of firms, by year and industry, and with financial information (variables X, Y, Z, for example), the number of firms by year and industry is not always equal, the number of years by industry is not always equal.
#reproducible example
firm1<-sort(rep(1:10,5),decreasing=F)
year1<-rep(2000:2004,10)
2012 Nov 19
0
R SNA: Creating a adjacency matrix containing all actors but only values of a subset
1 down vote favorite
my problem is the following:
I am using the R SNA package for social network analysis. Lets say, my
starting point is an edgelist with the following characteristics. Every row
contains a firm name, the ID of a project they are involved and further
characteristics, let's say the projects year. Firms can be in several
projects, and one project can consist of a
2005 Feb 17
1
Multiple Fstats/breakpoints test using Panel data
Hi,
I have recently use the strucchange package in R with a single time series observation. I found it extremely useful in the testing of change points.
Now, I am thinking of using the strucchange package with panel data (about 500 firms, with 73 monthly time series observations each). For each firm, I have to conduct the Fstats and breakpoints tests. Based on the test of each firm, I have to
2011 Oct 02
2
subset in dataframes
I need help in subseting a dataframe:
data1<-data.frame(year=c(2001,2002,2003,2004,2001,2002,2003,2004,
2001,2002,2003,2004,2001,2002,2003,2004),
firm=c(1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4),x=c(11,22,-32,25,-26,47,85,98,
101,14,87,56,12,43,67,54),
y=c(110,220,302,250,260,470,850,980,1010,140,870,560,120,430,670,540))
data1
I want to keep the firms where all x>0 (where there are
2010 Jun 25
0
activerecord + ms sql.. rowguid field for merge replication breaking inserts
i got my app running with ms sql server as the database and everything
worked fine. migrations, indexes, constraints, find, create, update,
etc.. the app isn''t actually a web app, butwill be running isolated on
severally diff machines that may not have consistent internet access..
part of the requirements was to setup replication so that eventually
the separate instances would
2006 Sep 25
1
ActiveRecord instead of direct sql execution
Hi all,
I have 2 tables and a standard one-to-many association.
How do I substitute the following sql with ActiveRecord calls so that
it uses just one sql statement:
update geo_entities set terminal_id = 3 where id = 10 or id = 23
or id = 87;
Thank you!
Regards,
Yuri Leikind
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to
2006 May 24
0
ActiveRecord::Base.sanitize_sql and SQL injection vulnerability.
Hi
The PostgreSQL development group released an update[1] for PostgreSQL
to address a SQL injection vulnerability. From the infromation[2]
released with this update, it appears the vulnerability exists in
other (all?) database systems allowing multi-byte encoding of
requests.
Of particular importance - since it relates not to database issues but
to web programming practices - are these quotes
2013 Oct 15
1
Problem with lapply
Hi together
I'm pretty new to R, so excuse me if it is a basic question.
I have a big dataset (extract of it found in the attachment) of returns from
firms. I'd like to compute the Pearson correlation of each firm with the
"Market" and the corresponding p-Value. So I thought of making a list of
'cor.test's and then extract the needed values with a for loop. What I did
so
2005 Sep 05
4
Dummy variables model
Hi, all!
Anyone know an easy way to specify the following model.
Panel dataset, with stock through time, by firm.
I want to run a model of y on a bunch of explanatory variables, and one
dummy for each firm, which is 1 for observations that come from firm i,
and 0 everywhere else. I have over 200 firms (and a factor variable that
contains a firm identifier).
Any easy way of going about
2005 Jul 11
0
anyone using ENCODE and DECODE in SQL in ActiveRecord?
I keep some sensitive information encoded using MySQL''s ENCODE and
DECODE commands in the database table.
-- example SQL:
SELECT *, DECODE(ccnumblob, ''salthere'') AS ccnum FROM customers WHERE id=2;
UPDATE customers SET ccnumblob = ENCODE(''4321432143214321'',
''salthere'') WHERE id=2;
INSERT INTO customers (name, ccnumblob) VALUES
2004 Oct 03
2
Computing and testing transition probabilities?
Folks, I have a situation with many firms, observed for many years
(but it's not panel data, so every now and then data for a firm just
goes missing).
Let me show you an example. There are 3 firms "a", "b" and "c". There
are 3 years: 1981, 1982 and 1983. There's a factor f which takes
values 1, 2 or 3.
set.seed(5)
D = data.frame(
names=c("a",
2008 Jul 18
2
ActiveRecord: SQL IN operator
I want to use an array in the :conditions of an ActiveRecord Find so
that a SQL IN statement is created. However, I also want to specify a
greater than condition on a timestamp column too.
From the Docs:
An array may be used in the hash to use the SQL IN operator:
Student.find(:all, :conditions => { :grade => [9,11,12] })
How do I modify this so that it also contains the timestamp
2006 Nov 19
1
How to create a SQL query without ActiveRecord?
I want to write an independent (not model-related) SQL query for some
statistic information
in an online shop system. So I know I could grab all users with
ActiveRecord and then just
count the array size, but that would massively waste resources. And I
also want MySQL to do
some max, min and average calculations. So is there a way to issue a
query and get the result set
without models being
2006 Aug 09
0
ActiveRecord provides unnecessary default value (SQL Server)
All,
ActiveRecord 1.14.3, sqlserver adapter, odbc mode
I have a table in SQL Server with a smalldatetime column - let''s call it
little_date. little_date is not allowed to have NULLs per the database
schema.
I am creating a new ActiveRecord object using obj.new (no database save)
and calling obj.little_date. So I''m doing:
obj.new
obj.little_date
What I observe is that if