Categories
data science

get.dates for linear graph – R


get.dates<-function(loc){
	setwd(loc)

	df<-data.frame(read.csv('rawPosts.csv'))
	date<-data.frame(table(df))
	write.csv(date,'datePosts.csv')

	df2<-data.frame(read.csv('rawQs.csv'))
	date2<-data.frame(table(df2))
	write.csv(date2,'dateQs.csv')
	
	if(date[1,1]==date2[1,1]){
		full<-data.frame(date,date2[2])
		fullt<-data.frame(t(full))
		rownames(fullt)<-c("date","posts","qs")
		colnames(fullt)<-NULL
		write.csv(fullt,'forGraph.csv',col.names=NULL)
	}

	if(date[1,1]!=date2[1,1]){
		print('Nope')
	}


	setwd('~/')
	
}

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s