Note that there are some explanatory texts on larger screens.

plurals
  1. PONot reading the data the right way?
    primarykey
    data
    text
    <p>I think I'm not asking the right question to begin with.</p> <p>New Question: I have a 1.5gig tsv file. It has 6 lines of junk at the top and one line of junk at the bottom, all of which I want to remove without having to open the file. Line 7 are the headers. I have 13 headers. Number of rows is unknown.</p> <p>How do I read the file into a dataframe so that I can do basic descriptive stats, boxplots, etc....</p> <hr> <p>Original Question:</p> <p>Hi</p> <p>I have a feeling this one is really easy. I'm just missing something.</p> <p>I have a txt file, tab separated, with 6 lines of junk at the top and a junk line at the very bottom as well. In between the junk I have data of form Label1 Label2 Label3 Label4....Label13 text ID number percent....number</p> <p>Here is what I enter in R:</p> <pre><code>datadump &lt;- read.delim2("truncate.txt", header=TRUE, skip="6") cleandata &lt;- datadump[c(-dim(datadump)[1]),] avgposition &lt;- cleandata$Avg.Position hist(avgposition) </code></pre> <p>Avg.Position is label13 and a number of form #.#</p> <p>Yet I get an error: Error in hist.default(avgposition) : 'x' must be numeric</p> <p>Why is it not seeing the data as numeric?</p> <p>Thanks!</p> <p>As requested here is some data:</p> <pre><code>&gt; dput(cleandata) structure(list(Account = structure(c(2L, 2L), .Label = c("Crap1", "XXS"), class = "factor"), Campaign = structure(c(1L, 1L), .Label = c("3098012", "Crap2"), class = "factor"), Customer.Id = structure(c(2L, 2L ), .Label = c("", "nontech broad (7)"), class = "factor"), Ad.Group = structure(c(2L, 2L), .Label = c("", "RR 236 (300)"), class = "factor"), Keyword = structure(2:3, .Label = c("", "chagall pro", "matisse"), class = "factor"), Keyword.Matching = structure(c(2L, 2L), .Label = c("", "Broad"), class = "factor"), Impressions = c(4L, 16L), Clicks = c(1L, 1L), CTR = structure(2:3, .Label = c("", "25.00%", "6.25%"), class = "factor"), Avg.CPC = structure(2:3, .Label = c("", "$0.05 ", "$0.11 "), class = "factor"), Avg.CPM = structure(2:3, .Label = c("", "$12.50 ", "$6.88 "), class = "factor"), Cost = structure(2:3, .Label = c("", "$0.05 ", "$0.11 "), class = "factor"), Avg.Position = structure(2:3, .Label = c("", "3", "3.1"), class = "factor")), .Names = c("Account", "Campaign", "Customer.Id", "Ad.Group", "Keyword", "Keyword.Matching", "Impressions", "Clicks", "CTR", "Avg.CPC", "Avg.CPM", "Cost", "Avg.Position" ), row.names = 1:2, class = "data.frame") </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload