Сутион здесь
listitem.xml
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<TextView
android:id="@+id/textview"
android:layout_width="match_parent"
android:layout_height="match_parent" >
</TextView>
</LinearLayout>
Код Java:
String[] countryArray = {"India", "Pakistan", "USA", "UK"};
ArrayAdapter adapter = new ArrayAdapter<String>(this, R.layout.listitem,R.id.textview, countryArray);
ListView listView = (ListView) findViewById(R.id.listview);
listView.setAdapter(adapter);
p
сам является list
, вы можете получить df
с p$data
.
Пример samll:
library(ggplot2)
p <- ggplot(mtcars, aes(x = mpg, y = cyl)) + geom_point()
identical(p$data, mtcars)
# [1] TRUE
Тот же подход, но завернутый в пакет / функцию, состоит в том, чтобы «захватить дух ваших вызовов ggplot
», используя library(ggghost)
library(ggghost)
library(ggplot2)
df <- data.frame(x = 1:20, y = 1:20, z= letters[1:20])
p %g<% ggplot(data = df, aes(x, y))
p <- p + geom_point()
rm(df)
ggghost::recover_data(p)
## this returns the data back to your environment