小编Dan*_*dis的帖子

如何为 R 中此“df”中的重复行分配唯一代码?

我有这个数据框 df

df <- data.frame(stringsAsFactors=FALSE,
          id = c(1L, 2L, 3L, 4L, 5L, 6L),
     Country = c("ESP", "ESP", "ESP", "ITA", "ITA", "ITA"),
        Year = c(1965L, 1965L, 1965L, 1965L, 1965L, 1965L),
   Time.step = c("Month", "Month", "Month", "Month", "Month", "Month"),
    GSA.numb = c("GSA 5", "GSA 5", "GSA 5", "GSA 17", "GSA 17", "GSA 17"),
     Species = c("Mullus", "Mullus", "Mullus", "Eledone", "Eledone", "Eledone"),
    Quantity = c(500L, 200L, 200L, 350L, 350L, 125L)
                )

df

   id  Country   Year    Time.step    GSA.numb  Species   Quantity
    1    ESP     1965     Month …
Run Code Online (Sandbox Code Playgroud)

r duplicates dataframe rowname

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

汇编中的逗号 (,) 运算符是什么?

这是我编写的一个简单的汇编语言程序:

section .text
    global main     ;must be declared for linker (ld)
main:               ;tells linker entry point
    mov edx,len     ;message length
    mov ecx,msg     ;message to write
    mov ebx,1       ;file descriptor (stdout)
    mov eax,4       ;system call number (sys_write)
    int 0x80        ;call kernel

    mov eax,1       ;system call number (sys_exit)
    int 0x80        ;call kernel

section .data
msg db 'Hello, world!', 0xa  ;our dear string
len equ $ - msg              ;length of our dear string
Run Code Online (Sandbox Code Playgroud)

现在我不知道这一行发生了什么:msg db 'Hello, world!', 0xa
我知道的含义,msg db 'Hello, …

assembly comma-operator

0
推荐指数
1
解决办法
3798
查看次数

获取片段名称或 ID

我有framelayout一次在我Activity和其他时间的不同时间Fragment(经过相同framelayoutActivity)。

在 my 中MainActivity.class,我需要知道我的framelayout. 例如,我需要知道是否framelayout正在使用MyFragment1.classMyFragment2.class

我需要这样的东西(在这个例子中,log必须说我“你在 MyFragment1”):

FrameLayout frameLayout = (FrameLayout) findViewById(R.id.framelayout);

 getSupportFragmentManager().beginTransaction()
        .replace(R.id.framelayout,new MyFragment1())
        .commit();

if (framelayout.getname.equals("package.MyFragment1.class"))
 Log.d("debug", "you are in MyFragment1");
else if (framelayout.getname.equals("package.MyFragment2.class"))
 Log.d("debug", "you are in MyFragment2");
Run Code Online (Sandbox Code Playgroud)

我怎样才能做到这一点?

java android android-fragments android-framelayout

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

如何使用(Apify 的)Puppeteer 单击没有 ID 的按钮?

我正在使用Apify 的 puppeteer登录该网站。我确实研究过类似的问题,但无济于事。

我无法找到链接登录页面上看到的主登录按钮的可点击 ID/元素。目前,我的代码如下所示:

const Apify = require('apify');

Apify.main(async () => {
const input = await Apify.getValue('INPUT');

const browser = await Apify.launchPuppeteer();
const page = await browser.newPage();
await page.goto('https://www.sunpass.com/vector/account/home/accountLogin.do');

// Login
await page.type('#tt_username1', input.username);
await page.type('#tt_loginPassword1', input.password);
await page.waitFor(2000);
await page.click('#entryform input');
await page.waitForNavigation();

// Get cookies
const cookies = await page.cookies();

// Use cookies in other tab or browser
const page2 = await browser.newPage();
await page2.setCookie(...cookies);
await page2.goto('https://www.sunpass.com/vector/account/transactions/webtransactionSearch.do'); // Opens page as …
Run Code Online (Sandbox Code Playgroud)

button clickable puppeteer apify

0
推荐指数
1
解决办法
7076
查看次数