How to convert uploaded Excel data to data.frame() code in R?

Viewed 27

I have one excel file

dataA<- read_excel("Yield.xlsx", sheet=1) 
Yield<- dataA %>% as.data.frame() 
Yield

enter image description here

Now, I want to send this data to other people as codes. So, I generated the same data using data.frame() by typing one by one.

Genotype <- c("A","B","C","D","E")
A<- c(17.0,16.3,16.1,16.3,17.3)
B<- c(36.3,35.4,38.2,36.3,35.2)
C<- c(242.5,237.2,234.3,243.8,232.6)
D<- c(206.4,206.5,206.2,210.9,201.7)
E<- c(70.8,71.2,70.8,73.1,71.9)

Yield2<- data.frame(Genotype,A,B,C,D,E)

However, I think there is a way to automatically convert original data (Yield) to data.frame() code to send the data as code, not attached file.

Could you let me know how to do it?

Always many thanks!!

0 Answers
Related