Re: [R] sqldf and not converting integers to floating point in SQLite

2012-01-03 Thread jim holtman
try this: > library(sqldf) > table1 <- read.csv(text = "POSTAL | VALUE + 1000|49 + 1010|100 + 1020|50", sep="|") > table2 <- read.csv(text = "INSEE | POSTAL + A|1000 + B|1000 + C|1010 + D|1020", sep="|") > table3 <- sqldf(" + select table2.INSEE + , 1.0 * table1.VALUE / counts.nPos

[R] sqldf and not converting integers to floating point in SQLite

2012-01-03 Thread Frederik Vanrenterghem
Hi, I have following 2 tables: Table 1: POSTAL | VALUE 1000|49 1010|100 1020|50 Table 2: INSEE | POSTAL A|1000 B|1000 C|1010 D|1020 I would like to convert this to the following: INSEE | VALUE_SPREAD A|24.5 B|24.5 C|100 D|50 I can achieve this with a nested SQL query (through counting the num