FAQ Database Discussion Community


Summary a list of integers into two columns in R

r,list,matrix,integer,names
This is what I've got (a list): >head(indexes) [[1]] numeric(0) [[2]] [1] 12 [[3]] [1] 13 [[4]] [1] 2 3 [[5]] [1] 25 [[6]] [1] 26 > all(vapply(indexes, is.numeric, TRUE)) # (note that..) [1] TRUE .. and this is what I want (same information for me): >head(res,6) [,1] [,2] [1,]...

Displaying repeated names from month list just once in excel (2010)

excel,indexing,row,formula,names
I have a Leaves Table on sheet 1 that has the following headers Column A = Months ; Column B = Names ; Column C = ... Now on Sheet 2, I have a months data validation list in Cell H59. QUESTION: When I select a particular month from the...

R text mining : Grouping of similar patterns from a dataframe.

r,dataframes,text-mining,names,tm
I have applied various cleaning functions from the tm package, like removing punctuation, numbers, special chars, common English words etc. and got a data-frame as shown below. Remember, I don't have a primary-key, like cust_id or account_number to rely on sno names 001 SIRIS BLACK 002 JOHN DOE 003 STEPHEN...

Java Dynamic Names

java,android,dynamic,names
I know, that Java doesn't have a pre-processor, so some stuff is more or less impossible in java. Is there really NO way to fill those arrays with dynamic names in a loop? I'd like to have something like: for(int i=0;i<5;i++){ earnTvs[i]=(TextView) findViewById(R.id.INSERT_GREAT_TRICK_HERE("earn"+i+"Tv")); } instead of earnTvs[0] = (TextView) findViewById(R.id.earn1Tv);...

Preserve names of a list with sapply()

r,names,sapply
I have the following type of data: token <- list( cameron = rep("people", 12)) I'm applying a function like the following: token <- sapply(token, function(x){ x <- str_trim(x, side = "both") }) The problem is sapply() messes up the name of the structure. Running names(token) returns NULL. Running str(token) shows...

R: Data frame names with escape characters

r,escaping,data.frame,names
In R, how can I do this mdf1 <- data.frame(a=c(1:5),b=c(11:15),c=c(21:25),d=c(101:105)) names(mdf1)[2] <- 'A-11:01' in one operation? Something like: mdf1 <- data.frame(a=c(1:5),'A-11:01'=c(11:15),c=c(21:25),d=c(101:105)) which produces A.11.01 instead... Thanks!...

R - aggregate results in disparity between names(data) and columns in head(data)

r,aggregate,head,names
I have a dataset of long format with 3 factors (strain, genotype, region) and 1 value (volume). This dataset is called individualData. Basically what I'm trying to do is calculate the mean and standard deviation of volume for every combination of strain * genotype * region, with the exception of...

Convert a number into a name

javascript,html,numbers,converter,names
For example, I have <span id="convertNumberToName">1</span> somewhere on my page. Notice the "1", I want to covert "1" into let's say "John" every time the "1" is within a span tag with "convert" as the id. I also want "2" to be converted to "Pete". And "3" to be converted...

In R, how can I set the names of an object and return it in one line?

r,names
I would like to set the names of my R object and return it in one line. It should look something like: names(doWork(), c("a", "b", "c")) And perform the equivalent of: x <- doWork() names(x) <- c("a", "b", "c") x Is this possible?...

Name list of data frames from data frame

r,list,data.frame,names
I usually read a bunch of .csv files into a list of data frames and name it manually doing. #...code for creating the list named "datos" with files from library # Naming the columns of the data frames names(datos$v1r1)<-c("estado","tiempo","x1","x2","y1","y2") names(datos$v1r2)<-c(...) names(datos$v1r3)<-c(...) I want to do this renaming operation automatically. To...

Extracting just a string element from a pandas dataframe

python,list,names
Okay, so say I have a pandas dataframe x, and I'm interested in extracting a value from it: > x.loc[bar==foo]['variable_im_interested_in'] Let's say that returns the following, of type pandas.core.series.Series: 24 Boss Name: ep_wb_ph_brand, dtype: object But all I want is the string 'Boss'. Wrapping the first line of code in...

How to select all names in Excel with VBA

excel,excel-vba,cell,names
I am working with a large Excel file, where I have defined around 2000 names for cells. In addition the excel contains formulas, these formulas are already entered with references to cells (A23-B24). I want to change the cells references by the defined names (instead of A23-B24 having VARIABLE_100-VARIABLE_120). I...

Validate Proper Names (with Perl)

regex,perl,names
I have a census list of 150k last names, and trying to use this to validate the spelling of person names in an existing database. Obviously there are many ethnic names in my database that don't match the census list, but are clearly not misspelled (Italian names like "Petroni", Swedish...

R: Using the “names” function on a dataset created within a loop

r,paste,assign,names
I am using a for loop to read in multiple csv files and naming the datasets import1, import2, etc. For example: assign(paste("import",i,sep=""), read.csv(files[i], header=FALSE)) However, I now want to rename the variables in each dataset. I have tried the following: names(as.name(paste("import",i,sep=""))) <- c("xxxx", "yyyy") But get the error "target of...