names

DataGridView Edit Column Names

拈花ヽ惹草 提交于 2019-11-27 17:57:23
问题 Is there any way to edit column names in a DataGridView? 回答1: I don't think there is a way to do it without writing custom code. I'd implement a ColumnHeaderDoubleClick event handler, and create a TextBox control right on top of the column header. 回答2: You can also change the column name by using: myDataGrid.Columns[0].HeaderText = "My Header" but the myDataGrid will need to have been bound to a DataSource . 回答3: You can edit the header directly: dataGridView1.Columns[0].HeaderCell.Value =

Numbers as column names of data frames

谁都会走 提交于 2019-11-27 14:39:55
Is there a reason why R won't allow me to have a number as the column name of my dataframe? Also noticed that if i do data.frame(XX) it adds an X to all the column headers that have numbers at the front. Shane Yes, because R won't allow names of objects to start with numbers. If you were to call attach() with the data.frame, this would cause some issues. data.frame (and read.table ) function has the check.names parameter (default is TRUE ) If TRUE then the names of the variables in the data frame are checked to ensure that they are syntactically valid variable names and are not duplicated. If

(K&R) At least the first 31 characters of an internal name are significant?

非 Y 不嫁゛ 提交于 2019-11-27 14:05:21
问题 When taken literally, it makes sense, but what exactly does it mean to be a significant character of a variable name? I'm a beginning learner of C using K&R. Here's a direct quote from the book: "At least the first 31 characters of an internal name are significant. For function names and external variables, the number may be less than 31, because external names may be used by assemblers and loaders over which the language has no control. For external names, the standard guarantees only for 6

What is a nested name specifier?

て烟熏妆下的殇ゞ 提交于 2019-11-27 13:07:14
Related to this I want to know what exactly is a nested name specifier? I looked up in the draft but I could understand the grammar as I haven't taken any Compiler Design classes yet. void S(){} struct S{ S(){cout << 1;} void f(){} static const int x = 0; }; int main(){ struct S *p = new struct ::S; p->::S::f(); S::x; ::S(); // Is ::S a nested name specifier? delete p; } ::S is a qualified-id . In the qualified-id ::S::f , S:: is a nested-name-specifier . In informal terms 1 , a nested-name-specifier is the part of the id that begins either at the very beginning of a qualified-id or after the

Dataframes in a list; adding a new variable with name of dataframe

≯℡__Kan透↙ 提交于 2019-11-27 13:03:44
问题 I have a list of dataframes which I eventually want to merge while maintaining a record of their original dataframe name or list index. This will allow me to subset etc across all the rows. To accomplish this I would like to add a new variable 'id' to every dataframe, which contains the name/index of the dataframe it belongs to. Edit: "In my real code the dataframe variables are created from reading multiple files using the following code, so I don't have actual names only those in the 'files

Access and preserve list names in lapply function

丶灬走出姿态 提交于 2019-11-27 11:18:47
I need to access list names inside the lapply function. I've found some threads online where it's said I should iterate through the names of the list to be able to fetch each list element name in my function: > n = names(mylist) > mynewlist = lapply(n, function(nameindex, mylist) { return(mylist[[nameindex]]) }, mylist) > names(mynewlist) NULL > names(mynewlist) = n The problem is that mynewlist loses the original mylist indexes and I have to add that last names() assignment to restore them. Is there a way to give an explicit index name to each element returned by the lapply function? Or a

Specifying column names in a data.frame changes spaces to “.”

帅比萌擦擦* 提交于 2019-11-27 09:11:24
Let's say I have a data.frame, like so: x <- c(1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10,1:10) df <- data.frame("Label 1"=x,"Label 2"=rnorm(100)) head(df,3) returns: Label.1 Label.2 1 1 1.9825458 2 2 -0.4515584 3 3 0.6397516 How do I get R to stop automagically replacing the space with a period in the column name? ie, "Label 1" instead of "Label.1". You don't. With the space you desire the format would not satisfy the requirements for an identifier that come to play when you use df$column.1 -- that could not cope with a space. So see the make.names() function for details or an example: >

Why the “mutable default argument fix” syntax is so ugly, asks python newbie

て烟熏妆下的殇ゞ 提交于 2019-11-27 04:36:11
Now following my series of "python newbie questions" and based on another question . Prerogative Go to http://python.net/~goodger/projects/pycon/2007/idiomatic/handout.html#other-languages-have-variables and scroll down to "Default Parameter Values". There you can find the following: def bad_append(new_item, a_list=[]): a_list.append(new_item) return a_list def good_append(new_item, a_list=None): if a_list is None: a_list = [] a_list.append(new_item) return a_list There's even an "Important warning" on python.org with this very same example, tho not really saying it's "better". One way to put

What are all of the allowable characters for people's names? [closed]

佐手、 提交于 2019-11-27 03:20:20
There are the standard A-Z, a-z characters, but also there are hyphens, em dashes, quotes, etc. Plus, there are all of the international characters, like umlauts, etc. So, for an English-based system, what's the complete set? What about sets for other languages? What about UTF8, UTF16, etc? Bonus question: How many name fields are needed, and what are their maximum lengths? EDIT: There are definitely two different types of characters involved in people's names, those that are there as part of the context, and those that are there for structural reasons. I don't want to limit or interfere with

How to pass dynamic column names in dplyr into custom function?

折月煮酒 提交于 2019-11-27 01:21:41
问题 I have a dataset with the following structure: Classes ‘tbl_df’ and 'data.frame': 10 obs. of 7 variables: $ GdeName : chr "Aeugst am Albis" "Aeugst am Albis" "Aeugst am Albis" "Aeugst am Albis" ... $ Partei : chr "BDP" "CSP" "CVP" "EDU" ... $ Stand1971: num NA NA 4.91 NA 3.21 ... $ Stand1975: num NA NA 5.389 0.438 4.536 ... $ Stand1979: num NA NA 6.2774 0.0195 3.4355 ... $ Stand1983: num NA NA 4.66 1.41 3.76 ... $ Stand1987: num NA NA 3.48 1.65 5.75 ... I want to provide a function which