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 8096679
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T21:31:41+00:00 2026-06-05T21:31:41+00:00

I have a csv file, and I want to extract the each column a

  • 0

I have a csv file, and I want to extract the each column a as string so I can use it with getSymbols function from quantmod package.

The csv file looks like this:

AEGR,Aegerion Pharmaceuticals Inc
AKS,AK Steel Holding Corp
ALXA‎,Alexza Pharmaceuticals Inc
CCL‎,Carnival Corporation
CECO‎,Career Education Corp
CDXS‎,Codexis Inc

And I use this code to read the file:

data<-read.csv(file='CAPM/allquotes.csv',header=F)
symbols=gettext(data[,1])
symbol.names=gettext(data[,2])
getSymbols(symbols)

I get this error:

Error in download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  : cannot open URL 'http://chart.yahoo.com/table.csv?s=ALXA‎&a=0&b=01&c=2007&d=5&e=16&f=2012&g=d&q=q&y=0&z=ALXA‎&x=.csv'
In addition: Warning message:
In download.file(paste(yahoo.URL, "s=", Symbols.name, "&a=", from.m,  : cannot open: HTTP status was '404 Not Found'

When I enter the symbols one by one it works fine. I’ve also noticed that when I go to the end of the last line, the margins seem to corrupt. In the image you can see that values of ‘symbols’, the end of the line is a few more spaces to the right than it should be (you can see that because of the color of the initial parenthesis).

symbols object

  • 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-05T21:31:42+00:00Added an answer on June 5, 2026 at 9:31 pm

    Your csv has hidden characters in it — namely a left-to-right mark. Since you are using RStudio, you can remove it with gsub using “\016” as the value for the pattern argument. Alternatively, instead of removing the hidden character that you don’t want, you could only keep the characters that you know you DO want. For example, if your symbols will only have letters and/or numbers you could use something like gsub("[^A-Za-z0-9]", "", data[, 1])

    data <- read.csv(text="AEGR,Aegerion Pharmaceuticals Inc
    AKS,AK Steel Holding Corp
    ALXA‎,Alexza Pharmaceuticals Inc
    CCL‎,Carnival Corporation
    CECO‎,Career Education Corp
    CDXS‎,Codexis Inc", header=FALSE)
    #data[, 1] <- gsub("\016", "", data[, 1]) #this should work in RStudio
    data[, 1] <- gsub("[^A-Za-z0-9]", "", data[, 1]) #but this should work anywhere
    symbols=gettext(data[,1])
    getSymbols(symbols, src='yahoo')
    

    After you read.csv, you can examine the data object to see that something is amiss.

    s <- as.character(data[, 1])
    str(s)
    #chr [1:6] "AEGR" "AKS" "ALXA""| __truncated__ "CCL""| __truncated__ "CECO""| __truncated__ "CDXS""| __truncated__
    str(s[3])
    #chr "ALXA""| __truncated__
    
    charToRaw(s[3])
    #[1] 41 4c 58 41 e2 80 8e
    # Compare what we have to what we think we have
    charToRaw("ALXA")
    #[1] 41 4c 58 41
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want the following functionality using php I have a csv file. Each file
I have a transaction log file in CSV format that I want use to
Background - I want to extract specific columns from a csv file. The csv
Ok so basically I have a csv file with different values. I want each
I have a simple .csv file that has that I want to extract data
I am currently reading a CSV file. I have to extract the dates from
I have a CSV file I want to load at boot of my Lift
I have CSV file and Macro in VBA. I want to open CSV file
I have a csv file : 1|1.25 2|23.56 3|58.99 I want to put this
I have a .csv file. I want to convert it into .txt file starting

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.