An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110622/98745423/attachment.pl>
question about read.columns
10 messages · Changbin Du, Gabor Grothendieck
On Wed, Jun 22, 2011 at 5:45 PM, Changbin Du <changbind at gmail.com> wrote:
HI, Dear R community,
I have a large data set names dd.txt, the columns are: there are 2402
variables.
a1, b1, ..z1, a11, b11, ...z11, a111, b111, ..z111..
IF I dont know the relative position of the columns, but I know I need the
following variables:
var<-c(a1, c1,a11,b11,f111)
Can I use read.columns to read the data into R?
I have tried the following codes, but it does not work
hh<-read.columns("/house/homedirs/c/cdu/operon/gh/dd.dimer",
required.col=NULL, text.to.search=var, sep="\t", skip=0, quote="", fill=T)
Depending on the precise format of the input you might be able to use read.csv.sql in sqldf. (You may need to modify the args a bit relative to what is shown below but the basic idea is hopefully clear.) See ?read.csv.sql and also the examples on the sqldf home page (http://sqldf.googlecode.com) for more info. library(sqldf) DF <- read.csv.sql("myfile", header = FALSE, sep = "\t", sql = "select a1,c1,a11,b11,f111 from file")
Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110622/c5e74045/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110622/85a940d8/attachment.pl>
On Wed, Jun 22, 2011 at 6:01 PM, Changbin Du <changbind at gmail.com> wrote:
I found the following errors:
library(sqldf)
Loading required package: DBI Loading required package: RSQLite Loading required package: RSQLite.extfuns Error: package 'RSQLite' 0.8-0 is loaded, but >= 0.9.1 is required by 'RSQLite.extfuns'
hh<-read.csv.sql("/house/homedirs/c/cdu/operon/gh5/hypo_re.dimer",
header=FALSE, sep="\t",sql="select varr from file", quote="", fill=T)
Error: could not find function "read.csv.sql"
Make sure you are using the most recent versions of R, RSQLite and sqldf.
packageVersion("sqldf")
[1] ?0.4.1?
packageVersion("RSQLite")
[1] ?0.9.4?
R.version.string
[1] "R version 2.13.0 Patched (2011-06-09 r56106)"
Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110622/f736b084/attachment.pl>
On Wed, Jun 22, 2011 at 6:10 PM, Changbin Du <changbind at gmail.com> wrote:
My R is 2.12.0.
R.version.string
[1] "R version 2.12.0 (2010-10-15)"
packageVersion("RSQLite")
[1] '0.8.0'
packageVersion("sqldf")
[1] '0.3.5' So it seems I have to update or install the 2.13.0 version in my linux machine.
R 2.12 might work but you should certainly update your packages.
Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110622/389f2e79/attachment.pl>
An embedded and charset-unspecified text was scrubbed... Name: not available URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20110622/6866ec5d/attachment.pl>
On Wed, Jun 22, 2011 at 7:07 PM, Changbin Du <changbind at gmail.com> wrote:
INstalling of "RSQLite" was successful. in R:
packageVersion("RSQLite")
[1] '0.9.4' When I try to install "sqldf", I found the following errors:
install.packages("sqldf")
Installing package(s) into '/house/homedirs/c/cdu/library/' (as 'lib' is unspecified) trying URL 'http://cran.cnr.Berkeley.edu/src/contrib/sqldf_0.4-0.tar.gz' Content type 'application/x-gzip' length 19920 bytes (19 Kb) opened URL ================================================== downloaded 19 Kb ERROR: failed to lock directory '/house/homedirs/c/cdu/library' for modifying Try removing '/house/homedirs/c/cdu/library/00LOCK' The downloaded packages are in ??? '/tmp/RtmpszmT38/downloaded_packages' Warning message: In install.packages("sqldf") : ? installation of package 'sqldf' had non-zero exit status When I try to remove the /house/homedirs/c/cdu/library/00LOCK'? by rm -r 00LOCK, I got the following errors: cdu at nuuk:~/library$ rm -r 00LOCK rm: cannot remove `00LOCK/RSQLite/libs/.nfs00000001301e52e000000004': Device or resource busy Not known what happened. Gabor, do you have? any idea? Thanks!
You will need to remove the lock file. Try shutting down any processes that could be trying to access it *e.g. all R processes and all shells) and then try removing it again. If need be change the file's permissions and/or try as root.
Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com