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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T02:47:34+00:00 2026-06-06T02:47:34+00:00

I have a numeric vector (future_prices) in my case. I use a date vector

  • 0

I have a numeric vector (future_prices) in my case. I use a date vector from another vector (here: pred_commodity_prices$futuredays) to create numbers for the months. After that I use cbind to bind the months to the numeric vector. However, was happened is that the numeric vector become non-numeric. Do you know how what the reason for this is? When I use as.numeric(future_prices) I get strange values. What could be an alternative? Thanks

head(future_prices)
pred_peak_month_3a pred_peak_quarter_3a 
1           68.33907             62.37888
2           68.08553             62.32658

is.numeric(future_prices)
[1] TRUE
> month = format(as.POSIXlt.date(pred_commodity_prices$futuredays), "%m")
> future_prices <- cbind (future_prices, month)
> head(future_prices)
  pred_peak_month_3a     pred_peak_quarter_3a   month
  1 "68.3390747063745"   "62.3788824938719"     "01"
 is.numeric(future_prices)
 [1] FALSE 
  • 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-06T02:47:35+00:00Added an answer on June 6, 2026 at 2:47 am

    The reason is that cbind returns a matrix, and a matrix can only hold one data type. You could use a data.frame instead:

    n <- 1:10
    b <- LETTERS[1:10]
    m <- cbind(n,b)
    str(m)
     chr [1:10, 1:2] "1" "2" "3" "4" "5" "6" "7" "8" "9" ...
     - attr(*, "dimnames")=List of 2
      ..$ : NULL
      ..$ : chr [1:2] "n" "b"
    
    d <- data.frame(n,b)
    str(d)
    'data.frame':   10 obs. of  2 variables:
     $ n: int  1 2 3 4 5 6 7 8 9 10
     $ b: Factor w/ 10 levels "A","B","C","D",..: 1 2 3 4 5 6 7 8 9 10
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a numeric vector, it contains patches of elements that are repeating, something
I have a numeric vector in R, which consists of both negative and positive
So I have a list, each element of which is a numeric vector. Each
I have a numeric vector, let's say something like: x <- rep(1:6, 300) What
I have numeric data that I am getting from a database. They are all
I have a numeric vector implementation in C; the whole implementation is based on
I have a numeric matrix with 25 columns and 23 rows, and a vector
I have a txt file from which I want to load date & time
We have a (Numeric 3 float) vector class that I would love to align
I have a factor RFyhat which I'm looking to convert to a numeric vector.

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.