如何使用向量中的一列和一列名称创建小标题?

时间:2019-05-21 13:47:20

标签: r vector tidyverse tibble

我尝试这样做,但是它创建了两列的小标题。

>vect<-c(1,2,3)
> enframe(vect1, name="var")
# A tibble: 3 x 2
    var value
  <int> <dbl>
1     1     1
2     2     2
3     3     3

我需要这样创建小标题:

    var 
  <int> 
       1    
       2    
       3  

1 个答案:

答案 0 :(得分:1)

我们可以在Option Explicit Sub CopyYes() Dim ws As Worksheet With ThisWorkbook 'Copy the range .Worksheets("FILE MASTER").Range("B6:C36").Copy 'Loop sheets For Each ws In .Worksheets With ws 'Avoid FILE MASTER If .Name <> "FILE MASTER" Then 'Paste only values in A1 of each sheet .Range("A1").PasteSpecial xlPasteValues End If End With Next ws End With End Sub 之后使用Request URL: https://example.com/cdn-cgi/l/chk_captcha?s=ce4cb15ca466e2813fd8ac9ca2b53447526e3353-1558445818-1800-Adz12DeT4OTVwi5Kk0Wvjf4vFnoZhT0Sl6WGNhwCcQAf8opJzWm%2B74Y%2BtmE1GoNSrsuN0xZnohsi%2B5touRT5j2VkVW8oIgmCsCmU95BANSslZ%2FVrn7RtTCrPc1PAIYKuxjWjcv0CVnlwFLt0K5ug6ao%3D&id=4da6f13e8c73bf37&g-recaptcha-response=03AOLTBLQAPYFRmnMBUGaS2YQ1z5M9Jd-g1x7bDZ9kqHiEbzLXw9eIzCetSnpe3H29gBW0glMMPfQ9bAX4Fa5gTCEwazwoL_6K5iXJPclXV1KYme6BIJEkx3LzP0yUGHjxwTTHtv6rodMOO63tVefrMbOIltI36I1HSjfYfQRSFSNRWnIJp0_NYhtm-_juQv7ONUqtE-tHvy_8mKgm93tJ2itRKu9zSgCe88tLF44RD4o_Vcf18dFjUAifhlf520gTO5zGP4QakaZZn_cbJYW1okLvbKYUmO7qJSWo_dApWa1hKlNI1ePOclZ-uxi3kdkh0yXz1Slv85eK&bf_challenge_id=6980&bf_execution_time=59&bf_result_hash=1690145601 Request Method: GET Status Code: 302 Remote Address: 127.0.0.1:443 Referrer Policy: no-referrer-when-downgrade cf-ray: 4da6f180be12bf37-AMS content-length: 159 content-type: text/html date: Tue, 21 May 2019 13:37:09 GMT location: / server: cloudflare set-cookie: cf_clearance=e498c598ebd08715124534543d7035c2348bc06-1558445829-1800-250; path=/; expires=Tue, 21-May-19 15:07:09 GMT; domain=.example.com; HttpOnly status: 302 x-frame-options: SAMEORIGIN :authority: example.com :method: GET :path: /cdn-cgi/l/chk_captcha?s=ce4cb15ca466e2813fd8ac9ca2b53447526e3353-1558445818-1800-Adz12DeT4OTVwi5Kk0Wvjf4vFnoZhT0Sl6WGNhwCcQAf8opJzWm%2B74Y%2BtmE1GoNSrsuN0xZnohsi%2B5touRT5j2VkVW8oIgmCsCmU95BANSslZ%2FVrn7RtTCrPc1PAIYKuxjWjcv0CVnlwFLt0K5ug6ao%3D&id=4da6f13e8c73bf37&g-recaptcha-response=03AOLTBLQAPYFRmnMBUGaS2YQ1z5M9Jd-g1x7bDZ9kqHiEbzLXw9eIzCetSnpe3H29gBW0glMMPfQ9bAX4Fa5gTCEwazwoL_6K5iXJPclXV1KYme6BIJEkx3LzP0yUGHjxwTTHtv6rodMOO63tVefrMbOIltI36I1HSjfYfQRSFSNRWnIJp0_NYhtm-_juQv7ONUqtE-tHvy_8mKgm93tJ2itRKu9zSgCe88tLF44RD4o_Vcf18dFjUAifhlf520gTO5zGP4QakaZZn_cbJYW1okLvbKYUmO7qJSWo_dApWa1hKlNI1ePOclZ-uxi3kdkh0yXz1Slv85eK&bf_challenge_id=6980&bf_execution_time=59&bf_result_hash=1690145601 :scheme: https accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3 accept-encoding: gzip, deflate, br accept-language: de-DE,de;q=0.9,en-US;q=0.8,en;q=0.7 cookie: __cfduid=ddf2d99d0f94543554e8b284e91556383068 referer: https://example.com upgrade-insecure-requests: 1 user-agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/74.0.3729.157 Safari/537.36 s: ce4cb15ca466e2813fd8ac9ca2b53447526e3353-1558445818-1800-Adz12DeT4OTVwi5Kk0Wvjf4vFnoZhT0Sl6WGNhwCcQAf8opJzWm+74Y+tmE1GoNSrsuN0xZnohsi+5touRT5j2VkVW8oIgmCsCmU95BANSslZ/Vrn7RtTCrPc1PAIYKuxjWjcv0CVnlwFLt0K5ug6ao= id: 4da6f13e8c73bf37 g-recaptcha-response: 03AOLTBLQAPYFRmnMBUGaS2YQ1z5M9Jd-g1x7bDZ9kqHiEbzLXw9eIzCetSnpe3H29gBW0glMMPfQ9bAX4Fa5gTCEwazwoL_6K5iXJPclXV1KYme6BIJEkx3LzP0yUGHjxwTTHtv6rodMOO63tVefrMbOIltI36I1HSjfYfQRSFSNRWnIJp0_NYhtm-_juQv7ONUqtE-tHvy_8mKgm93tJ2itRKu9zSgCe88tLF44RD4o_Vcf18dFjUAifhlf520gTO5zGP4QakaZZn_cbJYW1okLvbKYUmO7qJSWo_dApWa1hKlNI1ePOclZ-uxi3kdkh0yXz1Slv85eK bf_challenge_id: 6980 bf_execution_time: 59 bf_result_hash: 1690145601 (如果select已经完成)

enframe

或者只使用enframe

library(tidyverse)
enframe(vect, name="var") %>%
       select(var)