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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T22:42:23+00:00 2026-06-15T22:42:23+00:00

I have a data.frame y with 18 columns: the last one I added via

  • 0

I have a data.frame y with 18 columns: the last one I added via

y$ced <- Limt

where Limt is a numerical vector of fitting length. Now this happens:

colnames( y )    
...
[13] "is_term"   "is_cover"  "is_other"  "CoRI"      "Prot"      "ced"
                                                                  ^^^

where the last colname is perfectly as expected. But:

head( y, 1 )
....
  is_price is_term is_cover is_other CoRI Prot Limt
1                                       0    0 5000
                                               ^^^^

Where, for me totally unexpectedly, the original variable name shows up as a header.

y$ced brings up the expected numbers, while

y$Limt
NULL

Probably this is how it should be but I did not find an explanation. I’d be very grateful for a hint where to look why this is how it is, and how to get the desired ced instead. Working around the issue is easy but I really want to know…

I tried colnames( y )[18] <- "ced" but this die not help.

sessionInfo()
R version 2.15.2 (2012-10-26)
Platform: x86_64-pc-linux-gnu (64-bit)

Reproducible example – not sure whether this is good enough but the only thing that comes to my mind:

> x <- head( y$ced )
> x
   Limt
1  5000
2 10000
3 20000
4 40000
5  5000
6 10000
> dput( x )
structure(list(ced = structure(list(Limt = c(5000, 10000, 20000, 
40000, 5000, 10000)), .Names = "Limt", row.names = c(NA, 6L), class = "data.frame")), .Names = "ced", row.names = c(NA, 
6L), class = "data.frame")

I see the .Names thing there, that’s probably it. I used RSQLite to get the data from a database file, is that how it turns up?

  • 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-15T22:42:24+00:00Added an answer on June 15, 2026 at 10:42 pm

    Most likely, you are not assigning a vector as you say, but a data.frame:

    y <- head(cars, 3)
    Limt <- data.frame(Limt = 1:3)
    y$ced <- Limt
    names(y)
    # [1] "speed" "dist"  "ced"
    y
    #       speed dist Limt
    # 1     4    2    1
    # 2     4   10    2
    # 3     7    4    3
    
    str(y)
    # 'data.frame': 3 obs. of  3 variables:
    #  $ speed: num  4 4 7
    #  $ dist : num  2 10 4
    #  $ ced  :'data.frame':    3 obs. of  1 variable:
    #   ..$ Limt: int  1 2 3
    

    It will work as expected if you assign a vector:

    y$ced <- Limt$Limt
    y 
    #   speed dist ced
    # 1     4    2   1
    # 2     4   10   2
    # 3     7    4   3
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a data frame where columns are constantly being added to it. I
I have a data frame with several columns, one of which is a factor
I have a data.frame with 8 columns. One is for the list of subjects
I have a data.frame with 2 columns: Node A, Node B. Each entry in
I have a data frame with two columns. First column contains categories such as
I have a data frame where some of the columns contain NA values. How
I have a data frame with 50000 rows and 200 columns. There are duplicate
I have a data frame of daily data: df with four columns: Date, A,
I have a data frame with an id column and some (potentially many) columns
I have a data frame that is some 35,000 rows, by 7 columns. it

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.