abundance = data.frame(lncount = c(13, 865, 1800), lnedna = c(4.72, 5.05, 5.22, 5.24,
5.36, 5.71, 5.63, 5.97,
6.08, 6.20, 6.43, 6.54))
xyplot(lnedna ~ lncount, data = abundance,
xlab = "Mussel Count by Snorkel Survey",
ylab = "eDNA concentraion (gene sequence/Liter) on log scale",
main = "Mussel Abundance")
abline(lm(lnedna ~ lncount))
这是我在尝试添加回归线时遇到的错误:eval中的错误(expr,envir,enclos):找不到对象'lnedna'
lnedna在制作散点图时效果很好,为什么不添加回归线呢?
答案 0 :(得分:2)
您似乎需要在abline
电话中添加xyplot
:
lattice::xyplot(lnedna ~ lncount, data = abundance,
panel = function(x, y) {
lattice::panel.xyplot(x, y)
lattice::panel.abline(lm(y ~ x))
},
xlab = "Mussel Count by Snorkel Survey",
ylab = "eDNA concentraion (gene sequence/Liter) on log scale",
main = "Mussel Abundance")
答案 1 :(得分:1)
我无法使用 if(ContextCompat.checkSelfPermission(this,Manifest.permission.ACCESS_FINE_LOCATION)!= PackageManager.PERMISSION_GRANTED){
ActivityCompat.requestPermissions(LoginActivity.this, new String[]{Manifest.permission.ACCESS_FINE_LOCATION}, 1600);
}
重新生成您的答案。感谢@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String permissions[],@NonNull int[] grantResults) {
if(requestCode==REQUESTID){
// If request is cancelled, the result arrays are empty.
if (!(grantResults.length > 0 && grantResults[0] == PackageManager.PERMISSION_GRANTED)) {
// permission was not granted, boo!
//show the permission rationale if the user did not click never show again
if(ActivityCompat.shouldShowRequestPermissionRationale(LoginActivity.this,android.Manifest.permission.ACCESS_FINE_LOCATION)){
//means user did not choose to never show permissions again. show the alert dialog
//Show a message explaining why the permission is necessary
//This explanation will only be shown if the user hasn't clicked do not show again on the permission dialog
}
}
}
}
格子答案。感谢他那个。
<强> GGPLOT2 强>
try {
LocationServices.FusedLocationApi.requestLocationUpdates(mGoogleApiClient, mLocationRequest, this);
} catch (SecurityException se) {
Toast.makeText(this, "Please provide location permissions to continue", Toast.LENGTH_SHORT).show();
}
格子(来自下面的hrabel)
plot()