Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/logging/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何将数据帧从r发送到SQL? #setwd('Desktop/IE332') 安装程序包(“wakefield”) install.packages(“RMySQL”) 安装程序包(“随机名称”) install.packages('密码') insta_Sql_R - Fatal编程技术网

如何将数据帧从r发送到SQL? #setwd('Desktop/IE332') 安装程序包(“wakefield”) install.packages(“RMySQL”) 安装程序包(“随机名称”) install.packages('密码') insta

如何将数据帧从r发送到SQL? #setwd('Desktop/IE332') 安装程序包(“wakefield”) install.packages(“RMySQL”) 安装程序包(“随机名称”) install.packages('密码') insta,sql,r,Sql,R,如何将数据帧从r发送到SQL? #setwd('Desktop/IE332') 安装程序包(“wakefield”) install.packages(“RMySQL”) 安装程序包(“随机名称”) install.packages('密码') install.packages('OpenRepGrid')) 图书馆(RMySQL) 库(密码) 图书馆(韦克菲尔德) 图书馆(随机名称) 行业数据欢迎访问SO。网上有许多教程和示例。例如,尝试“发送特定列”:studentData[,c(1,2,5

如何将数据帧从r发送到SQL?
#setwd('Desktop/IE332')
安装程序包(“wakefield”)
install.packages(“RMySQL”)
安装程序包(“随机名称”)
install.packages('密码')
install.packages('OpenRepGrid'))
图书馆(RMySQL)
库(密码)
图书馆(韦克菲尔德)
图书馆(随机名称)

行业数据欢迎访问SO。网上有许多教程和示例。例如,尝试“发送特定列”:
studentData[,c(1,2,5)]
studentData[,c(“col1”,“col3”,“col99”)]
。“将…发送到SQL中的表”
dbWriteTable
有很好的文档记录。
#setwd('Desktop/IE332')
install.packages("wakefield")
install.packages("RMySQL")
install.packages("randomNames")
install.packages('password')
install.packages('OpenRepGrid')
library(RMySQL)
library(password)
library(wakefield)
library(randomNames)

industriesData <- read.csv('Industries.csv')
skills <- read.csv('Skills.csv')
sp500 <- read.csv("http://www.princeton.edu/~otorres/sandp500.csv")
companies <- sample(sp500$Name, 100)

locations <- c('Northwest', 'Midwest', 'Northeast', 'South', 'Southwest', 'Southeast', 
'International') # Locations
gpas <- c(4,3.5,3,2.5,2)
n <- 100
locPrefs <- numeric(n)

studentSkills <- matrix(nrow=100,ncol=10) 
studentInd <- matrix(nrow=100,ncol=5)
jobSkills <- matrix(nrow=100,ncol=5)
for(j in 1:n){ # Samples random skills assigned to students
  studentSkills[j,] <- sample(skills[,1],10,replace=FALSE)
  studentInd[j,] <- sample(industriesData[,1],5,replace=FALSE)
  jobSkills[j,] <- sample(skills[,1],5,replace=FALSE)
}

studentData <- data.frame('first names'=randomNames(n, which.names = 'first'),'last 
names'=randomNames(n, which.names = 'last'),'username'=seq(1, 
n),'password'=password(8,numbers=TRUE),'gpa'=gpa(n, mean = 85.356, sd = 3.2, name = 
"GPA"),'visa'=sample(c("N","Y"), size = n, replace = TRUE, prob = c(.78, .22)), 'loc 
pref'=sample(locations,n,replace = TRUE), 'skill'=studentSkills, 'Industry'=studentInd) # Student data
employerData <- data.frame('company names'=companies, 'pref 
gpa'=sample(gpas,n,replace=TRUE), 'sponser?'=sample(c('N','Y'), size=n, replace = TRUE, prob 
= c(.78, .22)), 'job id'=sample(seq(100,999),n,replace=FALSE),'pref skill'=jobSkills, 
'industry'=sample(industriesData[,1],n,replace=TRUE),'location'=sample(locations,n,replace = 
TRUE)) # Employer data