Questions tagged [names]

"names" (plural) is an attribute of some R objects in the R language

In the scientific software R for statistical computing and graphics, "names" is an attribute of some data objects, like vectors (including lists) and data frames. See ?names for details.

873 questions
30
votes
2 answers

3 Dimensional Array Names in R

In the 3 Dimensional array bellow : ar <- array(someData, c(5, 5, 5)); rownames(ar) <- ...; #to set up row names colnames(ar) <- ...; #to set up col names How can i set the third dimension names ?
RiskTech
  • 1,135
  • 3
  • 13
  • 19
27
votes
3 answers

Why are Xs added to data frame variable names when using read.csv?

When I use the read.csv() function in R to load data, I often find that an X has been added to variable names. I think I just about always see it it in the first variable, but I could be wrong. At first, I thought R might be doing this because I…
mikebmassey
  • 8,354
  • 26
  • 70
  • 95
27
votes
8 answers

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

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".…
cregox
  • 17,674
  • 15
  • 85
  • 116
24
votes
7 answers

reading a csv file with repeated row names in R

I am trying to read a csv file with repeated row names but could not. The error message I am getting is Error in read.table(file = file, header = header, sep = sep, quote = quote, : duplicate 'row.names' are not allowed. The code I am using…
baz
  • 6,817
  • 11
  • 36
  • 37
24
votes
4 answers

Avoid that space in column name is replaced with period (".") when using read.csv()

I am using R to do some data pre-processing, and here is the problem that I am faced with: I input the data using read.csv(filename,header=TRUE), and then the space in variable names became ".", for example, a variable named Full Code became…
zeno tsang
  • 735
  • 1
  • 6
  • 16
22
votes
2 answers

Is there a way to get a vector with the name of all functions that one could use in R?

I would like to have a call that returns me a vector with the names of all function that I could call in the current R session. Does anybody know how to achieve this? (I would like to check user entered variables against this vector. We had some…
Henrik
  • 14,202
  • 10
  • 68
  • 91
22
votes
6 answers

R Error: names() applied to a non-vector

I have a chunk of code which produces an error only the first time I run it. Strangely if I run it a second time I get no error (craziness definition?). Also the error does not show up always at the same position, I mean that if I add a few lines of…
Manfredo
  • 1,760
  • 4
  • 25
  • 53
21
votes
2 answers

Preserve names when coercing vector from binary to `as.numeric`?

In R, when you coerce a vector from binary to numeric, the names are stripped away. There are a few possible solutions, which I've outlined before. It seems dangerous to rely on implicit conversion by adding 0 to all the values, and the sapply()…
TARehman
  • 6,659
  • 3
  • 33
  • 60
21
votes
2 answers

Numbers as column names of data frames

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.
Nathaniel Saxe
  • 1,527
  • 2
  • 15
  • 25
19
votes
2 answers

Advantage of using a lambda:None function as a namespace?

I saw the following code: eris = lambda:None eris.jkcpp = np.einsum('iipq->ipq', eriaa[:ncore[0],:ncore[0],:,:]) eris.jc_PP = np.einsum('iipq->pq', eriab[:ncore[0],:ncore[0],:,:]) Can we define arbitrary attributes for a function defined by…
孙文趋
  • 577
  • 6
  • 13
17
votes
5 answers

maven : deploy artifact file name

Hi : Im finding that maven deploys by default change the file name to match the version+artifact id. For example Deploying a jar file, with artifact=A and version=V-0.1 will result in a jar file named AV-0.1.jar. Is there a way to change the…
jayunit100
  • 17,388
  • 22
  • 92
  • 167
16
votes
2 answers

You can abbreviate list names? Why?

This got me pretty bad. You can abbreviate list names? I never noticed it before and I got totally screwed for like a day. Can someone explain what is happening here and why it could be more useful than it is terrible? And why its inconsistent…
enfascination
  • 1,006
  • 9
  • 20
15
votes
5 answers

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

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'…
Look Left
  • 1,305
  • 3
  • 15
  • 20
15
votes
3 answers

Extracting just a string element from a pandas dataframe

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,…
Hillary Sanders
  • 5,778
  • 10
  • 33
  • 50
14
votes
2 answers

Why is the code "foo::foo::foo::foob" compiling?

A co-worker accidentally wrote code like this: struct foo { foo() : baz(foobar) {} enum bar {foobar, fbar, foob}; bar baz; }; void f() { for( auto x : { foo::foobar, foo::fbar, foo:: …
sbi
  • 219,715
  • 46
  • 258
  • 445
1
2
3
58 59