a few simple questions (data manipulations)

Reply
New Contributor
Posts: 4

a few simple questions (data manipulations)

I have a few (simple) questions but my instructor was not able to respond. I wonder if I can find a help here:

1) If I would like to assign a value in to a column X and a row Y in a dataset , how could I do that? For example, in R we can write: dataset[Y,X]=5.

2) Is there a function that can show which observation number for a given variable has a missing value? For example, in R: which (is.na(var))

3) Is there a function that can show which observation number for a given variable equals a certain number? For example, in R: which (var==5)

4) Is there a function that can assign a variable that equals variable names? For example, in R: new_var=names(dataset).

Thanks,
Yulia

Super User
Posts: 9,867

Re: a few simple questions (data manipulations)

1) If I would like to assign a value in to a column X and a row Y in a dataset , how could I do that? For example, in R we can write: dataset[Y,X]=5.

if _n_ = X then Y=5;

2) Is there a function that can show which observation number for a given variable has a missing value? For example, in R: which (is.na(var))

whichn(.)   or  whichc(.)

3) Is there a function that can show which observation number for a given variable equals a certain number? For example, in R: which (var==5)

if var=5 then put _n_ ;

4) Is there a function that can assign a variable that equals variable names? For example, in R: new_var=names(dataset).

vname(.)

New Contributor
Posts: 4

Re: a few simple questions (data manipulations)

Great! Thanks a lot! Yulia

Ask a Question
Discussion stats
  • 2 replies
  • 166 views
  • 0 likes
  • 2 in conversation