Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201839

Where is the error when I try to create a data frame from objects that represent unique values using `data.frame` in R?

$
0
0

I want to create a dataframe called Tabla.Sincronizacion with 8 columns (ID,Period,Estimator.type,Value.for.VeDBA,Delay.for.VeDBA,Value.for.RMS,Delay.for.RMS,No.data) and 172 rows. The particularity, in this case, is that 5 out of 8 columns are built from single-value objects. In the other three columns (ID,Period and Estimator.type), I use repeated words.

To create such a data frame, I am using the following code:

Tabla.sincronizacion <- data.frame(ID=c("HAle","HAle","HAle","HAle","HAle",...),
                                      Period=c("Todo","Todo","Todo","Todo","1er dia",...),
                                      Estimator.type=c("R²","S.E.","Pearson","Spearman","R²",...),
                                      Value.for.VeDBA=c(HAle_Todo_VeDBA_R2.value,HAle_Todo_VeDBA_SE.value,HAle_Todo_VeDBA_Pearson.value,HAle_Todo_VeDBA_Spearman.value,HAle_1er_dia_VeDBA_R2.value,...),
                                      Delay.for.VeDBA=c(HAle_Todo_VeDBA_R2.delay,HAle_Todo_VeDBA_SE.delay,HAle_Todo_VeDBA_Pearson.delay,HAle_Todo_VeDBA_Spearman.delay,HAle_1er_dia_VeDBA_R2.delay,...),
                                      Value.for.RMS=c(HAle_Todo_RMS_R2.value,HAle_Todo_RMS_SE.value,HAle_Todo_RMS_Pearson.value,HAle_Todo_RMS_Spearman.value,HAle_1er_dia_RMS_R2.value,...),
                                      Delay.for.RMS=c(HAle_Todo_RMS_R2.delay,HAle_Todo_RMS_SE.delay,HAle_Todo_RMS_Pearson.delay,HAle_Todo_RMS_Spearman.delay,HAle_1er_dia_RMS_R2.delay,...),
                                      No.data=c(HAle_Todo.nrows,HAle_Todo.nrows,HAle_Todo.nrows,HAle_Todo.nrows,HAle_1er_dia.nrows,...))

I can't get the above code to work. Something strange is happening because even though I've checked that all the objects I call exist, I get the error Error: inesperado ')' in "_1er_dia.nrows,DRodri_2o_dia.nrows,DRodri_2o_dia.nrows,DRodri_2o_dia.nrows,DRodri_2o_dia.nrows,DRodri_3o_dia.nrows,DRodri_3o_dia.nrows,DRodri_3o_dia.nrows,DRodri_3o_dia.nrows,DRodri_4o_dia.nro".

I've done some checking, however, I don't understand what could be happening. One has been to try to create separate vectors for each column, which has made me check that the problem is in the columns Value.for.VeDBA and Delay.for.VeDBA.

ID<- c("HAle","HAle","HAle","HAle","HAle"...)
Period<- c("Todo","Todo","Todo","Todo","1er dia"...)
Estimator.type<- c("R²","S.E.","Pearson","Spearman"...)
Value.for.VeDBA<- c(HAle_Todo_VeDBA_R2.value,HAle_Todo_VeDBA_SE.value,HAle_Todo_VeDBA_Pearson.value,HAle_Todo_VeDBA_Spearman.value,HAle_1er_dia_VeDBA_R2.value...)
Delay.for.VeDBA<- c(HAle_Todo_VeDBA_R2.delay,HAle_Todo_VeDBA_SE.delay,HAle_Todo_VeDBA_Pearson.delay,HAle_Todo_VeDBA_Spearman.delay,HAle_1er_dia_VeDBA_R2.delay...)
Value.for.RMS<- c(HAle_Todo_RMS_R2.value,HAle_Todo_RMS_SE.value,HAle_Todo_RMS_Pearson.value,HAle_Todo_RMS_Spearman.value,HAle_1er_dia_RMS_R2.value...)
Delay.for.RMS<- c(HAle_Todo_RMS_R2.delay,HAle_Todo_RMS_SE.delay,HAle_Todo_RMS_Pearson.delay,HAle_Todo_RMS_Spearman.delay,HAle_1er_dia_RMS_R2.delay...)
No.data<- c(HAle_Todo.nrows,HAle_Todo.nrows,HAle_Todo.nrows,HAle_Todo.nrows,HAle_1er_dia.nrows...)

For the two columns mentioned (Value.for.VeDBA and Delay.for.VeDBA) I get the + symbol when I try to create the vector as if something was missing.

As I mentioned, I have checked that all the objects I call in the code exist in my 'environment', so I don't understand where the error is since I have also checked that all the columns have the same number of rows (172).

Does anyone have any ideas?


Viewing all articles
Browse latest Browse all 201839

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>