search for: tablenam

Displaying 20 results from an estimated 173 matches for "tablenam".

Did you mean: tablename
2011 Jul 27
1
Referencing a column using a function argument
...ould be fairly straight forward. Any help at all from more experienced users is appreciated! I'd like to write a function that uses a column name as an argument. However, I run into problems when I try to reference this column within the function. For example, findCutoff <- function(tableName, columnName) { temporaryTable <- subset(tableName, select = c(V1, V4, columnName)) x <- length(tableName$columnName [tableName$columnName > 6] ) ...etc. } I know a couple of ways to reference a column: 1. tableName$c...
2000 Mar 08
2
possible BUG with as.data.frame() and/or [.data.frame
Here is a possible BUG with as.data.frame() and/or [.data.frame which broke Michael Lapsleys RODBC-Code. Can anyone confirm it is a bug or a 'feature' of the prototype? tablename <- "abc" a <- as.data.frame(cbind("abc", 1:3)) b <- as.data.frame(cbind(tablename, 1:3)) # ok > a V1 V2 1 abc 1 2 abc 2 3 abc 3 # missing column name > b tablename 1 abc 1 2 abc 2 3 abc 3 # subsetting ok > b[1,1] [1] abc Levels: a...
2012 Jun 18
4
Problem with exists? method
Hi, I have a DB with table TABLENAME, column COLUMN and an active resource client trying to connect to the DB. When i do Tablename.find(:all) => i get all the entries from the table But Tablename.exists?(:column => value) always returns false I verified that the above command works from rails console. Dont understand why it al...
2008 May 07
0
RODBC sqlSave with multiple schema in DB2
Hi, I am trying to use sqlSave to write a dataframe to an existing table in a DB2 database. The database contains two schemas. My experience is the following: (1) in the case that tablename is left empty in sqlSave, R writes to the instance level schema (2) in the case that a tablename is specified and that table name exists only once in the database, R will write to that table irrespective of the schema in which it resides (3) in the case that a tablename is specified and the t...
2007 Mar 23
6
Updating a worksheet in Excel file using RODBC
...a "table" which can be read - at least in my case). What I would like to do is to read such a table, change it (just the contents, not the format) and write it back, and this I can not do. I am getting the following error messages (3 slightly different attempts): > sqlSave(con, x, tablename = "Chimaera20_3years$", append = FALSE, + rownames = FALSE, colnames = TRUE, + verbose = TRUE, oldstyle = FALSE,safer=FALSE) Query: CREATE TABLE Chimaera20_3years$ (Date varchar(255), 000Tax varchar(255), 1500Tax varchar(255), 3000Tax varchar(255), 4650Tax varchar(255))...
2007 Jun 26
2
MySQL Where conditions automatic formatting
Hi, I''m having a problem with the automatic formatting of my mysql query. My code is this: Tablename.find(:all, :conditions => {:id => list}) Where list is a list of id''s (8,9,10) The problem is that the query is automatically formatted to this: SELECT * FROM Tablename WHERE (id in (''8,7,9'')) I need this query to run without the extra single quotes to work pro...
2004 May 10
3
sqlSave with underscores in table fieldname
Hi group, I try to write a frame to a table (RODBC). I use colnames(temp6) <- c("ind_id","ser_id","period_id","year","calc","mean") sqlSave(channel, temp6, tablename = "series_indices_test",append= TRUE, rownames=FALSE, verbose = FALSE, test = FALSE, nastring = -999999, fast = FALSE) This is giving me an error: Error in sqlSave(channel, temp6, tablename = "series_indices_test", append = TRUE, : unable to append to table %sserie...
2004 Nov 02
2
A little more on R, mdbtools and Access databases
...ome quick code to make use of mdb-tools to use MS Access tables in R. ### 2004-11-02 ### David Whiting require(gdata) # for the trim function. mdbTables <- function(dbname) { system(paste("mdb-tables -d '\t' -S", dbname), intern=TRUE) } mdbReadTable <- function(dbname,tableName) { tableName <- dQuote(tableName) read.table(pipe(paste("mdb-export -d '\t' ", dbname, tableName)), sep="\t", header=TRUE) } mdbDescribe <- function(dbname,tableName) { tableName <- dQuote(tableName) cat("describe table ", tableName, "...
2006 Jul 28
2
Scaffold and Undercores in Tablenames
I am attempting to generate scaffolds on legacy tables that have underscores in the name. Scaffold does not see the underscore. I have tried a backslash escape but it no work. I have looked around but i cannot find a way to make it work. It''s like this: c:\railroad>ruby script/generate scaffold FOO_BAR exists app/controllers/ exists app/helpers/ create
2012 Apr 05
3
help in paste command
i have a character variable tablename="DressMaterials" var1=("red","blue","green","white") My output should be like select * from DressMaterialswhere colors in ("red","blue","green","white") i'm not able to get the where part. my code...
2018 Jan 24
1
Help with SQLsave
...i all, I'm using RODBC library to connect to a database. I'm trying to read a table from a database and after manipulating it would like to write to the same database but with a different table P<-data.frame(sqlQuery(myconn,'select? *? from Demographics')) sqlSave(myconn,p,tablename="trial",rownames=FALSE) I'm gettng this error Version:1.0 StartHTML:0000000107 EndHTML:0000001014 StartFragment:0000000127 EndFragment:0000000996 Error in sqlSave(myconn, p, tablename = "trial", rownames = FALSE) : [RODBC] Failed exec in Update 22018 0 [Micros...
2000 Mar 08
0
RODBC: follow up
...to return a data.frame. Or better those functions have to check on their own and to build up the COMPLETE data frame using odbcFetchRow() until all rows are fetched. Of course this should not be R-code but C-code, as looping in R is not a good idea. (2) in sqlSave() if (any(sqlTables(0)[3] == tablename)) { probably should read if (any(sqlTables(channel)[3] == tablename)) { furthermore if sqlTables() fails with "[RODBC]ERROR: Row count not supported" this check for existence is currently not reliable (sqlTables() silently returns a one-line data.frame). (3, see posting to r-deve...
2006 Jun 09
3
sqlSave() and rownames=TRUE makes my Rgui crash
....frame(matrix(1:6,2,3)) colnames(dframe)=c("id","col1","col2") dframe # id col1 col2 #1 1 3 5 #2 2 4 6 ### But this makes Rgui crash and close chan <- odbcConnect("MySQL51", uid="root", pwd="xxx") sqlSave(chan, dframe, tablename="example", rownames = FALSE, append=T) close(chan) ### With rownames = T and safer=F, it works, but I loose the autoincrementing PK in MySQL chan <- odbcConnect("MySQL51", uid="root", pwd="momie") #default database=fbn sqlSave(chan, dframe, tablename=&q...
2013 Oct 08
0
PostGIS 2.1 rasters available to Rails code: breadcrumbs
...o, NULL pixels will probably tank the getter. # Fixing those is left as an exercise :-) class PostGisRaster < ActiveRecord::Base self.primary_key = ''rid'' # Grab a band of a raster out of the database and convert it to a 2D array. Defaults to first band (1) def self.to_a(tablename,id,band=1) id = id.to_i str = connection.select_value("select st_dumpvalues(rast,#{band}) from #{tablename} where #{primary_key}=#{id}") str.gsub!(''{'',''['') str.gsub!(''}'','']'') eval(str) end #...
2012 May 29
1
RODBC, Excel, and data truncation when writing
...be the cell width limit in Excel. Below is example code and the warning message received: library(RODBC) d <- data.frame(v1=c(1,2),v2=c(paste(rep("test",100),collapse=""),"test")) z <- odbcConnectExcel2007("test_rodbc.xlsx",readOnly=FALSE) sqlSave(z,d,tablename="Sheet1",rownames=FALSE) odbcClose(z) Warning message: In odbcUpdate(channel, query, mydata, coldata[m, ], test = test, : character data 'testtesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttesttestte...
2009 May 29
1
RODBC sqlSave with DB2
...ks fine. (Data.frame dta is created with records from the DB2 table.): sql <- "select * from storage.testappend_slt order by uut" dta <- sqlQuery(channel,sql) But when I try to append records (from data.frame newdta) to the same DB2 table. I get an error: sqlSave(channel, newdta, tablename = storage.testappend_slt, append = TRUE, + rownames = FALSE, colnames = FALSE, + verbose = FALSE, oldstyle = FALSE,, + safer = TRUE, addPK = FALSE, typeInfo, varTypes, + fast = TRUE, test = FALSE, nastring = NULL) Error in sqlSave(channel, dta, tablename = storage....
2019 Apr 16
3
PROBLEMAS NOMBRES DE COLUMNAS CON ESPACIOS CONEXION R-SQL
Buenas tardes, Estoy tratando de realizar un update en SQL desde R: sqlUpdate(conexion1, data.frame(AUXILIAR), tablename = "AUXILIAR") y me devuelve el siguiente error: *Error in sqlUpdate(conexion1, data.frame(AUXILIAR), tablename = "AUXILIAR", : * * data frame column(s) Corteoptimo Cortediario not in database table* El problema es que sí existen esas columnas en SQL pero parece que R está a...
2009 Aug 18
1
Specify Database location from R
...m trying to write a table to a specific location in my database from R. When I use the following code, it is going directly into the first part of the server which is named 'master' I want to put it onto a different part of the server called 'HRISK_1'. I think I have to change the tablename location or specify the location in the databse somehow. Could you please help me with the syntax of doing this? Thanks Conrad position = read.csv(file = "Position_FTSEhx.csv", header = TRUE) dataf = data.frame(position) library(RODBC) tt = odbcConnect("SOUTHAMPTON", uid...
2010 May 20
0
RODBC: sqlSave leave primary key and other columns null
I have an existing table, and I am trying to use sqlSave to append additional rows to this database. I omit the primary key, which is a uniqueidentifier type (MS SQL), so that the database can populate that field. However, I get the following error: > sqlSave( ch, result, tablename=thetablename, append=TRUE, rownames=FALSE, colnames=FALSE ) Error in odbcUpdate(channel, query, mydata, coldata[m, ], test = test, : missing columns in 'data' Enter a frame number, or 0 to exit 1: sqlSave(ch, result, tablename = "CreditLadderData", append = TRUE, rowname...
2009 Mar 05
0
Insert using Rake Task
Hi, Anyone can help me, I run my source code using rake task. It seems no error was trace, but when I look the table it doesn''t insert.I select the data here MysqlDB.Tablename and update/insert here SQLserverDB.TableName. # Start Here # rake mysqldata_select:sqldata_update def clean_html(html) new_html = strip_tags(html) # remove html tags new_html = decode_entities(new_html) # remove html encoded items new_html = new_html.strip # remove any whitespace from the e...