Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7965301
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 4, 20262026-06-04T06:06:55+00:00 2026-06-04T06:06:55+00:00

Possible Duplicate: Some issues trying to read a file with cbc.read.table function in R

  • 0

Possible Duplicate:
Some issues trying to read a file with cbc.read.table function in R + using filter while reading files

a)I’m trying to read a relatively big .txt file with the function cbc.read.table from the colbycol package in R. According to what I’ve been reading this package makes job easier when we have large files (more than a GB to be read in R) and we don’t need all of the columns/variables for our analysis. Also, I read that the function cbc.read.table could support the same read.table‘s parameters. However, if I pass the parameter nrows (in order to get a preview of my file in R) I get the following error:

#My line code. I'm just reading columns 5,6,7,8 out of 27
i.can <- cbc.read.table( "xxx.txt", header = T, sep = "\t",just.read=5:8, nrows=20)
#error message
Error in read.table(file, nrows = 50, sep = sep, header = header, ...) : 
formal argument "nrows" matched by multiple actual arguments

So, my question is: could you tell me how can I solve this problem?

b) After that, I tried to read all instances with the following code:

i.can.b <- cbc.read.table( "xxx.txt", header = T, sep = "\t",just.read=4:8) #done perfectly
my.df <- as.data.frame(i.can.b) #getting error in this line
Error in readSingleKey(con, map, key) : unable to obtain value for key 'Company' #Company is a string column in my data set

So, my question is again: How can I solve this?

c) Do you know a way in which I can filter (by conditions on instances) while reading files?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-04T06:06:57+00:00Added an answer on June 4, 2026 at 6:06 am

    In reply to a):

    cbc.read.table() reads in the data in 50 row chunks:

    tmp.data <- read.table(file, nrows = 50, sep = sep, header = header, 
            ...)
    

    Since the function already assigns the nrows argument the value 50, when it passes the nrows argument that you specify, there are two nrows arguments passed to read.table(), resulting in the error. To me, this seems to be a bug. To get around this, you can either modify the cbc.read.table() function to handle the specified nrows argument or accept something like a max.rows argument (and perhaps pass it along to the maintainer as a potential patch). Alternatively, you can specify the sample.pct argument, which specifies the proportion of rows to read. So, if the file contains 100 rows, and you only want 50: sample.pct = 0.5.

    In reply to b):

    Not sure what that error means. It is hard to diagnose without a reproducible example. Do you get the same error if you read in a smaller file?

    In reply to c):

    I generally prefer storing very large character data in a relational database, such as MySQL. It might be easier in your case to use the RSQLite package, which embeds an SQLite engine within R. Then SQL SELECT queries can be used to retrieve conditional subsets of data. Other packages for larger-than-memory data can be found under Large memory and out-of-memory data here: http://cran.r-project.org/web/views/HighPerformanceComputing.html

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Possible Duplicate: Why would you ever implement finalize()? I saw some java files with
Possible Duplicate: What does jQuery.fn mean? I have some script on a page trying
I'm trying to duplicate an old site's function as lean as possible, and I'm
Possible Duplicate: reload (update) a .py file in the interpreter I test some of
Possible Duplicate: How to upload files in JSP/Servlet? I'm having some strange issue with
Possible Duplicate: What Are Some Good .NET Profilers? I am trying to test an
Possible Duplicate: I am making some parts of java image transparent by some code,
Possible Duplicate: Detecting closest or parent div I need some help about finding elements
Possible Duplicate: how to hide a div after some time period? i need to
Possible Duplicate: Calculate age in JavaScript In some point of my JS code I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.