0

My code is nut running as expected in Kaggle's notebook. It works fine in Rstudio. I have a list, it consists of 12 csv files brought in via read.csv. I use a for loop on the list and apply complete.cases to each member of the list. When I try to run this code on kaggle I get an error.

enter image description here

Apparently kaggle doesn't like the shorthand. I did a mock up to try to figure it out and noticed something strange. Here is the code:

a<-10:15
b<-1:6

Moe<-cbind(a,b)
Larry<-cbind(a,b)
Curly<-cbind(a,b)

df_list<-list(Moe,Larry,Curly)

When I run df_list I expect to see a list of the dataframes, Moe, Larry & Curly. What I see is the entire contents of each of those dataframes.

enter image description here

I know the sample code doesn't have Moe, larry and Curly as dataframes here, but I tried it with as.dataframe and the results were the same. I would think to reference the name of the dataframe i could use [] and for the data [[]]. I've tried running:

ldf_no_null= for(i in ldf){complete.cases(i)}

But this generates a null value. I assume because it is being applied to the list of names and not the data connected to them. Can someone explain what might be going on here?

1 Answers1

0

I figured it out. Thank you. Just got rid of the shorthand.

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Feb 17 '23 at 11:51