Hello,
The error comes from having 2 colors and 4 labels in
scale_colour_manual("", values = c(f_cols[1], m_cols[1]), labels =
c("F", "M" , "C" , "G"))
You need the same number of colors and labels. For instance, though
they're probably not the colors you want the following vector has 4
c
Hello Rui and Bert,
This is a great help! Thank you both!
Here is my job assignment: boss accumulate many years excel reports from same
lab. Each report contents multiple data sheets. Those sheets may/may not
updated, and some sheets are new. Good news is, the same testing result data
will be s
... But why not dispense with multiple files, name juggling, and
environments by simply putting everything in one list of lists (lists are
recursive structures!):
all_files <- lapply(filenames, function(nm)import_list(nm,...))
names(all_files) <- filenames
## Note: the ... are any optional paramet
Thanks everyone for being so kind and patient with me throughout the
process! Mr. Barradas and Mr. Lemon, very generous of you for taking the
time and patience to go over my code and data , and taking the time to give
me meaningful feedback!
With your help and suggestion, I was successful in makin
Hello,
Here are two more attempts at solving the problem.
1. Instead of having 30-40 data.frames per file in the globalenv, not a
good idea, the following code will create as many lists as you have
files and each list is a list of df's.
temp_list <- vector("list", length = length(filenames)
Hi Rui,
I copied "list2env(i, envir = .GlobalEnv)" to the code, but I got the same
error message of "first argument must be a named list". Maybe list2env cannot
put in loop? the code works very well outside of for loop.
One more thing, the difference file may have same sheet name. that's why I w
Hello,
If in each iteration i is a list, try removing the call to names().
Try, in the loop,
list2env(i, envir = .GlobalEnv)
The error message is telling that list2env's first argument must be a
named list and names(i) is an unnamed vector, it's i that's the named
list (you even changed its
Hi Rui,
list2env(file1, envir = .GlobalEnv) is worked very well. Thank you.
But when I tried to put the sample code into for loop. I got error message:
for(i in filenames){
assign(i, import_list(paste0(i, ".xlsx", sep="")))
names(i) <- paste(i, names(i), sep = "_")
list2env(names(i), envir
Hello,
list2env(file1, envir = .GlobalEnv)
will create data.frames dx1, dx2, etc, in the global environment.
If you really need the names file1_dx1, file1_dx2, etc, you can first
change the names
names(file1) <- paste("file1", names(file1), sep = "_")
and then run list2env like above.
H
Hi R team,
I can use rio package to read excel file into R as a list. The excel file
content multiple sheets (30 - 40 data sheets). I can convert each data elements
into dataframe manually. I have multiple excel files with multiple data sheets.
I need to load them into R and do the comparison fo
Hi Tariq,
There were a couple of glitches in your data structure. Here's an
example of a simple plot:
dat<-structure(list(year = c(2018, 2019, 2019, 2019, 2019, 2019, 2019,
2019, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017, 2017,
2017, 2017, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,
11 matches
Mail list logo