similar to: Reading lines from file

Displaying 20 results from an estimated 10000 matches similar to: "Reading lines from file"

2006 Mar 02
5
Deparsing '...'
Hi, The following function works, but is there a neater way to write it? f = function(x,...) { # return a character vector of the arguments passed in after 'x' gsub(" ","",unlist(strsplit(deparse(substitute(list(...))),"[(,)]")))[-1] } > f(x,a,b,c*d) [1] "a" "b" "c*d" > Thanks. [[alternative HTML
2005 Dec 06
3
reading in data with variable length
I have very large csv files (up to 1GB each of ASCII text). I'd like to be able to read them directly in to R. The problem I am having is with the variable length of the data in each record. Here's a (simplified) example: $ cat foo.csv Name,Start Month,Data Foo,10,-0.5615,2.3065,0.1589,-0.3649,1.5955
2010 May 06
2
reading formatted txt file into a data frame
Dear all Lets say I have a plain text file as follows: > cat(c("[ID: 001 ] [Writer: Steven Moffat ] [Rating: 8.9 ] Doctor Who", + "[ID: 002 ] [Writer: Joss Whedon ] [Rating: 8.8 ] Buffy", + "[ID: 003 ] [Writer: J. Michael Straczynski ] [Rating: 7.4 ] Babylon [5]"), + sep = "\n", file = "tmp.txt") I would somehow like to read
2009 Mar 18
1
Reading a file line by line - separating lines VS separating columns
Hello all. I wish to read a large data set into R. My current issue is in getting the data so that R would be able to access it. Using read.table won't work since the data is over 1GB in size (and I am using windows XP), so my plan was to read the file chunk by chunk and each time move it into bigmemory (I'll play with that when the time will come, maybe ff is better ?!). I encountered
2006 Jun 27
3
reading a matrix from a file
Hello everyone, I'm writting a little script that will read a matrix from a file i.e. 0,.11,.22,.4 .11,0,.5,.3 .22,.5,0,.7 anb so on and will then calculate some standard stats for nets (i.e. centralization, degree, etc). So far I have opened the file and read the contents, however I' m using readLines(filename) to read the file and it returns it as
2011 Sep 14
1
Open file for reading and writing with APPEND
Hi, I want to keep a running file of some statistics generated by a running process. Occasionally the process will be restarted. On restart, I'd like to read the last line of the log file to set some variables to their last state, and then continue to append values to that same file. I can't seem to get the appending part to work. I can read values form the file, but then upon the
2011 Nov 17
2
how to read a freetext line ?
hi everyone . Here I have a text where there are some integer and string variables.But I can not read them by readLines and scan the text is : weight ;30;130 food:2;1;12 color:white;black the first column is the names of the variables and others are the value of them. the column in different line are different. Can anyone help me ? -- TANG Jie Email: totangjie@gmail.com Tel: 0086-2154896104
2003 Mar 31
4
Convert char vector to numeric table
I'm a great fan of read.table(), but this time the data had a lot of cruft. So I used readLines() and editted the char vector to eventually get something like this: " 23.4 1.5 4.2" " 19.1 2.2 4.1" and so on. To get that into a 3 col numeric table, I first just used: writeLines(data,"tempfile")
2008 Apr 07
2
read.table with multiple header lines
Hello, I have difficulties in reading in a text file with multiple (=2) header lines. My table looks like this: id code gr grcode AA AB AC AD time 30 40 50 60 1 1234 1 c 0 1 0 0 2 1346 1 c 0 0 0 1 3 1456 1 c 0 0 1 1 4 1893 1 c 0 0 1 1 Can someone help me out? Thanks Deborah --
2006 Feb 22
8
filtering "tags" via checkboxes - HABTM
First post/newbie post... bear with me. What I''m trying to achive (music site): A system containing tracks and moods with a HABTM relationship. I''ve got all that set up and functioning in the admin environment - i.e. admins can apply a variety of moods to a particular track via a series of checkboxes. Join table works just fine. I''m currently stuck on allowing
2012 Mar 01
2
read.table issue with "#"
Hello, > > The problem is that I get a the following error bacause anything after the > # is ignored. > > Error in scan(file, what, nmax, sep, dec, quote, skip, nlines, na.strings, > : > line 6 did not have 500 elements > > R thinks that line 6 has only 2 elements because of the #. > Use 'readLines' instead, followed by 'strsplit'. In the
2017 Mar 21
3
Public share ask for a password
On Tue, 21 Mar 2017 16:21:23 +0100 "L.P.H. van Belle via samba" <samba at lists.samba.org> wrote: > Hai, > >   > > I suggest NOT to use fstab but systemd startups if you on debian > jessie. > >   > > Get to know systemd and if you do i’ll bet you like it. > > I know only on that hates it.. dont you Rowland. ;-) I am not the only one
2009 Nov 18
2
parsing numeric values
Dear list, I'm seeking advice to extract some numeric values from a log file created by an external program. Consider the following example, input <- readLines(textConnection( "some text <ax> = 1.3770E-03 <bx> = 3.4644E-07 <ay> = 1.9412E-04 <by> = 4.8840E-08 other text <aax> = 1.3770E-03 <bbx> = 3.4644E-07
2004 Feb 03
2
problem with read.table
Any ideas why read.table complains about not correct number of elements in line while readLine/strsplit indicate that all lines have the same number of elements ? R > tbl <- read.table('tmp', header = T, sep = '\t') Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : line 32 did not have 27 elements > lines <-
2008 Oct 01
4
Pxelinux freezed
Some time ago, I sent a email to list. With my perfect english, wasn't possible explain my problem, then I recorded a video, end upload to youtube. Please watch the video. http://www.youtube.com/watch?v=z1KJ8sA4_5w Samuel Rios Carvalho
2008 Sep 05
1
reading and parsing gzipped files
Hi all,I have large compressed text tab delimited files, I am trying to write efficient function to read them, I am using gzfile() and readLines() zz <- gzfile("exampl.txt.gz", "r") # compressed file system.time(temp1<-readLines(zz )) close(zz) which work fast, and create vector of strings. The problem is to parse the result, if I use strsplit it takes longer
2013 Feb 07
4
help with creating new variables using a loop
Hi there, I've got a set of 10 numeric variables called Mood1 to Mood10 in a dataset called mood. I'm trying to create a set of 10 new variables called m1 to m10 so that m1=Mood1*1, m2=Mood2*2, etc to m10=Mood10*10 Trawling through the internet, I eventually tried the following code: for (i in 1:10){ assign(x=paste0("mood$m",i),
2009 Oct 13
1
Iterating over file lines
I am attempting to iterate over a file, processing it line by line. In my function below, I am only getting the first item over and over and over again from my test file rather than subsequent lines. How can I modify this to read lines sequentially? == iteratefile <- function(file) { f.con <- file(file) on.exit(close(f.con)) while( length(readln <- readLines(f.con, 1)) > 0 ) {
2008 Sep 23
2
read.table & readLines behaviour?
Hi, I have been using 'read.table' regularly to read tab-delimited text files with data. No problem, until now. Now I have a file that appeared to have read fine, and the data inside looks correct (structure etc), except I only had 15000+ rows out of the expected 24000. Using 'readLines' instead, and breaking up the data by tabs, gives me the expected result. I do not
2013 Mar 07
2
How to transpose it in a fast way?
Dear all: I have a big data file of 60000 columns and 60000 rows like that: AA AC AA AA .......AT CC CC CT CT.......TC .......................... ......................... I want to transpose it and the output is a new like that AA CC ............ AC CC............ AA CT............. AA CT......... .................... .................... AT TC............. The keypoint is I can't read