编辑时抛出RStudio错误?

时间:2018-07-28 07:44:42

标签: r autocomplete shiny rstudio rstudio-server

我正在R 3.4.4上的RStudio Server v.1.1.442中编写一个Shiny应用程序,今天,当我打开ui.R文件进行编辑时,我所做的任何编辑都会遇到弹出错误“ R代码”执行错误”并重复打印

  

对象[[3]]中的错误:下标超出范围

在我什至不执行任何代码的情况下,进入控制台。代码建议在编辑时完全消失了。

我尝试关闭项目并在一个新项目中分别打开文件,但这并没有改变。我觉得这可能是我在该项目中使用的一个软件包中的一个错误,但是我不知道如何诊断它。任何帮助将不胜感激!

以下是我正在使用的软件包的列表:

shiny, DT, shinyMCE, wordcloud, stringr, ngram, shinyjs, rvest, RCurl, XML, stringi, magrittr, data.table, phrasemachine, urltools, textclean

1 个答案:

答案 0 :(得分:0)

它可能与处理using System; using System.Diagnostics; using System.Net; using System.Text; using System.Threading; using System.Threading.Tasks; using Microsoft.Azure.ServiceBus; using Microsoft.WindowsAzure.ServiceRuntime; namespace WorkerRoleWithSBQueue1 { public class WorkerRole : RoleEntryPoint { private readonly CancellationTokenSource _cancellationTokenSource = new CancellationTokenSource(); private readonly ManualResetEvent _runCompleteEvent = new ManualResetEvent(false); // The name of your queue private const string ServiceBusConnectionString = "<your_connection_string>"; private const string TopicName = "test-topic"; private const string SubscriptionName = "test-sub1"; // _client is thread-safe. Recommended that you cache // rather than recreating it on every request private SubscriptionClient _client; public override void Run() { Trace.WriteLine("Starting processing of messages"); try { this.RunAsync(this._cancellationTokenSource.Token).Wait(); } catch (Exception e) { Trace.WriteLine("Exception"); Trace.WriteLine(e.ToString()); } finally { Trace.WriteLine("Finally..."); this._runCompleteEvent.Set(); } } public override bool OnStart() { // Set the maximum number of concurrent connections ServicePointManager.DefaultConnectionLimit = 12; var result = base.OnStart(); Trace.WriteLine("WorkerRole has been started"); return result; } public override void OnStop() { // Close the connection to Service Bus Queue this._cancellationTokenSource.Cancel(); this._runCompleteEvent.WaitOne(); base.OnStop(); } private async Task RunAsync(CancellationToken cancellationToken) { // Configure the client RegisterOnMessageHandlerAndReceiveMessages(ServiceBusConnectionString, TopicName, SubscriptionName); _runCompleteEvent.WaitOne(); Trace.WriteLine("Closing"); await _client.CloseAsync(); } private void RegisterOnMessageHandlerAndReceiveMessages(string connectionString, string topicName, string subscriptionName) { _client = new SubscriptionClient(connectionString, topicName, subscriptionName); var messageHandlerOptions = new MessageHandlerOptions(ExceptionReceivedHandler) { // Maximum number of concurrent calls to the callback ProcessMessagesAsync(), set to 1 for simplicity. // Set it according to how many messages the application wants to process in parallel. MaxConcurrentCalls = 1, // Indicates whether MessagePump should automatically complete the messages after returning from User Callback. // False below indicates the Complete will be handled by the User Callback as in `ProcessMessagesAsync` below. AutoComplete = false, }; _client.RegisterMessageHandler(ProcessMessageAsync, messageHandlerOptions); } private async Task ProcessMessageAsync(Message message, CancellationToken token) { try { // Process the message Trace.WriteLine($"Received message: SequenceNumber:{message.SystemProperties.SequenceNumber} Body:{Encoding.UTF8.GetString(message.Body)}"); await _client.CompleteAsync(message.SystemProperties.LockToken); } catch (Exception e) { // Handle any message processing specific exceptions here Trace.Write(e.ToString()); await _client.AbandonAsync(message.SystemProperties.LockToken); } } private static Task ExceptionReceivedHandler(ExceptionReceivedEventArgs exceptionReceivedEventArgs) { Console.WriteLine($"Message handler encountered an exception {exceptionReceivedEventArgs.Exception}."); var context = exceptionReceivedEventArgs.ExceptionReceivedContext; Console.WriteLine("Exception context for troubleshooting:"); Console.WriteLine($"- Endpoint: {context.Endpoint}"); Console.WriteLine($"- Entity Path: {context.EntityPath}"); Console.WriteLine($"- Executing Action: {context.Action}"); return Task.CompletedTask; } } } / magrittr库的管道运算符dplyr的RStudio代码自动完成细节有关,尤其是当它嵌套或涉及连接时。它可能会产生这种错误,但是它也取决于Windows版本。尝试用管道代替直接调用函数。

请检查问题Code Completion Error