Closed Brian-160 closed 4 years ago
thanks for your question! In the future include your session info please.
The output of ncdc()
is a list. So you can't index like [x,y]
on a list, e.g, try
x <- list(1, 2, 3)
x[1,2]
#> Error in x[1, 2] : incorrect number of dimensions
The data as a data.frame is in the $data
slot, so this should work
mso_data$data[1:2, 4:5]
Thank you so much, disregard my previous email. I actually tried something similar but I think I forgot the '[1:2, 4:5]'
Worked perfectly, thanks again.
Brian
On Fri, Jul 10, 2020 at 2:50 PM Scott Chamberlain notifications@github.com wrote:
thanks for your question! In the future include your session info please.
The output of ncdc() is a list. So you can't index like [x,y] on a list, e.g, try
x <- list(1, 2, 3)x[1,2]#> Error in x[1, 2] : incorrect number of dimensions
The data as a data.frame is in the $data slot, so this should work
mso_data$data[1:2, 4:5]
— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/ropensci/rnoaa/issues/365#issuecomment-656883783, or unsubscribe https://github.com/notifications/unsubscribe-auth/AQHY5OPRKR5QNXQDRX5RQQ3R255HJANCNFSM4OW5B6OQ .
glad it worked!
I am attempting to produce a usable climate database. Unfortunately, when I download the data it is very un-'tidy'. I attempted to use pivot_longer from the tidyverse package but received an error saying 'incorrect dimensions'. This is how my data-frame looks like in R Studio:
I have tried everything, I only want to keep columns 1:2 4:5:
Another attempt:
(this nulled the entire data frame)
When I use the function 'colnames()' I get an error message saying there are no column names. I will also post my code for downloading data, am I bringing the Tibble on myself or is this the data format NCDC uses?
Thanks for any help, Brian.