yvette....@gmail.com
unread,Dec 7, 2014, 2:48:44 PM12/7/14Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to sq...@googlegroups.com
I am trying to find why when running this piece of code using sqldf commands it produces a warning message about unused connection:
code:
library(sqldf)
## Create a small DF
subject <- 1:10
gender <- sample(c("F","M"), 10, replace=TRUE)
DF1 <- data.frame(subject, gender)
# Write myDF to a txt file
write.csv(DF1, "myTestFile.txt", row.names=FALSE)
DF2 <- read.csv.sql("myTestFile.txt", 'select * from file')
## write some information on that DF
str(DF2)
summary(DF2)
What it gives:
library(sqldf)
>
> ## Create a small DF
> subject <- 1:10
> gender <- sample(c("F","M"), 10, replace=TRUE)
>
> DF1 <- data.frame(subject, gender)
>
> # Write myDF to a txt file
> write.csv(DF1, "myTestFile.txt", row.names=FALSE)
>
> DF2 <- read.csv.sql("myTestFile.txt", 'select * from file')
Warning message:
closing unused connection 3 (myTestFile.txt)
>
> ## write some information on that DF
> str(DF2)
'data.frame': 10 obs. of 2 variables:
$ subject: int 1 2 3 4 5 6 7 8 9 10
$ gender : chr "\"M\"" "\"M\"" "\"M\"" "\"F\"" ...
> summary(DF2)
subject gender
Min. : 1.00 Length:10
1st Qu.: 3.25 Class :character
Median : 5.50 Mode :character
Mean : 5.50
3rd Qu.: 7.75
Max. :10.00
Warning message:
closing unused connection 4 (myTestFile.txt)
Any idea?
Arguments forgot?