I want to create a data frame "Coefficients". At first I extract a column from another data frame "APD":
str(APD.frame <- read.table("APD_data_15.txt", header = TRUE, sep = "", dec = "."))
APD.frame <- within(APD.frame, {
Serial_number <- factor(Serial_number)
Lot <- factor(Lot)
Wafer <- factor(Wafer)} )
Coefficients<- data.frame(APD["Serial_number"])
Now I want to add some wildcard columns (makes the following procedure more easy to understand for me):
Coefficients[2]<- c(1)
Coefficients[3]<- 1
Coefficients[4]<- NA
In all cases I receive "unknown columns" (shown in RStudio by a mouse rollover). I need them to be numeric. Whyever I cannot convert them to numeric ones: Coefficients[3]<- as.numeric(Coefficients[3])
How can I ensure the columns to be numeric/why aren't they already?
Minimal example: http://www.datafilehost.com/d/5d00de23
Update:
> class(Coefficients[2])
[1] "data.frame"
> Coefficients<- transform(Coefficients, Coefficients[2] = as.numeric(Coefficients[2]))
Error: unexpected '=' in "Coefficients<- transform(Coefficients, Coefficients[2] ="