Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个包含长列名的大型数据框。我想通过在冒号 (:) 之前删除字符来缩短列名,该符号出现在数据框列中的每个列名中。寻找一种在数据帧上执行此操作的方法?
也许(第三次尝试):
names(df) <- sub("^(.+[:])([^.]+)$", "\\2", names(df))