Displaying 20 results from an estimated 9000 matches similar to: "Set a Numeric Field To Blank"
2023 Apr 03
1
Simple Stacking of Two Columns
Hi,
You were on the right track using stack(), but you just pass the entire data frame as a single object, not the separate columns:
> stack(NamesWide)
? values ? ind
1 ? ?Tom Name1
2 ? Dick Name1
3 ?Larry Name2
4 ?Curly Name2
Note that stack also returns the index (second column of 'ind' values), which tells you which column in the source data frame the stacked values originated
2018 Mar 05
0
Interpret List Label as Date from Quantmod getOptionChain
Package?
The **names** of the top levels of your lists, "Mar.09.2018", "Mar.23.2018"
certainly look like dates and if they are -- I have no idea what
package/context is -- they certainly could be formatted as such. See e.g.
"date-time" . There are also several package that provide date tools.
Cheers,
Bert
Bert Gunter
"The trouble with having an open mind is
2023 Apr 03
4
Simple Stacking of Two Columns
Hi R-Helpers,
Sorry to bother you, but I have a simple task that I can't figure out how to do.
For example, I have some names in two columns
NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly"))
and I simply want to get a single column
2018 Mar 05
2
Interpret List Label as Date from Quantmod getOptionChain
Package? Quantmod. In the subject line.
I agree that they look like dates, I don't know how to determine if they are actually dates.
Josh Ulrich usually answers questions along these lines very informatively and quickly. One reasonable course of action is to wait to see if he does the same with this one.
--JJS
________________________________
From: Bert Gunter <bgunter.4567 at
2011 Apr 12
2
Assign Character Value to Data Frame
Dear R Helpers,
I am trying to write a character value to the row of a data frame and am
running into a problem that I don't have when I do this for numeric
arguments. For example, the following works just fine:
> test<-data.frame(number=numeric(1))
> test[1,]<-.5
> test
number
1 0.5
But the following bombs out:
> hold<-data.frame(symbol=character(1))
>
2018 Mar 05
2
Interpret List Label as Date from Quantmod getOptionChain
Hi R Helpers,
Is it possible to interpret the top level of the list as a date after downloading all the option chain data for a ticker?
For example, after I run
aapl_total<-getOptionChain("AAPL", NULL)
the top descriptor of the lists is a date (Mar.09.2018, Mar.23.2018, etc.).
So if want to subset down to those parts of the list that correspond to say, (expiration)
2023 Apr 04
1
Simple Stacking of Two Columns
Just to repeat:
you have
NamesWide<-data.frame(Name1=c("Tom","Dick"),Name2=c("Larry","Curly"))
and you want
NamesLong<-data.frame(Names=c("Tom","Dick","Larry","Curly"))
There must be something I am missing, because
NamesLong <- data.frame(Names = c(NamesWide$Name1, NamesWide$Name2))
appears to
2011 Apr 24
3
If Then Trouble
Dear R Helpers,
I have another one of those problems involving a very simple step, but due
to my inexperience I can't find a way to solve it. I had a look at a
number of on-line references, but they don't speak to this problem.
I have a variable with 20 values
> table (testY2$redgroups)
1 2 3 4 5 6 7 8 9 10 11 12
13 14 15 16
2013 Apr 14
3
Create New Column Inside Data Frame for Many Data Frames
Dear R Helpers,
I have a large number of data frames and I need to create a new column
inside each data frame. Because there is a large number, I need to "loop"
through this, but I don't know the syntax of assigning a new column name
dynamically.
Below is a simple example of what I need to do. Assume that I have to do
this for all 26 letters and you should see the form of the
2013 Apr 29
3
Function for Data Frame
Dear R Helpers,
I have about 20 data frames that I need to do a series of data scrubbing
steps to. I have the list of data frames in a list so that I can use
lapply. I am trying to build a function that will do the data scrubbing
that I need. However, I am new to functions and there is something
fundamental that I am not understanding. I use the return function at the
end of the function and
2011 Mar 21
3
Replacing Period in String
Dear R Users,
I am working with gsub for the first time. I am trying to remove some
characters from a string. I have hit the problem where the period is the
shorthand for 'everything' in the R language when what I want to remove is
the actual periods. In the example below, I simply want to remove the
periods as I have removed the comma, but instead the complete string is
wiped out. I
2011 May 15
1
Find String Between Characters
Dear R Helpers,
I am trying to isolate a set of characters between two other characters in
a long string file. I tried some of the examples on the R help pages and
elsewhere, but I am not able to get it. Your help would be much
appreciated.
require(scrapeR)
2023 Apr 04
1
Simple Stacking of Two Columns
I may be missing something but using the plain old c() combine function
seems to work fine:
df <- data.frame(left = 1:5, right = 6:10)
df.combined <- data.frame(comb = c(df$left, df$right))
df
left right
1 1 6
2 2 7
3 3 8
4 4 9
5 5 10
df.combined
comb
1 1
2 2
3 3
4 4
5 5
6 6
7 7
8 8
9 9
10 10
-----Original
2011 Apr 13
1
Assign with Paste Problem
Dear R Helpers,
I am trying to change the name of an object using the assign function.
When I use paste on the new object but not the old, everything is fine:
The new object is a direct copy of the old object. When I use a paste for
both the new and the old object, however, the new object is simply the
character representation of the old object name, not the old object
itself.
The example
2011 Mar 18
1
quantmod Some Single Letter Tickers Not getFin
Hi,
I have been learning the quantmod package over the last several days. I
went to check some of my data pulls against other sources and was
surprised to find that a few tickers that have single characters do not
successfully scrape from Google Finance using getFin(). Particularly
require(quantmod)
getFin("A")
getFin("E")
getFin("F")
getFin("G")
2013 Apr 15
2
Remove Rows Based on Factor
Dear R Helpers,
I did a search for deleting rows based on conditions but wasn't able to
find an example that addressed the error that I am getting. I am hoping
that this is a simple syntax phenomenon that somebody else knows off the
top of their head. My apologies for not providing a reproducible example
but I think that the information given will allow someone to give me a
hint.
I want to
2013 May 17
2
Selecting A List of Columns
Dear R Helpers,
I need help with a slightly unusual situation in which I am trying to
select some columns from a data frame. I know how to use the subset
statement with column names as in:
x=as.data.frame(matrix(c(1,2,3,
1,2,3,
1,2,2,
1,2,2,
1,1,1),ncol=3,byrow=T))
all.cols<-colnames(x)
to.keep<-all.cols[1:2]
Kept<-subset(x,select=to.keep)
Kept
2012 Mar 04
1
quantmod getOptionChain Not Work
Dear R Helpers,
I am still having trouble with the getOptionChain command in quantmod. I
have the latest version of quantmod, etc. so I was under the impression
that the problem was solved with updates to the package.
If someone could let me know what I need to install in order to make this
work, I would really appreciate it.
My error message as session info are shown below. Thanks a bunch.
2011 May 24
2
Apply or Tapply to Build Set of Tables
Dear R Helpers,
First, I apologize for asking for help on the first of my topics. I have
been looking at the posts and pages for apply, tapply etc, and I know that
the solution to this must be ridiculously easy, but I just can't seem to
get my brain around it. If I want to produce a set of tables for all the
variables in my data, how can I do that without having to type them into
the table
2017 Jun 22
1
Question
This function won?t work with objects in spark as you can?t do a dfda$a in spark as it?s not stored as a local variable.
Thanks,
Amrith
> On Jun 22, 2017, at 4:15 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>
>
>> On Jun 22, 2017, at 11:22 AM, Amrith Deepak <adeepak at apple.com> wrote:
>>
>> Hi,
>>
>> I am using Spark and the