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

  • Home
  • SEARCH
  • 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 9181465
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T18:19:14+00:00 2026-06-17T18:19:14+00:00

I have fetched a set of dates from postgresql, they look correct: [1] 2007-07-13

  • 0

I have fetched a set of dates from postgresql, they look correct:

[1] "2007-07-13" "2007-07-14" "2007-07-22" "2007-07-23" "2007-07-24"
[6] "2007-07-25" "2007-08-13" "2007-08-14" "2007-08-15" "2007-08-16"
etc.

Then I want to run a loop on them to make new sql sentences to fetch some other data sets (yes, I know what I am doing, it would not have been possible to do all the processing in the database server)

So I tried

for(date in geilodates)
 mapdate(date,geilo)
Error in postgresqlExecStatement(conn, statement, ...) : 
  RS-DBI driver: (could not Retrieve the result : ERROR:  invalid input syntax for type date: "13707"
LINE 1: ...id_date_location where not cowid is null and date='13707' or...

mapdate is a function I have written, the use of date within that is

sql=paste('select * from gps_coord where cowid=',cowid," and date='",date,"'",sep='')

So, what has happened is that R silently converted my formatted dates to their integer representations before i tried to paste the sql together.

How do I get the original textual representation of the date? I tried

for(date in geilodates){
  d=as.Date(date,origin="1970-01-01")
  mapdate(d,geilo)
}
Error in charToDate(x) : 
character string is not in a standard unambiguous format

And I have not managed to find any other functions to create a datestring (or to “serve” the date as the string I get when listing the variable

  • 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-17T18:19:15+00:00Added an answer on June 17, 2026 at 6:19 pm

    Thanks to wush978 for pointing me in the right direction, In the end I had to do:

    for(d in geilodates){
     date=format(as.Date(d,origin="1970-01-01"))
     mapdate(date,geilo)
    }
    

    For some reason, inside the loop the “date” variable was seen as an integer, so I explicitely had to convert it to a date and then format it…

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

Sidebar

Related Questions

I have a set of rows which I've fetched from a table. Let's say
I have string that look like Array that fetched from other webservice like this
I have two tables with list of urls fetched from different sources. I want
I have successfully fetched an image from photo library and I have set it
I have fetched some data from a SQL database into a datagridview, but after
I have fetched a result from core data in my app and need to
I have fetched images and text as listview from database.now on clicking the particular
I have a hidden property which is fetched from ebean. how do i pass
I have a problem related to an array data which fetched from an external
I have a big list of over 20000 items to be fetched from DB

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.