for (i in 1:length(mdma4))
{
result <- mdma$MRP.Area[grepl(mdma4[i], mdma$Material)]
result <- unique(result)
result <- rbind(data.frame(as.list(result)))
write.table(result, file = "mrp_area_missing.csv", append = TRUE,sep = ",")
}
我需要编写csv文件 在每次循环迭代期间,它应该在文件中添加一行 上面的代码,正在创建单行文件 请帮忙
答案 0 :(得分:0)
将结果放在数据框中并在循环外写入数据框。 它更有效,更容易。
buildscript { // Configuration for building
repositories {
jcenter() // Bintray's repository - a fast Maven Central mirror & more
mavenCentral()
}
dependencies {
classpath 'com.google.cloud.tools:appengine-gradle-plugin:+' // latest App Engine Gradle tasks
}
}
repositories { // repositories for Jar's you access in your code
maven {
url 'https://maven-central.storage.googleapis.com' // Google's mirror of Maven Central
// url 'https://oss.sonatype.org/content/repositories/snapshots' // SNAPSHOT Repository (if needed)
}
jcenter()
mavenCentral()
}
apply plugin: 'java' // standard Java tasks
apply plugin: 'war' // standard Web Archive plugin
apply plugin: 'com.google.cloud.tools.appengine' // App Engine tasks
dependencies {
providedCompile group: 'javax.servlet', name: 'servlet-api', version:'2.5'
compile 'com.google.appengine:appengine:+'
compile "org.apache.httpcomponents:httpclient:4.5.3"
compile "org.apache.commons:commons-lang3:3.5"
compile "com.google.code.gson:gson:2.8.0"
// https://mvnrepository.com/artifact/com.google.appengine/appengine-api-1.0-sdk
compile group: 'com.google.appengine', name: 'appengine-api-1.0-sdk', version: '1.2.0'
testCompile 'junit:junit:4.12'
testCompile group: 'junit', name: 'junit', version: '4.12'
}
appengine { // App Engine tasks configuration
run { // local (dev_appserver) configuration (standard environments only)
port = 8080 // default
}
deploy { // deploy configuration
stopPreviousVersion = true // default - stop the current version
promote = true // default - & make this the current version
}
//tools.cloudSdkHome = '/Applications/google-cloud-sdk'
}
group 'xxx'
version 'xxx'
sourceCompatibility = 1.7 // App Engine Standard uses Java 7
targetCompatibility = 1.7 // App Engine Standard uses Java 7