Displaying 20 results from an estimated 10000 matches similar to: "run sql query ?"
2006 Aug 05
10
Converting mysql to postgres
Hi,
Anyone got any cool tricks for converting a Rails site (in this case,
a typo installation) from a mysql database to a postgresql database?
I''ve got it almost working -- I''m doing a SQL dump from mysql and
loading it into postgres. However, mysql does booleans as a tinyint
with 0 = false and 1 = true. When I try to import that into a
postgres database that expects booleans
2009 Apr 07
2
newbie query: simple crosstabs
I've been playing around with various table tools, trying to construct a
fairly simple cross-tab. It shouldn't be hard, but for some reason it
turning out to be (for me).
If I want to see how many men and how many women agree with a agree/disagree
question (coded 1,0), I can do this:
>attach(mydata)
>mytable <- table(male, q1.bin) # gender and a binary response variable
2015 Oct 22
2
C_LogLin (stats/loglin)
Hi everyone,
I have a question regarding a C function of the "stats" package in R.
I tried to understand the ?loglin? basic function of the ?stats?
package implemented in
R. The implemented function itself runs without any problem (perhaps
see sample). When I
ran it line by line it stopped at the lines 23-24 of the
loglin-function; (the following line):
z <- .Call(C_LogLin,
2009 Oct 16
1
Frequencies, proportions & cumulative proportions
Dear R-Helpers,
I've looked high and low for a function that provides frequencies,
proportions and cumulative proportions side-by-side. Below is the table
I need. Is there a function that already does it?
Thanks,
Bob
> # Generate some test scores
> myValues <- c(70:95)
> Score <- ( sample( myValues, size=1000, replace=TRUE) )
> head(Score)
[1] 77 71 81 88 83 93
>
>
2012 Feb 26
6
loop for a large database
Yes, I am a newbie.
I have a data.frame (MyTable) of 1445846 rows and 15 columns with
character data.
And a character vector (MyVector) of 473491 elements.
I want simply to get a data.frame with the count of how many times each
element of MyVector appears in MyTable.
I've tried a loop with : for (i in 1 : length (myvector)) sum (MyTable== i)
but it crashes my computer.
I've also
2007 Apr 20
2
Caching of database values
If do something like this:
dbObj = MyTable.find_by_id(5)
a = dbObj.name
b = dbObj.name
How many times will an SQL call be made to get the value of
MyTable.name for id 5? In other words, are the values for dbObj
cached in the object? Is there a way of controlling that? (I can
imagine that sometimes you might not want to cache them if you wanted
to be sure of having the latest
2006 Mar 16
1
sql functions in cru ( not d )
Hi,
I''m looking at ways to encrypt email addresses rather than storing
them directly in the database.
There are several ways that it could be done. I could make an
Encrypter class and use before_update, etc. Or I could set up an
updatable VIEW in mySql. (I guess triggers might be another
possibility.)
However, what I would really LIKE to do is use the handy AES_ENCRYPT
and
2013 Mar 14
1
error: object of type 'closure' is not subsettable
Hi all,
when i run this script:
>read.table("Angelika.txt",header=T,sep="\t")
>mytable=read.table("Angelika.txt",header=T,sep="\t")
>for ( dye in c("A","B","C","F","G","K","L","M"))
+ {
+ for (cond in 1:8)
+ {
+ measurement =
2006 Mar 06
4
Contingency table and zeros
Hello,
Let's assume I have a vector of integers :
> myvector <- c(1, 2, 3, 2, 1, 3, 5)
My purpose is to obtain the cumulative distribution of these numerical
data, i.e. something like :
value nb_occur.
<=1 2
<=2 4
<=3 6
<=4 6
<=5 7
For this, I create a table with ;
> mytable <- table(myvector)
1 2 3 5
2 2 2 1
However, table() returns an array
2012 Mar 06
1
frequency count by row
I feel this is a very easy thing but I've never done it before and it is
getting frustrating.
I have a big data.frame (1445846 rows, 15 col)
that looks like this:
V1 V2 V3 V4 V5
1 home sister brother chair 0
2 cat dog animal 0 0
3 girl boy 0
2010 Jul 26
4
using string variable as order() function argument
Hello,
In my script I would like to use a loop, which sorts the dataframe
according to different columns, pointed by the string variable.
id col1 col2 col3
1 10 0 4 8
2 11 1 2 2
3 12 0 8 3
4 13 0 5 5
Usually the order() function can be used like this:
sorted = mytable**[order(column3) , ]
which results in properly sorted table:
**
2009 Nov 22
3
Define return values of a function
I have created a function to do something:
i <- factor(sample(c("A", "B", "C", NA), 793, rep=T, prob=c(8, 7, 5,
1)))
k <- factor(sample(c("X", "Y", "Z", NA), 793, rep=T, prob=c(12, 7, 9,
1)))
mytable <- function(x){
xtb <- x
btx <- x
# do more with x, not relevant here
cat("The table has been created,
2013 Jan 29
2
converting XML document to table or dataframe
I am a relatively new user to R, and I am trying to learn more about
converting data in an XML document into "2-dimensional format" such as a
table or array. I might eventually wish to export this data into a
relational database such as SQL, and/or to work with this data within the R
package.
My sample XML document is located at "
2007 May 12
4
Multiply and format with thousands separator
I have just started with Ruby and Rails and am still greatly confuse,
finding the usual tutorials not much help.
What I want to do is take two numbers from my database, multiply them
together and display them in a list with a comma for the thousands
separator. This would be very easy to do in a spreadsheet, so I assumed
it would be easy to do in Ruby on Rails but I can''t work out how.
I
2007 May 06
1
simple table ordering question
Hi all,
I'm sure this is simple but I don't get it.
I have a table
mytable<-c(rep("Disagree",37),rep("Agree",64))
table(mytable)
this gives me
Agree Disagree
64 37
but I didn't ask for it to be in alphabetic order.
How can I get it in original order?
Disagree Agree
37 64
Thanks,
Jeff
Jeffrey. M. Miller, PhD
2005 Oct 31
2
nlme error message
Dear Friends,
I am seeking for any help on an error message in lme
functions. I use mixed model to analyze a data with
compound symmetric correlation structure. But I get an
error message: "Error in corMatrix.corCompSymm(object) :
NA/NaN/Inf in foreign function call (arg 1)". If I change
the correlation structure to corAR1, then no error. I have
no clue how to solve this problem.
2008 Oct 14
2
Getting frustrated with RMySQL
Getting the basic stuff to work is trivially simple. I can connect, and, for
example, get everything in any given table.
What I have yet to find is how to deal with parameterized queries or how to
do a simple insert (but not of a value known at the time the script is
written - I ultimately want to put my script into a scheduled task, so the
analysis can be repeated on updated data either daily
2006 Nov 29
5
AR, find(:all), loops and memory usage
I''m a beginning programming using ActiveRecord outside of Rails to do
conditional processing of database records. So far, I''ve been
successful. However, my script loads all matching records into memory
first. There are hundreds of thousands of matching records so the
script quickly consumes over 500MB of RAM before any processing is
done. Is there a way to avoid this preloading
2008 Mar 21
5
foreign key question
Hi-
Say I have a db with following schema:
MyTable:
Id, name, user_id, date
User:
id, name, description
I know that I want to add "belongs_to" in my "user" model but how can
I enforce a proper constraint on the user_id in "MyTable"? Is this
done using a has_one in the "MyTable" model?
Thanks!
--~--~---------~--~----~------------~-------~--~----~
You
2006 Apr 11
6
Reduce Number of Queries When Using ActiveRecord
I have a controller method called update_all that grabs parameters for about
30 form fields and saves them to the database. My current code looks to see
if there is a string in params[] for each form field (two fields for each
SelfEvaluationItem) and saves the updated self_evaluation_answer if a string
is available. Since this is iterated code, I am almost certain that this
generates 30 or so