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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T14:10:29+00:00 2026-06-09T14:10:29+00:00

Am stuck using the ff package. Here is a sample of data. col1 col2

  • 0

Am stuck using the ff package. Here is a sample of data.

             col1                col2
90                            
91 21-02-2012 00:00:00 27-02-2009 00:00:00
92 21-02-2012 00:00:00 17-02-2010 00:00:00
93 21-02-2012 00:00:00   
94 21-02-2012 00:00:00                    
95 21-02-2012 00:00:00

What the plan was to convert these dates to numbers and then find the number of days between the dates. What I am stuck on is when I convert the dates to numbers naturally enough I get some NAs which is ok. What I would like to do is convert the NAs to the integer 0. Here is the code I tried:

tfd<-as.ffdf(tfd) #just to get a sample from my data frame
dats<-as.ff(as.numeric(as.Date(tfd[,1],"%d-%m-%Y")))
dats[is.na(dats)]<-0

I get the error:

Error in `[<-.ffdf`(`*tmp*`, is.na(dats), value = 0) : 
  value must be ffdf if only one index used

I have tried the na.count function but I had no luck. I checked the ffbase and ff pdfs and nothing. I had a good look through the web and nothing that would help with a ff vector.

If anyone has any suggestions that would be great.
Cheers,
Lorcan

  • 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-09T14:10:30+00:00Added an answer on June 9, 2026 at 2:10 pm

    Cheers for the help again, your all to kind. A colleague gave me a suggestion about using the ifelse function in R to fill the blanks before with an integer. I couldn’t fill the blanks with a default date, let’s say “2006-01-01” but using integers worked perfectly. Here is the code:

    ffdf1$dates1<-as.ff(ifelse(ffdf1[,3]=="",16000,as.numeric(as.Date(ffdf1[,3],"%d-%m-%Y"))))<br>
    

    ffdf1 is the ff data frame that I was using. Instead of 0 I decided to use 16,000. ffdf[,3] is the column that contains the dates. This code will work for the dates I gave in the example in the original question. Hope this helps and sorry if the question confused people,
    Cheers,
    Lorcan

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

Sidebar

Related Questions

I'm trying to convert some data from long to wide using the reshape2 package,
I am stuck using the older version (2.2.1) of Jython on the machines I
Let's assume I'm stuck using Python 2.6, and can't upgrade (even if that would
I am writing host code for a CUDA program, so I am stuck using
I am attempting to use livequery. I unfortunately am stuck using jquery 1.2.6. This
I'm currently stuck with using Atom CPU desktop for my Android app development. What
I am stuck with using Dojo to accomplish this. Basically what I am trying
We're stuck with using buffers on the SocketAsyncEventArgs object. With the old socket method
I'm using simplehtmldom to parse html and I'm stuck in parsing plaintext located outside
I am using c# decimal for high accuracy project but was stuck at the

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.