小编use*_*814的帖子

时间序列,将每月数据更改为季度

现在我有一些月度数据,如:

1/1/90 620
2/1/90,591
3/1/90,574
4/1/90,542
5/1/90,534
6/1/90,545
#...etc
Run Code Online (Sandbox Code Playgroud)

如果我使用ts()函数,很容易将数据转换为时间序列结构,如:

         Jan Feb Mar ... Nov Dec
   1990  620 591 574 ... 493 464
   1991  100 200 300 ...........
Run Code Online (Sandbox Code Playgroud)

是否有任何可能性将其更改为季度重复,如下所示:

            1st 2nd 3rd 4th
   1990-Q1  620 591 574 464
   1990-Q2  100 200 300 400
   1990-Q3  ...
   1990-Q4  ...
   1991-Q1  ...
Run Code Online (Sandbox Code Playgroud)

我试图改变

   ts(mydata,start=c(1990,1),frequency=12)
Run Code Online (Sandbox Code Playgroud)

   ts(mydata,start=c(as.yearqrt("1990-1",1)),frequency=4) 
Run Code Online (Sandbox Code Playgroud)

但它似乎无法正常工作.

谁能帮助我?非常感谢你.

r date time-series

9
推荐指数
2
解决办法
2万
查看次数

Cocoa app在所有运行mac的应用程序之上创建透明视图

我正在使用Xcode处理mac osx应用程序.我想在所有应用程序之上添加一个透明的全屏视图/窗口.这样我就可以在透明视图上"绘制",并且它背后将是任何应用程序,safari,word等.

我尝试了以下几点

 NSRect rect = [[NSScreen mainScreen] frame];   //this is full screen size, but still with the status bar like time, battery, etc.

 NSWindow *overlayWindow = [[NSWindow alloc]initWithContentRect:rect
 styleMask:NSBorderlessWindowMask
 backing:NSBackingStoreBuffered
 defer:NO];
 overlayWindow.backgroundColor = [NSColor redColor];
 [self.window addChildWindow:overlayWindow ordered:NSWindowAbove];
Run Code Online (Sandbox Code Playgroud)

这是我的mac应用程序的一个新的全屏子窗口.但它并不是我在我的Mac上运行的所有应用程序之上.

所以我的问题,如何在我的mac屏幕视图上添加视图(不仅是我的应用程序的顶视图).非常感谢!!!

macos xcode cocoa

6
推荐指数
2
解决办法
6712
查看次数

Applescript,读取行作为变量

我希望Applescript能够从txt文件中设置变量,逐行读取或逐个字符地读取.也许像php函数:get_file_contents.有没有类似的东西或者你可以请我提供方式吗?

我知道如何设置文件路径.就像是

    set myfile to "/Users/Username/Desktop/test.txt"
    set theText to read myfile
Run Code Online (Sandbox Code Playgroud)

在txt文件中,它只是一行中的一个整数,比如

    1
    2
    3
    4
    5
Run Code Online (Sandbox Code Playgroud)

如果我使用

    set theTextList to paragraphs of theText
Run Code Online (Sandbox Code Playgroud)

结果将带有引号"".

我只想将这些整数设置为变量.所以以后我可以使用,比如

   set variable to 5  --here I would like to replace the real number 5 to the number I read from the txt file(just one line)

   start slideshow
   show slide variable
Run Code Online (Sandbox Code Playgroud)

在此先感谢您的帮助.

applescript text

2
推荐指数
1
解决办法
8183
查看次数

标签 统计

applescript ×1

cocoa ×1

date ×1

macos ×1

r ×1

text ×1

time-series ×1

xcode ×1