-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfunction.R
More file actions
36 lines (36 loc) · 1.11 KB
/
function.R
File metadata and controls
36 lines (36 loc) · 1.11 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
mydataRead<-function(x="~/ShinyApps/run/prova.csv"){
data1<-read.csv(x, sep=",",header=TRUE, colClasses=c(Date="character","numeric"))
return(data1)
}
insertRow<-function(existingDF, newrow, r){
lim<-length(existingDF[,2])
if (r<=lim)
{
existingDF[seq(r+1,nrow(existingDF)+1),]<-
existingDF[seq(r,nrow(existingDF)),]
existingDF[r,]<-newrow
existingDF
write.csv(existingDF,"~/ShinyApps/run/prova.csv", ,row.names=FALSE)}
}
changeRow<-function(existingDF, newrow, r){
lim<-length(existingDF[,2])
if (r<=lim)
{
existingDF[r,]<-newrow
existingDF
write.csv(existingDF,"~/ShinyApps/run/prova.csv", ,row.names=FALSE)}
}
newRow<-function(existingDF, newrow, Names){
existingDF<-rbind(existingDF,newrow)
names(existingDF)<-Names
write.csv(existingDF,"~/ShinyApps/run/prova.csv",row.names=FALSE)
}
deleteLastRow<-function(existingDF){
r<-(NROW(existingDF))
existingDF<-existingDF[-r,]
write.csv(existingDF,"~/ShinyApps/run/prova.csv", row.names= FALSE)
}
deleteARow<-function(existingDF,r){
existingDF<-existingDF[-r,]
write.csv(existingDF,"~/ShinyApps/run/prova.csv",row.names= FALSE)
}