首页 \ 问答 \ 重新排列R中的表格[closed](Rearranging a table in R [closed])

重新排列R中的表格[closed](Rearranging a table in R [closed])

我对R非常陌生。我有一组数据,我希望按照第一个倒数第二个,第二个倒数第二个倒数的顺序重新排列。例如,说我的数据如下所示:

user | Event | count |
use1 | start |  1    |
use1 | start |  2    |
use1 | stop  |  3    |
use1 | stop  |  4    |

我希望它能返回这样的内容:

user | Event | count |
use1 | start |  1    |
use1 | stop  |  4    |
use1 | start |  2    |
use1 | stop  |  3    |

任何帮助表示赞赏! 谢谢!


I'm very new to R. I have a set of data that I would like to rearrange in the order of first with last, second with second last, etc. So for example say my data looks like this:

user | Event | count |
use1 | start |  1    |
use1 | start |  2    |
use1 | stop  |  3    |
use1 | stop  |  4    |

And I would like it to return something like this:

user | Event | count |
use1 | start |  1    |
use1 | stop  |  4    |
use1 | start |  2    |
use1 | stop  |  3    |

Any help is appreciated! Thanks!


原文:https://stackoverflow.com/questions/43244308
更新时间:2023-10-15 19:10

最满意答案

不知道为什么它会两次打电话但你可以做到这一点。

if(!self.progressView){
self.progressView = [MRProgressOverlayView new];
    self.progressView.mode = MRProgressOverlayViewModeIndeterminateSmall;
    [self.view.window addSubview:self.progressView];
    [self.progressView setTintColor:self.yellowColor];
    [self.progressView setTitleLabelText:@"Loading ..."];
    [self.progressView show:YES];
}

-(void)webViewDidFinishLoad:(UIWebView *)webView
{
     [self.progressView dismiss:YES];
self.progressView  = nil;
}

Dont know why it is calling twice but you can do this.

if(!self.progressView){
self.progressView = [MRProgressOverlayView new];
    self.progressView.mode = MRProgressOverlayViewModeIndeterminateSmall;
    [self.view.window addSubview:self.progressView];
    [self.progressView setTintColor:self.yellowColor];
    [self.progressView setTitleLabelText:@"Loading ..."];
    [self.progressView show:YES];
}

-(void)webViewDidFinishLoad:(UIWebView *)webView
{
     [self.progressView dismiss:YES];
self.progressView  = nil;
}

相关问答

更多
  • 从版本48开始,Chrome for iOS使用WKWebView,这与Safari中使用的视图相同。 来源: Ars Technica As of version 48, Chrome for iOS uses WKWebView, which is the same view used in Safari. Sources: Chromium Blog Ars Technica VentureBeat
  • 从这里: http : //www.sencha.com/blog/apple-shows-love-for-html5-with-ios-8 ◾IndexedDB在iOS 8“UIWebView”或主屏幕应用程序中不可用 From here: http://www.sencha.com/blog/apple-shows-love-for-html5-with-ios-8 ◾IndexedDB is not available in iOS 8 “UIWebView” or Home screen apps ...
  • 不知道为什么它会两次打电话但你可以做到这一点。 if(!self.progressView){ self.progressView = [MRProgressOverlayView new]; self.progressView.mode = MRProgressOverlayViewModeIndeterminateSmall; [self.view.window addSubview:self.progressView]; [self.progressView setTintCo ...
  • 您只需通过代码创建和添加WKWebView 。 如果您想在Storyboard中使用可视化表示进行布局,可以使用以下方法。 在Storyboard的视图控制器中添加标准UIView 。 这将充当您的Web视图的“持有者”。 将它连接到IBOutlet ,然后在viewDidLoad添加一个WKWebView实例作为该“持有者”视图的子视图。 class MyViewController: UIViewController, WKNavigationDelegate { // standard UI ...
  • 好吧,因为似乎没有人回答这个问题,答案似乎是(这样或那样) 是的 。 有两件事会影响我使用的HTML的呈现。 1) word-spacing (在em中指定)精确增加两倍。 对我来说唯一的解决方案是在iOS 7.0+上改变运行时的字间距。 2)跨度开始处的两个不间断空间(   )会导致异常大的间隙。 将此更改为一个不间断的空间和常规空间可以解决此问题。 在iOS 7.0中对CoreText进行了很多更改,所以我猜这些工件就是这样的结果。 Well since no one seems to be ...
  • 了解UIWebView正在使用的safari版本以及是否可以在桌面版本中重现它将会很有帮助。 此外,您是否在控制台中收到任何类型的日志或错误? 在任何情况下,您是否尝试将参数传递给stop方法? 就像是 node.stop(0); 此参数指定节点应停止的秒数。 发送0可能会有所帮助。 It would be helpful to know the version of safari that your UIWebView is using and whether or not you can reprodu ...
  • 这里有几个主题与这个主题... 尝试这个: for(UIView *wview in [[[webView subviews] objectAtIndex:0] subviews]) { if([wview isKindOfClass:[UIImageView class]]) { wview.hidden = YES; } } 它应该工作并通过App Store提交,因为它没有使用任何私有API。 There a several threads around here with this top ...
  • 我发现我在我的webViewDidFinishLoad有这个: //Make the page fit to view. THIS IS BAD CGRect webviewBound = self. webview.bounds; webviewBound.size.height = self. webview.scrollView.contentSize.height; self. webview.bounds = webviewBound; 所以我删除了它并添加: [ ...
  • 虽然您可以使用Web视图执行此操作,但实际上没有必要这样做。 Web视图非常适合显示混合媒体样式的文本或任意网站。 然而,他们实际上更难以进行交互式触摸和拖动各种交互。 你可以做到这一点,如果你是Javascript的专家,请随时从那里开始,看看情况如何。 但如果没有,就没有必要从那开始。 额外奖励:如果您使用原生视图而不是网页视图,您可以免费获得大部分动画和“橡皮筋”。 如果我这样做,我会创建一个视图控制器。 当它加载它的视图时,我会添加一个填充其超级视图边界的子视图。 然后使用-[UIView addG ...
  • 经过大量的搜索。 最后,我得到了一个解决方案,只需点击此处的链接链接即可 。 问题是javascript。 重写javascript作为样本样式,它现在在iOS 8(在Beta3中测试)中正常工作。 After lot of search. Finally, I got a solution, just follow the link link here. the problem is the javascript. rewrite the javascript as the sample style an ...

相关文章

更多

最新问答

更多
  • 您如何使用git diff文件,并将其应用于同一存储库的副本的本地分支?(How do you take a git diff file, and apply it to a local branch that is a copy of the same repository?)
  • 将长浮点值剪切为2个小数点并复制到字符数组(Cut Long Float Value to 2 decimal points and copy to Character Array)
  • OctoberCMS侧边栏不呈现(OctoberCMS Sidebar not rendering)
  • 页面加载后对象是否有资格进行垃圾回收?(Are objects eligible for garbage collection after the page loads?)
  • codeigniter中的语言不能按预期工作(language in codeigniter doesn' t work as expected)
  • 在计算机拍照在哪里进入
  • 使用cin.get()从c ++中的输入流中丢弃不需要的字符(Using cin.get() to discard unwanted characters from the input stream in c++)
  • No for循环将在for循环中运行。(No for loop will run inside for loop. Testing for primes)
  • 单页应用程序:页面重新加载(Single Page Application: page reload)
  • 在循环中选择具有相似模式的列名称(Selecting Column Name With Similar Pattern in a Loop)
  • System.StackOverflow错误(System.StackOverflow error)
  • KnockoutJS未在嵌套模板上应用beforeRemove和afterAdd(KnockoutJS not applying beforeRemove and afterAdd on nested templates)
  • 散列包括方法和/或嵌套属性(Hash include methods and/or nested attributes)
  • android - 如何避免使用Samsung RFS文件系统延迟/冻结?(android - how to avoid lag/freezes with Samsung RFS filesystem?)
  • TensorFlow:基于索引列表创建新张量(TensorFlow: Create a new tensor based on list of indices)
  • 企业安全培训的各项内容
  • 错误:RPC失败;(error: RPC failed; curl transfer closed with outstanding read data remaining)
  • C#类名中允许哪些字符?(What characters are allowed in C# class name?)
  • NumPy:将int64值存储在np.array中并使用dtype float64并将其转换回整数是否安全?(NumPy: Is it safe to store an int64 value in an np.array with dtype float64 and later convert it back to integer?)
  • 注销后如何隐藏导航portlet?(How to hide navigation portlet after logout?)
  • 将多个行和可变行移动到列(moving multiple and variable rows to columns)
  • 提交表单时忽略基础href,而不使用Javascript(ignore base href when submitting form, without using Javascript)
  • 对setOnInfoWindowClickListener的意图(Intent on setOnInfoWindowClickListener)
  • Angular $资源不会改变方法(Angular $resource doesn't change method)
  • 在Angular 5中不是一个函数(is not a function in Angular 5)
  • 如何配置Composite C1以将.m和桌面作为同一站点提供服务(How to configure Composite C1 to serve .m and desktop as the same site)
  • 不适用:悬停在悬停时:在元素之前[复制](Don't apply :hover when hovering on :before element [duplicate])
  • 常见的python rpc和cli接口(Common python rpc and cli interface)
  • Mysql DB单个字段匹配多个其他字段(Mysql DB single field matching to multiple other fields)
  • 产品页面上的Magento Up出售对齐问题(Magento Up sell alignment issue on the products page)