Quantcast
Channel: Desktop topics
Viewing all articles
Browse latest Browse all 213819

Table gets empty when looping through a column

$
0
0

Hi everyone,

 

I have a question concerning the use of R to transform data in Power BI.

 

I am working on this table and trying to replace the first column data.

 

Data before

 

 

I have trouble understanding how does R code can really interact with data, and I am a beginner in R. This might be why I get this error :

 

I wrote this script (trying, as a test, to replace all values of the first column by 1) and when I run it, the data seems to be empty :


ctr <- 0

for (day in dataset[,1]) {
ctr <- ctr + 1
dataset[,1][ctr] <- 1
}

 

After R script

 

I thought someone may have a solution.

 

Thanks,

 

Baptiste

 

 


Viewing all articles
Browse latest Browse all 213819

Trending Articles