columnname

Using variable value as column name in data.frame or cbind

大兔子大兔子 提交于 2019-12-17 16:27:39
问题 Is there a way in R to have a variable evaluated as a column name when creating a data frame (or in similar situations like using cbind)? For example a <- "mycol"; d <- data.frame(a=1:10) this creates a data frame with one column named a rather than mycol . This is less important than the case that would help me remove quite a few lines from my code: a <- "mycol"; d <- cbind(some.dataframe, a=some.sequence) My current code has the tortured: names(d)[dim(d)[2]] <- a; which is aesthetically

MySQL - how to use wildcards in WHERE clause for the column names themselves? [closed]

寵の児 提交于 2019-12-13 22:50:29
问题 It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center. Closed 6 years ago . I've got a basic question about mysql. In my table 'table' I've got a column named 'foo' (String). And I'd like to do something like this: SELECT * FROM table WHERE %foo% LIKE '%thing%' But it's obviously

R How to remove characters from long column names in a data frame

人走茶凉 提交于 2019-12-13 15:22:08
问题 I have a large dataframe with long column names in it. I would like to shorten the columnnames by dropping characters before a colon sign (:), the sign is present in every column name in the dataframe columns. Looking for a way to perform this on a dataframe?? 回答1: Perhaps (third try): names(df) <- sub("^(.+[:])([^.]+)$", "\\2", names(df)) 来源: https://stackoverflow.com/questions/26807430/r-how-to-remove-characters-from-long-column-names-in-a-data-frame

Putting greek letters in column names

a 夏天 提交于 2019-12-12 15:22:08
问题 Is there any way to include Greek letters (α,β,γ) into column names of a matrix? i know you use : colnames()<-c("column 1","column 2","column 3".....) to add column names but when i tried to paste in the letters... colnames(mymatrix)<-c("random name","parameters(α,β,γ)","parameters2(α,β,γ)") it shows the "(α,β,γ)" as "(??,??,??)" Does anyone know how to do this as i need it to be really obvious for reports at work 来源: https://stackoverflow.com/questions/26179741/putting-greek-letters-in

Error while reading multiple csv files without header

你说的曾经没有我的故事 提交于 2019-12-12 05:47:51
问题 with the reference to my previous post,here is the link As suggested I tried reading files without header , but still its giving me the error Error in file(file, "rt") : invalid 'description' argument here is what I tried files1 <- list.files(path = "F:/Task sheet/NanoSniff_Data",pattern = ".csv") read.csv(files1, header = FALSE, skip = 1) 来源: https://stackoverflow.com/questions/36277222/error-while-reading-multiple-csv-files-without-header

How can you fill combobox in vb.net with column name from Microsoft SQL Server

你。 提交于 2019-12-12 02:09:28
问题 How to fill combobox in vb.net with column name from Microsoft Sql Server? I have table name called Table_Categories. I wish to fill the combobox with the column names of that table . I am also planning on adding column names in the table using vb.net as its front end . how can I do it ? Public Sub Categories() Dim Connect As New SqlConnection Dim Adapter As New SqlDataAdapter Dim DataTable As New System.Data.DataTable Dim Query As String ConnectionString = "Data Source=LUSPOC-PC;Initial

Pandas column creation

那年仲夏 提交于 2019-12-10 23:28:32
问题 I'm struggling to understand the concept behind column naming conventions, given that one of the following attempts to create a new column appears to fail: from numpy.random import randn import pandas as pd df = pd.DataFrame({'a':range(0,10,2), 'c':range(0,1000,200)}, columns=list('ac')) df['b'] = 10*df.a df gives the following result: Yet, if I were to try to create column b by substituting with the following line, there is no error message, yet the dataframe df remains with only the columns

Preventing duplicate columns when merging with data.table

大城市里の小女人 提交于 2019-12-10 22:24:43
问题 I have two data tables which have partly similar column names: dfA <- read.table( text = "A B C D E F G iso year matchcode 1 0 1 1 1 0 1 0 NLD 2010 NLD2010 2 1 0 0 0 1 0 1 NLD 2014 NLD2014 3 0 0 0 1 1 0 0 AUS 2010 AUS2010 4 1 0 1 0 0 1 0 AUS 2006 AUS2006 5 0 1 0 1 0 1 1 USA 2008 USA2008 6 0 0 1 0 0 0 1 USA 2010 USA2010 7 0 1 0 1 0 0 0 USA 2012 USA2012 8 1 0 1 0 0 1 0 BLG 2008 BLG2008 9 0 1 0 1 1 0 1 BEL 2008 BEL2008 10 1 0 1 0 0 1 0 BEL 2010 BEL2010", header = TRUE ) dfB <- read.table( text =

How to insert row into a table by select column name and value from another table in SQL Server

萝らか妹 提交于 2019-12-07 19:34:41
问题 I have a table with many columns like: Table A : ColumnA | ColumnB | ColumnC | ColumnD | ColumnE _______________________________________________ valueA | valueB | valueC | valueD | valueE How can I insert into Table B like below? Table B : ColumnName | ColumnValue _________________________ ColumnA | valueA ColumnB | valueB ColumnC | valueC ColumnD | valueD ColumnE | valueE Thank you! 回答1: You can also use a normal UNPIVOT for this. A example using table variables: declare @TableA table (Id

Find all stored procedures that reference a specific column in some table

大憨熊 提交于 2019-12-03 03:01:11
问题 I have a value in a table that was changed unexpectedly. The column in question is CreatedDate : this is set when my item is created, but it's being changed by a stored procedure. Could I write some type of SELECT statement to get all the procedure names that reference this column from my table? 回答1: One option is to create a script file. Right click on the database -> Tasks -> Generate Scripts Then you can select all the stored procedures and generate the script with all the sps. So you can