根据索引条件分配值矩阵

时间:2018-10-01 18:27:19

标签: r function matrix indexing apply

如何基于向量条件索引将值分配给矩阵。一个有效的示例是:

import scrapy

class TutorialSpider(scrapy.Spider):
    name = "tutorial"

    def start_requests(self):
        urls = [
            'https://example.com/page/1',
            'https://example.com/page/2',
        ]
        for url in urls:
            print(f'{self.name} spider')
            print(f'url is {url}')
            yield scrapy.Request(
                url=url,
                callback=self.parse,
                meta={'handle_httpstatus_list': [404]},
            )

    def parse(self, response):
        print(response.url)
        self.log(response.url)
        sys.stdout.write('hello')

1 个答案:

答案 0 :(得分:1)

我们使用ValueError. The view 'WebBoard.views.reply_post' didn't return an 'HttpResponse' object. It returned 'None' instead. 索引进行分配

row/column

或使用m[cbind(seq_len(nrow(m)), r)] <- 1

replace