Displaying 2 results from an estimated 2 matches for "tabledf".
Did you mean:
tabledef
2012 Mar 06
3
Label rows of table by factor level for groups of factors
...sify each row in the table and I find that I have 4 unique combinations of factors. I would now like to add a fourth column to df which labels each row according to whether it was unique combination 1,2,3 or 4:
x1=c(rep(0:1,6))
x2=c(rep(c(1,1,0,0)6))
x3=c(rep(1,6),rep(0,6))
df=data.frame(x1,x2,x3)
tabledf=as.data.frame(with(df, table(x1,x2,x3)))
res=c(3,4,3,4,3,4,1,2,1,2,1,2)
desired=data.frame(x1,x2,x3,res)
df
tabledf
desired
I realise that this is probably quite simple to do, I am just struggling to get my head around it! Help much appreciated in advance.
Cheers,
Simon
-----------------------...
2011 May 25
1
Time and db precision
...larly checks for new data to analyse in my database. In order to facilitate this, the database table has a timestamp column with the time that the data was inserted into the database. Something like this:
while (....) {
load(timetoken.Rdata)
df <- sqlQuery(con, paste("SELECT * FROM tabledf WHERE timestamp > ", timetoken, sep = ""))
analyse(df)
timetoken <- max(df$timestamp)
save(timetoken, file = "timetoken.Rdata")
Sys.sleep(60)
}
Now this used to work fairly well with R and PostgreSQL on Windows, but on Ubuntu, I'm getting a lot of...