Hallo Peter, thank you. It is exact what I wanted. Now I can modify my program.
Corinna ________________________________ Von: Peter Konings [mailto:[EMAIL PROTECTED] Gesendet: Dienstag, 24. April 2007 10:55 An: Schmitt, Corinna Betreff: Re: [R] information extraction Hi Corinna, names() is what you are looking for, e.g. names(data) names(data)[10] names(data) <- a.vector.of.my.own.names BTW, data() is a function in R, so it's better to avoid it as the name of a dataframe. for more information, see the documentation installed with R or one of the contributed documents at http://cran.r-project.org/other-docs.html in particular the "R and octave" document will be relevant to you as a matlab user. HTH Peter. On 4/24/07, Schmitt, Corinna <[EMAIL PROTECTED]> wrote: Dear R-experts, I imported successful a workspace from Matlab. The information is stored in the variable data. If I use the command "length(data)" I get back a number which corresponds to the number of variables which were imported. Here it is 82. Now I only want to know the names of the imported variables to modify my program. Can anyone help me? My knowledge which I tested yet to archive the goal: 1. I know that I can extract the information of a variable with the command "data$staine" for example. Here I need to know the variable name "staine" coming from Matlab. But what if I do not know it? 2. The command "data[10]" just gives me back the information stored in the variable no. 10 but I do not know the name. 3. I am not allowed to make changes in the Matlab code because it just a lizenced program so I need to do it in R. In Matlab I just need to add the code line "names=evalin('base','who')" and than store the workspace. I could use the variable name in and extract the names with data$names. Has anyone an idea? Thanks, Corinna ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
