我想知道是否可以找到包含字符串"list"
的所有Base R函数名称?
答案 0 :(得分:7)
lsf.str
返回特定程序包中的所有函数,然后可以将grep
与关键字一起使用并返回与其匹配的所有函数名称。
grep("list", lsf.str("package:base"), value = TRUE)
# [1] "[.Dlist" "[.listof" "[.simple.list"
# [4] "alist" "all.equal.list" "as.data.frame.list"
# [7] "as.list" "as.list.data.frame" "as.list.Date"
#[10] "as.list.default" "as.list.environment" "as.list.factor"
#[13] "as.list.function" "as.list.numeric_version" "as.list.POSIXct"
#[16] "as.list.POSIXlt" "as.pairlist" "iconvlist"
#[19] "is.list" "is.pairlist" "list"
#[22] "list.dirs" "list.files" "list2env"
#[25] "pairlist" "print.Dlist" "print.listof"
#[28] "print.simple.list" "sort.list" "unlist"
#[31] "within.list"
答案 1 :(得分:4)
// to save in SharedPreferences in Login
private static final String MyPREFERENCES = "MyPreference";
private SharedPreferences sharedPreferences;
sharedPreferences = getSharedPreferences(MyPREFERENCES, MODE_PRIVATE);
SharedPreferences.Editor editor = getSharedPreferences(MyPREFERENCES, MODE_PRIVATE).edit();
editor.putString("username", "usernameValue");
editor.apply();
//to get data from SharedPreferences in Home Page
private static final String MyPREFERENCES = "MyPreference";
private SharedPreferences sharedPreferences;
sharedPreferences = getSharedPreferences(MyPREFERENCES, MODE_PRIVATE);
String username= SharedPreferences.getString("username", null);
是objects
(列表对象)的兄弟功能。
ls
使用objects("package:base", pattern ="list")
和apropos
在整个搜索路径中查找对象。