Hi all,
I have solved my question
Output<- matrix(0, length(x), 1)
for (i in 1:length(x)){
files <- paste('KT', i, '.csv', sep = '')
da1 <- read.csv(files)
Output[i,1]<-da1[1,2]
}
2011/12/14 Trying To learn again <tryingtolearnagain@gmail.com>
> Hi all,
>
> I have 100 csv files always with this information (I Attach two example
> excels)
>
> KT80.csv contains:
> ,"x"
> 1,127.188271604938
>
> KT80.csv contains
>
> ,"x"
> 1,1.06329287351545
>
>
> I have three questions:
>
> First
>
> When I created this input files I used write.csv and it authomaticaly
> creates the structure of the file as you can see.
>
> Second. If I try to read csv it appears:
>
> read.csv(KT2.csv,header=T, sep='.')
> Error en read.table(file = file, header = header, sep = sep, quote >
quote, :
> objeto 'KT2.csv' no encontrado
>
> But the file is in the right directy....
>
> Third (supossing I can solve the format files)
>
> My main question is:
>
> I want to create a matrix (or data frame) for instance from file KT80.csv
> to KT81.csv so that the rows are without header and position.
>
>
>
> 127.18
> 1.06
>
>
> Wich function would help me?
>
> I think I should use something like
>
>
>
> ffor (i in 80:81){
>
> files <- paste('KT', i, '.csv', sep = '')
>
> myfun <- function(d) {
>
> da1 <- read.csv(d)
>
> Output[i,1]=da1[1,2]
>
>
>
> }
>
> lout<- lapply(files, myfun)
>
> }
>
> But results that says Output doesn´t exists?
>
> I must create before? How?
>
> Many Thans¡¡¡
>
[[alternative HTML version deleted]]