I have a dataframe called HMDAYTIME with the columnname "A" and the rownames "2" and "3", and based on a raw data csv called "DATA".
My question is (i didn´t found anything about that on the internet), if i want to do a for loop to change each value of the "A" column, how can I make the bolded code show the "A" column value based on the rowname.
Thanks very much in advance,
Anton
HMDAYTIME <- data.frame(1
length(unique(DATA$Wochentag))))
colnames(HMDAYTIME) <- "A"
rownames(HMDAYTIME) <- unique(DATA$Wochentag)
for (i in rownames(HMDAYTIME))
{
HMDAYTIME$A[#the row of i] <- sum(DATA$Brutto.Preis[DATA$Wochentag == DATA$Wochentag])
}
print(HMDAYTIME)
My question is (i didn´t found anything about that on the internet), if i want to do a for loop to change each value of the "A" column, how can I make the bolded code show the "A" column value based on the rowname.
Thanks very much in advance,
Anton
HMDAYTIME <- data.frame(1
colnames(HMDAYTIME) <- "A"
rownames(HMDAYTIME) <- unique(DATA$Wochentag)
for (i in rownames(HMDAYTIME))
{
HMDAYTIME$A[#the row of i] <- sum(DATA$Brutto.Preis[DATA$Wochentag == DATA$Wochentag])
}
print(HMDAYTIME)