search for: con2

Displaying 20 results from an estimated 22 matches for "con2".

Did you mean: con
2001 Jul 30
0
Remote controlling R via sockets
...non-blocking sockets # R process 1 con1 <- socketConnection(port = 6011, server=TRUE) writeLines("plot(rnorm(100))", con1) writeLines("plot(rnorm(1000))", con1) writeLines("plot(rnorm(10000))", con1) close(con1) # R process 2 con2 <- socketConnection(Sys.info()["nodename"], port = 6011) # as non-blocking, may need to loop for input source(con2) while(isIncomplete(con2)) {source(con2)} close(con2) However, in the above example, the R "server" is on the client side of the socket conn...
2015 Mar 03
0
Feature request: copy attributes in gzcon
The `gzcon` function both modifies and copies a connection object: # compressed text con1 <- url("http://www.stats.ox.ac.uk/pub/datasets/csb/ch12.dat.gz") con2 <- gzcon(con1) # almost indistinguishable con1==con2 identical(summary(con2), summary(con1)) # both support gzip readLines(con1, n = 3) readLines(con2, n = 3) # opening one opens both isOpen(con2) open(con1) isOpen(con2) In the example, `con1` and `con2` are two different...
2007 Dec 08
1
FW: R memory management
...s.to.get)) { tickers<-sqlQuery(channel,paste("SELECT Symbol FROM symbols_list WHERE Exchange='",exchanges.to.get[x],"';",sep=''))[,1] dir.create(paste(Working.dir,exchanges.to.get[x],'/',sep='')) for (y in 1:length(tickers)) { con2 <- socketConnection(Sys.info()["nodename"], port = ****) #open socket connection to get data writeLines(paste(command,',',tickers[y],',',interval,';',sep=''), con2) data.<-readLines(con2) end.of.data<-sum(c(data.=="!ENDMSG!&...
2007 Dec 18
2
R brakes when submitting a query to MySQL
Hello, I would like to retrieve data stored in MySQL database, so I installed RMySQL package. I can successfully connect with the my database using the following code > dvr<-dbDriver("MySQL") > con2<-dbConnect(dvr,group="exbardiv") > mysqlDescribeConnection(con2) <MySQLConnection:(972,0)> User: mmorag Host: localhost Dbname: exbardiv Connection type: localhost via TCP/IP No resultSet available I can even see the tables in the database > dbListTables(c...
2002 Jan 26
1
Trouble with contrasts
Greetings, I have a nagging problem with contrasts and I can't seem to resolve it. A factor exists with four levels (lib1, lib2, con1, con2) and when I check the contrasts or set the contrasts to any of the prespecified ones, I do not get the exact contrasts necessary to test the theoretically relevant ones. I need orthogonal contrasts that look just like this matrix: con1 con2 con3 lib1 1 0 1 lib2 -1...
2020 Oct 08
0
Lahman Baseball Data Using R DBI Package
Hi Philip, You've probably realized by now that R doesn't like column names that start with a number. If you try to access an R-dataframe column named 2B or 3B with the familiar "$" notation, you'll get an error: > library(DBI) > library(RSQLite) > con2 <- dbConnect(SQLite(), "~/R_Dir/lahmansbaseballdb.sqlite") > Hack12Batting <- dbGetQuery(con2,"SELECT * FROM batting WHERE yearID = 2018 AND AB >600 ORDER BY AB DESC") > Hack12Batting$AB [1] 664 661 639 632 632 632 626 623 620 618 617 613 606 605 602 > Hack12B...
2006 Nov 17
2
Forming SQL Query at run-time
Hi. I am trying to get data from mysql database using a couple of queries. I do one query to find out the indexes. Then i need to use these indexes in another query, but i keep getting errors. Here is something: numb <- dbSendQuery(con2, "select distinct(comparison) from table1") count <- fetch(numb, -1) my.matrix <- as.matrix(count) rs <- dbSendQuery(con2, "select A.comparison,A.id, A.q_value, B.q_value from table1 as A, table1 as B where A.comparison = 'my.matrix[11481]' AND B.comparison = 250...
2020 Oct 08
1
Lahman Baseball Data Using R DBI Package
...You've probably realized by now that R doesn't like column names that > start with a number. If you try to access an R-dataframe column named > 2B or 3B with the familiar "$" notation, you'll get an error: > > > library(DBI) > > library(RSQLite) > > con2 <- dbConnect(SQLite(), "~/R_Dir/lahmansbaseballdb.sqlite") > > Hack12Batting <- dbGetQuery(con2,"SELECT * FROM batting WHERE yearID = > 2018 AND AB >600 ORDER BY AB DESC") > > Hack12Batting$AB > [1] 664 661 639 632 632 632 626 623 620 618 617 613 606...
2020 Oct 03
1
Lahman Baseball Data Using R DBI Package
The double quotes are required by SQL if a name is not of the form letter-followed-by-any-number-of-letters-or-numbers or if the name is a SQL keyword like 'where' or 'select'. If you are doing this from a function, you may as well quote all the names. -Bill On Fri, Oct 2, 2020 at 6:18 PM Philip <herd_dog at cox.net> wrote: > The \?2B\? worked. Have no idea why. Can
2020 Jun 29
0
A warning in gzcon but not in gzfile
...n) > ## write data to a file > file_path <- tempfile() > writeBin(data, file_path) > ## Read the data using `gzfile` > con1 <- gzfile(file_path) > str(readLines(con1, 1000)) > ## Read the data using `gzcon` > ## We create a raw connection from the raw vector > con2 <- gzcon(rawConnection(data)) > str(readLines(con2, 1000)) output: > > str(readLines(con1, 1000)) > chr [1:1000] "##fileformat=VCFv4.2" "##hailversion=0.2.24-9cd88d97bedd" > ... > > str(readLines(con2, 1000)) > chr [1:884] "##fileformat=VCFv4...
2003 Apr 29
0
calling R from PHP and saving outputs
...n='right'> ESSAI : </th> <td> ... </td> <td> <?php echo($essai->sortie); ?> </td> </tr> </table> _R script :_ (commande.R) zz <- file("/home/faisnel/Rscripts/testphp2.Rout", open="wt"); sink(zz); library(RMySQL); con2 <- dbConnect("MySQL"); result <- dbGetQuery(con2,"select URL from isp_info"); dbListTables(con2); result; dbDisconnect(con2); sink();
2013 Aug 09
1
Agrupar los terminos de la leyenda
...ggplot.. Aunque no quedó tan limpio como el de Carlos (gran resolucion) tambien te sirve. Un saludo library(ggplot2) dec.df <- mat[mat$sol=="dec",] lim.df <- mat[mat$sol=="lim",] dol.df <- mat[mat$sol=="dol",] dec.dr<-qplot(dia,V5,sol,data=dec.df,color=con2,geom=c("line"),facets=.~sol) lim.dr <- qplot(dia,V5,sol,data=lim.df,color=con2,geom=c("line"),facets=.~sol) dol.dr <- qplot(dia,V5,sol,data=dol.df,color=con2,geom=c("line"),facets=.~sol) grid.newpage() # Open a new page on grid device pushViewport(viewport(la...
2009 Jan 28
3
initial value in 'vmmin' is not finite
...onstant,feature[,1],price[,1])> dan=cbind(constant,feature[,2],price[,2])> hil=cbind(constant,feature[,3],price[,3])> wt=cbind(feature[,4],price[,4])> > fr <- function(x) { + x1 = x[1]+ x2 = x[2]+ x3 = x[3]+ x4 = x[4]+ x5 = x[5]+ x6 = x[6]+ x7 = x[7]+ con1 = rbind(x[1],x[5],x[6])+ con2 = rbind(x[2],x[5],x[6])+ con3 = rbind(x[3],x[5],x[6])+ con4 = rbind(x[5],x[6])+ rho=exp(x[7])/(1+exp(x[7]))+ ey = exp((yop%*%con1)/rho)+ ed = exp((dan%*%con2)/rho)+ eh = exp((hil%*%con3)/rho)+ ew = exp((wt%*%con4)/rho)+ ev = ey+ed+eh+ew+ den=(ey+ed+eh+ew)+ iv = rho*log(den)+ pp=exp(x[4]+iv)/(1+exp(...
2009 Mar 02
1
initial gradient and vmmin not finite
...ogurt[,14:17] feature=yogurt[,6:9] n = nrow(yogurt) constant = rep(1,n) yop=cbind(constant,feature[,1],price[,1]) dan=cbind(constant,feature[,2],price[,2]) hil=cbind(constant,feature[,3],price[,3]) wt=cbind(feature[,4],price[,4]) library(maxLik) fr <- function(x) { con1 = rbind(x[1],x[5],x[6]) con2 = rbind(x[2],x[5],x[6]) con3 = rbind(x[3],x[5],x[6]) con4 = rbind(x[5],x[6]) rho = exp(x[7])/(1+exp(x[7])) ey = exp((yop%*%con1)/rho) ed = exp((dan%*%con2)/rho) eh = exp((hil%*%con3)/rho) ew = exp((wt%*%con4)/rho) ev = ey+ed+eh+ew den=(ey+ed+eh+ew) iv = rho*log(den) pp=exp(x[4]+iv)/(1+exp(x[4]+iv))...
2016 Oct 30
0
closeAllConnections() can really mess things up
...mode text "foo1" "textConnection" "w" "text" opened can read can write "opened" "no" "yes" > closeAllConnections() > con2 <- textConnection("foo2", open = "w") ## Hmm... at this point, con1 point to con2. > print(con1) description class mode text "foo2" "textConnection" "w" "text&quot...
2011 Aug 08
2
RODBC: sqlUpdate doesn't handle properly POSIXct field?
...errors while using fast=FALSE argument to safely update/ignore duplicates: Error while executing the query[RODBC] ERROR: Could not SQLExecDirect 'UPDATE "data" SET "logger"=1, "value"=0.0321584 WHERE "time"=2008-09-22 13:15:00' Error in sqlUpdate(con2, na.omit(dat), "data", fast = FALSE) : 42601 7 ERROR: syntax error at or near "13"; It looks like POSIXct class is not escaped properly. I have R 2.12.2 running on Windows XP 32 bit, and I’m using PostgreSQL database. Column time is supposedly of ‘timestamp without t...
2010 Aug 13
1
decision tree finetune
...stead of "2) Info_G<0.5". Thank you in advance! And thanks for Eric who helped with my previous question about starting "rpart". Olga > fit <- rpart(Retention ~ Info_G+AOPD+Mail+Xref_Umbr+Ins_Age+Discount+Xref_A + Con6 + + Con5 + Con4 + + Con3 + Con2 + + Con1 , data=Home,control=rpart.control(minsplit=5)) > > fit n= 48407 node), split, n, deviance, yval * denotes terminal node 1) root 48407 4730.642 0.8902225 2) Info_G< 0.5 14280 1999.293 0.8316527 * 3) Info_G>=0.5 34127 2661.865 0.9147303 * > [[alternative HTML vers...
2009 Dec 02
0
[Fwd: Re: Adding and Multiplying two Unevaluated Expressions]
...<20091201144125.316310 at gmx.net> <8E40E49F-E8FC-4FBD-8CC5-93789FFB0E53 at auckland.ac.nz> This works fine for your example, but doesn't work as simple if there's more than these expressions. In my example this would be in line 11: newexp=as.expression(substitute(a+con1/con2*b^con3,list(a=newexp[[1]],b=expression(dx)[[1]],con1=eval(exp0,ls),con2=factorial(i),con3=1*i))) this works just fine and you can still evaluate this. thank you very much! If there's an easier way, let me know. Greets, Ben M?ller Rolf Turner schrieb: > > On 2/12/2009, at 3:41 AM, Benj...
2005 Sep 26
2
constrOptim (PR#8158)
Full_Name: Haobo Ren Version: 2.1.1 OS: Windows 2000 Submission from: (NULL) (192.11.226.116) When running constrOptim, there is error message Error: subscript out of bounds
2008 Apr 11
1
Read text file subsetting rows
Hi All, Can anyone direct me to a read function in R that will allow me to only read in rows of a text file that begin with a particular value such as the data below. I would read the entire file in and then limit, but the files were constructed such that the first two letters determine how many variables are in the row (different letters mean different numbers of columns and different