Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/r/75.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将数据帧中的两列转换为向量R_R_Dataframe_Vector - Fatal编程技术网

将数据帧中的两列转换为向量R

将数据帧中的两列转换为向量R,r,dataframe,vector,R,Dataframe,Vector,我得到这个数据帧: head(data) Cal Cre 1 ca h1 2 cb h2 3 ca h3 我试着得到这样一个向量: foo=c("ca"="h1","cb"="h2","ca"="h3") 库(dplyr) 数据%>% 拉力(Cre,名称=Cal) 这是否回答了您的问题?

我得到这个数据帧:

head(data)
  Cal    Cre
1 ca     h1  
2 cb     h2 
3 ca     h3  
我试着得到这样一个向量:

foo=c("ca"="h1","cb"="h2","ca"="h3")
库(dplyr)
数据%>%
拉力(Cre,名称=Cal)

这是否回答了您的问题?