Quantcast
Channel: Data Science, Analytics and Big Data discussions - Latest topics
Viewing all articles
Browse latest Browse all 4448

multiple lists combines errors in R

$
0
0

@xiong.pan wrote:

0
down vote
favorite
I have multiple lists wanted to combine, but got wrong results

The code I used

hiv.Scatter <- list(predictions = predictdata, labels = L)

for (k in 1:2){
hiv.Scatter <-
list(predictions = append(
list(hiv.Scatter$predictions),
list(predictdata)
),
labels = append(list(hiv.Scatter$labels), list(L)))
}
But use the code above, I got very strange results. the results I wanted is:

str(hiv.Scatter)
List of 2
predictions:List of 3 .. : num [1:6] 0.0287 0.00648 0.00926 0.04352 0.01296 …
: num [1:6] 0.0287 0.00648 0.00926 0.04352 0.01296 ... .. : num [1:6] 0.0287 0.00648 0.00926 0.04352 0.01296 …
labels :List of 3 .. : num [1:6] 1 1 1 1 1 1
: num [1:6] 1 1 1 1 1 1 .. : num [1:6] 1 1 1 1 1 1
The data I used

dput(L)
c(1, 1, 1, 1, 1, 1)
dput(predictdata)
c(0.0287037037037037, 0.00648148148148148, 0.00925925925925926,
0.0435185185185185, 0.012962962962963, 0.00833333333333333)
Thanks for your help

Posts: 2

Participants: 2

Read full topic


Viewing all articles
Browse latest Browse all 4448

Trending Articles