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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T08:54:59+00:00 2026-05-27T08:54:59+00:00

If I edit a function with R v2.14.0 using fix() , those fixes are

  • 0

If I edit a function with R v2.14.0 using fix(), those fixes are applied during the session.

For example, I might make the following edit to get a white background in a hive plot:

> library(HiveR)
> fix(plotHive)
... :%s/black/white/g
... :w
... :q
> plotHive(myHiveData)

I then get a white background in the hive plot, as expected.

But if I quit and reopen R, I have lost those changes, and the plot has a black background again.

How do I preserve the edits I make with fix() between R sessions?

EDIT

If I source() the modified plotHive() function, I get the following error:

> modifiedPlotHive <- source("modifiedPlotHive.R")

Error in source("modifiedPlotHive.R") : 
  modifiedPlotHive.R:1160:1: unexpected '<'
1159: }
1160: <
      ^
In addition: Warning message:
In readLines(file) : incomplete final line found on 'modifiedPlotHive.R'

The final line in the modified plotHive() function is:

<environment: namespace:HiveR>

If I remove this line before source()-ing, then the function no longer works.

  • 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-05-27T08:55:00+00:00Added an answer on May 27, 2026 at 8:55 am

    Here’s the safer way of doing what you want, referenced by @joran.

    The sink/source pair is fine for dealing with R code files. But saving to text files and then reading back in other types of objects can strip them of important attributes, especially those relating to environments. That’s what you just experienced.

    The save/load pair stores objects in R’s own binary format, so is much less liable to lose important information/environments attached to functions.

    In this example, I define a personal version of ls, which differs from the base function in that it by default lists objects that start with a dot/period:

    my_ls <- ls
    fix(my_ls)
    # 1) On the first line, change 'all.names=FALSE' to 'all.names=TRUE'
    # 2) Say "Yes", I want to save the changes
    save("my_ls", file="my_ls.Rdata")
    
    # Then, in a later session, test that it works
    load("my_ls.Rdata")
    .TrysToHide <- 99
    my_ls()
    # [1] ".TrysToHide" "my_ls"  
    

    One more note: it’s much cleaner to give your modified function a name of its own. To really edit a packaged function, and have the changes persist, you’d need to edit the sources and recompile the package. But if you do that, beware, as you may well break the function for other packaged functions that depend on it.

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

Sidebar

Related Questions

I'm using CreateWindowEx() function to create an EDIT window, i.e. where a user can
I am using a jQuery jEditable edit-in-place field but when the JSON function returns
I tried the following: $.load(Views/chatBox.html).appendTo('body') Console Output: TypeError: $.load is not a function EDIT
How to get function's name from function's pointer in C? Edit: The real case
I edit my Perl scripts in Emacs, using CPerl mode. But the Emacs function
I'm currently using this function to get all my contacts from Google Contacts. session_start();
I'm using the following code to detect users' key pressing, in JavaScript: $(document).bind('keydown', function
I was using the following script to call a javascript function only if my
EDIT - I was able to fix this problem using code from 'Farray' with
I have this function to edit all fields that come from the form and

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.