[R] exclusive access to graphic device

2009-11-04 Thread whizvast
Hi, useR- I want to create a graphic device - e.g., windows() - that only specific function(s) have control over. For example, suppose you run the following code: windows() dv = dev.cur() dv "dv" is the index for the graphic device. By passing "dv" value into a new function, I can control the d

Re: [R] connecting to Oracle

2009-10-25 Thread whizvast
nnel, paste("select * from db_name.tbl_name")) whizvast wrote: > > Hi, useR- > > I am connecting to Oracle database using RODBC, but keep getting this > error message: > >> library(RODBC) >> channel <- odbcConnect(dsn="abc", uid="abc", pwd

[R] connecting to Oracle

2009-10-23 Thread whizvast
Hi, useR- I am connecting to Oracle database using RODBC, but keep getting this error message: > library(RODBC) > channel <- odbcConnect(dsn="abc", uid="abc", pwd="abc", case='oracle') Warning in odbcDriverConnect(st, ...) : [RODBC] ERROR: state IM002, code 0, message [Microsoft][ODBC Driver M

Re: [R] RMySQL - overwrite record, not table

2009-08-20 Thread whizvast
Adrian Dusa wrote: > > > whizvast wrote: >> >> Hi, useR- >> >> In RMySQL, how do I overwrite records? (equivalent to "replace" query). >> For example, suppose that dat2 is a newer data.frame than dat1. >> >> con <- dbCon

Re: [R] How do I plot a line followed by two forecast points?

2009-08-07 Thread whizvast
Run this codes: plot( 1:20, type='l') lines( 0.5*1:20, col=2) If you use par(new=T), this will call a new high-level graphic device, which is why the axes do not match. Alternatively, you can set ylim and pass the arguments to two plot functions: plot( rnorm(100), type='h', ylim=c(-3,3)) par(

[R] RMySQL - overwrite record, not table

2009-08-07 Thread whizvast
Hi, useR- In RMySQL, how do I overwrite records? (equivalent to "replace" query). For example, suppose that dat2 is a newer data.frame than dat1. con <- dbConnect(MySQL()) res <- dbWriteTable(con, "DBname", dat1, row.names=F, append=T, replace=T) res <- dbWriteTable(con, "DBname", dat2, row.na

[R] namespace? environment? how to manage functions?

2009-06-18 Thread whizvast
Hi, useRs- I have been building a set of functions over time and now my R_GlobalEnv becomes too crowded. I would like to put all my functions under the same namespace/environment. Ideally, I would like to call them using "env::func" as in C++. The following code almost do the jobs I want - e

[R] overwrite title

2008-12-24 Thread whizvast
Hi, useRs- I have a plot with a title generated automatically. I need to overwrite the title, but I can't figure out how to do that. I've tried the following: title( "abc", bg='white') But, that does not set the title background as white. Now I am stuck and need your help. Thanks- -- View

[R] [ess] no waiting after submitting the command

2008-09-17 Thread whizvast
hi, useRs- i am using R with emacs/ESS (on xubuntu). currently, when i send a large script to ESS process, i have to wait for the whole script to finish. is there a way to immediately return to the editing window after submitting? if there is, how do i set it permanently? thank you in advanc

[R] getting multiple argument names

2008-06-27 Thread whizvast
hi, all- i wrote a function that accept multiple arguments, but don't know how to assign names automatically. run the following code: foo <- function (...) { x = list(...) names(x) <- deparse(substitute(...)) x } a = 1; b = 2; c = 3 y <- foo( a, b, c) names(y) as you can see, only the fir